Weblogs for andershedstrom
Start JBoss on boot with Debian 3.1
This is a short and easy HOW-TO guide. It describes in a few steps how to start JBoss on boot with Debian 3.1. This is not the only way to accomplish this task, but this is the way I take. I do not issue any guarantee that this will work for you and your system (but it should with some tweaking).
System Details
The system used in this how-to guide has the following installed:
Operating System: Debian Sarge (3.1) – the base system.
JDK: Sun JDK 5 (see: Install Sun JDK 5)
JBoss: JBoss 4.0.3SP1 (see: Install JBoss)
HOW-TO GUIDE
- Change to /etc/init.d and switch to root user.
> cd /etc/init.d > su Password:
- Create a file named jboss
> touch jboss
- Open the newly created file, add the following
#! /bin/sh # /etc/init.d/jboss: Start and stop JBoss AS ECHO=/bin/echo TEST=/usr/bin/test JBOSS_START_SCRIPT=/usr/local/jboss-4.0.3SP1/bin/run.sh JBOSS_STOP_SCRIPT=/usr/local/jboss-4.0.3SP1/bin/shutdown.sh $TEST –x $JBOSS_START_SCRIPT || exit 0 $TEST –x $JBOSS_STOP_SCRIPT || exit 0 start() { $ECHO –n "Starting JBoss" su – jboss –c "$JBOSS_START_SCRIPT > /dev/null 2> /dev/null &" $ECHO "." } stop() { $ECHO –n "Stopping JBoss" su – jboss – c "$JBOSS_STOP_SCRIPT –S > /dev/null &" $ECHO "." } case "$1" in start) start ;; stop) stop ;; restart) stop sleep 30 start ;; *) $ECHO "Usage: jboss {start|stop|restart}" exit 1 esac exit 0Save and close the file - Change the permissions on the file by executing the following command
> chmod 755 jboss
- Test your script by executing the following commands
> ./jboss Usage: jboss {start|stop|restart} > ./jboss start Starting JBoss. - Make sure that JBoss is running by executing the following command
> ps –A|grep java 1164 pts/0 00:00:00 java 1165 pts/0 00:00:00 java 1166 pts/0 00:00:01 java …
You should see a lot of java processes running. - Stop JBoss by executing the following command
> ./jboss stop Stopping JBoss.
- Check that JBoss really was stopped by executing the same command as above for checking that JBoss was running. Now you shouldn’t see any java processes running
> ps –A|grep java >
- Update the run level so this script will be executed at start up by executing the following command
> update-rc.d jboss defaults 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
- Restart your system
> /sbin/reboot
- When the system is up again, make sure JBoss was started
> ps –A|grep java 944 pts/0 00:00:00 java 945 pts/0 00:00:00 java 946 pts/0 00:00:01 java …
Install JBoss on Debian 3.1
This is a short and easy HOW-TO guide. It describes in a few steps how to install JBoss 4.0.3 SP1 on Debian 3.1. This is not the only way to accomplish this task, but this is the way I take. I do not issue any guarantee that this will work for you and your system (but it should with some tweaking).
System Details
The system used in this how-to guide has the following installed:
Operating System: Debian Sarge (3.1) – the base system.
JDK: Sun JDK 5 (see: Install Sun JDK 5)
HOW-TO GUIDE
· Download JBoss to your preferred download directory. (Chose the file named jboss-4.0.3SP1.tar.gz).
· Change to the directory where you want to install JBoss. I chose /usr/local
> cd /usr/local |
· Switch to root user and unpack the file you downloaded
> suPassword:> tar –xvzf /home/download/jboss-4.0.3SP1.tar.gz |
· Now you should have a directory named jboss-4.0.3SP1 in /usr/local
· Change the owner of the jboss directories and files to the user you will use to run JBoss, so we won’t have any problems with permissions. I create a new user named jboss first.
> useradd jboss(…go thru all steps to create the new user…)> chown –R jboss:jboss jboss-4.0.3SP1 |
· Exit the root user and switch to the user that will run JBoss, in my case jboss
> exit> su jbossPassword: |
· You can now start JBoss
> cd /usr/local/jboss-4.0.3SP1/bin
> ./run.sh =========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /usr/local/jboss-4.0.3SP1
JAVA: /usr/local/lib/jdk/bin/java
JAVA_OPTS: -server -Xms128m -Xmx128m -Dprogram.name=run.sh
CLASSPATH: /usr/local/jboss-4.0.3SP1/bin/run.jar:/usr/local/lib/jdk/lib/tools. jar
=========================================================================
18:39:36,037 INFO [Server] Starting JBoss (MX MicroKernel)... … |
Install Sun JDK 5 on Debian 3.1
This is a short and easy HOW-TO guide. It describes in a few steps how to install Sun’s JDK 5 on Debian 3.1. This is not the only way to accomplish this task, but this is the way I take. I do not issue any guarantee that this will work for you and your system (but it should with some tweaking).
System Details
The system used in this how-to guide has the following installed:
Operating System: Debian Sarge (3.1) – the base system.
HOW-TO GUIDE
· Download Sun’s JDK 5 to your preferred download directory. (I chose the self-extracting binary file).
· Change to the directory where you want to install JDK 5. I chose /usr/local/lib
> cd /usr/local/lib |
· Switch to root user and execute the self-extracting file you downloaded
> suPassword:> /home/download/jdk-1_5_0_06-linux-i586.bin |
· Accept the license agreement.
· Now you should have a directory named jdk1.5.0_06 in /usr/local/lib
· Create a symbolic link called jdk to this directory. It allows you to easily switch back and forth between different jvm’s.
> ln –s jdk1.5.0_06 jdk |
· You now need to set and update some environment variables. Open /etc/profile and delete the line export PATH and add the following
JAVA_HOME=/usr/local/lib/jdkPATH=$PATH:$JAVA_HOME/bin export PATH JAVA_HOME |
/etc/profile is executed at start-up and when the user log on the system. For you to update your environment you need to log out and log on the system.
· After you’ve logged out and on to the system again, you can verify your installation be executing the following commands
> echo $JAVA_HOME/usr/local/lib/jdk > which java /usr/local/lib/jdk/bin/java > java –version Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing) |