Configuring JBoss 6.x to Run as a Service Under RHEL and CentOS

In most cases you will want to run JBoss as a non-privileged user.  For this example we will set up a jboss user (adding the user is an excersize for the user).  This example covers jboss-6.1.0-Final.

  • Add $JAVA_HOME and $JBOSS_HOME environmental vars to .bash_profile for your jboss user.  $JAVA_HOME points to your install of the JDK and $JBOSS_HOME points to your jboss installation directory.

    export JAVA_HOME
    export PATH


  • Once you have done the basic JBoss installation set up, copy the to /etc/init.d/jboss.
  • Add the following directly below the #!/bin/bash line:

# description: JBoss Start Stop Restart
# processname: jboss
# chkconfig: 234 20 80

  • JAVAPTH to the location of your JDK
  • Set JBOSS_CONF to the profile you want to run
  • define a $JBOSS_HOST variable and set it to either the IP address or host name of the machine on which you are running jboss.
  • Update the JBOSSCP to include the jbossall-client.jar


  • Replace the JBOSS_CMD_STOP with the following line (the uid:password combo is whatever you used to lock down the admin console in jboss):

JBOSS_CMD_STOP=”$JBOSS_HOME/bin/ -s service:jmx:rmi:///jndi/rmi:// -u admin -p password”

  • Enable jboss as a service in the OS:
  • Make the jboss script executable:
  • # chmod 755 jboss

Add it as a service via chkconfig:

  • # chkconfig –add jboss

Set the run levels for the jboss service

  • # chkconfig –level 2345 jboss on

Leave a Reply