This document explains how to install the JBoss Application Server on a server running Debian GNU/Linux 4.0 (etch). Vermont uses Debian in its test and production environments, but Debian is not a requirement for running the gateway application, nor is Linux; developers at the State of Vermont have successfully tested the gateway on Microsoft Windows XP.
This document assumes that you have a server running the current version of Debian stable. Although, these instructions should apply to Ubuntu as well. The Debian install process is well documented and fairly straightforward, so we provide no documentation for it. We suggest that you do a minimal install using the Network Install CD. We also assume that you are preparing to install JBoss AS version 4.2.1 to /opt. 4.2.1 is the last version of JBoss that we've tested with these instructions.
The JBoss Application Server is a Java application. It requires the Java runtime environment (JRE). In the future we hope to use Sun's OpenJDK, but for now we are using Sun's non-free JDK.
To gain access to the packages in Debian you must edit /etc/apt/sources.list , adding contrib and non-free . The file should look like this:
deb http://mirror.anl.gov/debian/ etch main contrib non-free deb-src http://mirror.anl.gov/debian/ etch main contrib non-free deb http://security.debian.org/ etch/updates main contrib non-free deb-src http://security.debian.org/ etch/updates main contrib non-free
Update your packages database with this command:
# apt-get update
Install Java 5
# apt-get install sun-java5-jdk
Create a group named jboss
# groupadd jboss
Create a user named jboss in the jboss group and make a home directory for him:
# useradd -g jboss -m jboss
Navigate over to jboss.org . There you will find a pre-compiled version of JBoss AS 4.2.1 (jboss-4.2.1.GA.zip). Download it and move it over to your server.
Extract everything from the .zip file
# cd /opt && unzip ~/jboss-4.2.1.GA.zip
Set the ownership to our user jboss and his group jboss .
# chown -R jboss:jboss /opt/jboss-4.2.1.GA
To save time typing I like to create a symbolic link. This also makes upgrading to a new version easier because we don't have to alter the path to the JBoss start script in the init script.
# ln -s /opt/jboss-4.2.1.GA jboss
Here is the script we use. Feel free to use it, improve it, or write your own. We have our init script in a file with this name: /etc/init.d/jboss
#!/bin/sh
start(){
echo "starting jboss.."
su -l jboss -c '/opt/jboss/bin/run.sh >> /var/log/jboss/log 2>> /var/log/jboss/errors &'
}
stop(){
echo "stopping jboss.."
# su -l jboss -c '/opt/jboss/bin/shutdown.sh -S &'
su -l jboss -c '/opt/jboss/bin/shutdown.sh -S'
}
restart(){
stop
# give stuff some time to stop before we restart
sleep 60
# protect against any services that can't stop before we restart
# (warning this kills all Java instances running as 'jboss' user)
su -l jboss -c 'killall java'
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo "Usage: jboss {start|stop|restart}"
exit 1
esac
exit 0
Make the script executable.
# chmod +x /etc/init.d/jboss
Tell the system to start JBoss at boot and shut it down at halt.
# update-rc.d jboss defaults
The log directory referenced in the script doesn't exist yet, create it now.
# mkdir /var/log/jboss/
Set the proper ownership so that JBoss can write to the log directory.
# chown jboss:jboss /var/log/jboss/
To start JBoss issue this command.
# /etc/init.d/jboss start
To stop JBoss issue this command.
# /etc/init.d/jboss stop
Note : the init script should also properly handle being executed via the sudo command.
It is important to watch the log for errors when JBoss starts up for the first time. You can see if everything is happy or not. When hundreds of lines of exceptions scroll by it means everything is not happy. If that happens re-read these instructions to make sure you didn't miss anything. Then try Google.