Requirements : JDK 6
Ubuntu : 10.04
Download Jboss from link : JbossDownload
Create Directory :
sudo mkdir /usr/local/jboss
Extract contents of the downloaded file into this directory
sudo unzip [downloaded_file_name]
Add user called jboss with this command :
sudo useradd -d /usr/local/jboss -s /bin/sh jboss
Now set ownership of this directory to jboss :
sudo chown -R jboss:jboss /usr/local/jboss
Make a copy of the jboss_init_redhat.sh in the bin directory like so
sudo cp /usr/local/jboss/bin/jboss_init_redhat.sh /usr/local/jboss/bin/jboss_init_ubuntu.sh
Now edit this script to make certain changes
sudo gedit /usr/local/jboss/bin/jboss_init_ubuntu.sh
To set the correct path for Java — > Change line
JAVAPTH=${JAVAPTH:-”/usr/local/jdk/bin”}
to
JAVAPTH=${JAVAPTH:-”/usr/bin”}
And change line
JBOSS_BIND_ADDR=${JBOSS_HOST:+”-b $JBOSS_HOST”}
To
JBOSS_BIND_ADDR=${JBOSS_HOST:+”-b 0.0.0.0″}
Explanation : This binds it on all IP addresses. To bind to a specific address, replace the 0.0.0.0.
Now copy this file to the startup scripts folder
sudo cp /usr/local/jboss/bin/jboss_init_ubuntu.sh /etc/init.d/jboss
To add Jboss to the init system
sudo update-rc.d jboss defaults
Result :
update-rc.d: warning: /etc/init.d/jboss missing LSB information
update-rc.d: see
Adding system startup for /etc/init.d/jboss …
/etc/rc0.d/K20jboss -> ../init.d/jboss
/etc/rc1.d/K20jboss -> ../init.d/jboss
/etc/rc6.d/K20jboss -> ../init.d/jboss
/etc/rc2.d/S20jboss -> ../init.d/jboss
/etc/rc3.d/S20jboss -> ../init.d/jboss
/etc/rc4.d/S20jboss -> ../init.d/jboss
/etc/rc5.d/S20jboss -> ../init.d/jboss
Note : In case you want to remove previous instances of Jboss in the init system run :
sudo update-rc.d -f jboss remove
Now just to be sure about the permissions
sudo chown -R jboss:jboss /usr/local/jboss
sudo chmod -R 755 /usr/local/jboss
Now you can start the server by
sudo /etc/init.d/jboss start
And stop the server by
sudo /etc/init.d/jboss stop