3.9.2. Configure JBoss EAP 6 as a Service in Red Hat Enterprise Linux (Zip, Installer)

Summary

Use the following procedure to install JBoss EAP 6 as a service on Red Hat Enterprise Linux when the installation has been done with either the zip, text, or graphical methods. This process does not apply when the installation has been done using the RHN (RPM) method.

Prerequisites

Procedure 3.17. Setup the Service

  1. Locate the start-up script and configuration file

    The start-up script and an associated configuration file are located in the EAP_HOME/bin/init.d/ directory. Open the configuration file jboss-as.conf to edit it.
  2. Customize the start-up options in the jboss-as.conf file

    There are several options within the jboss-as.conf file. At the minimum, specify the correct values for JBOSS_HOME and the JBOSS_USER variables. If these variables are absent, add them.
  3. Copy files into system directories

    1. Copy the modified configuration file to the /etc/jboss-as directory.
      [user@host init.d]$ sudo mkdir /etc/jboss-as
      [user@host init.d]$ sudo cp jboss-as.conf /etc/jboss-as/
    2. Copy the start-up script to the /etc/init.d directory.
      [user@host init.d]$ sudo cp jboss-as-standalone.sh /etc/init.d
  4. Add the start-up script as a service.

    Add the new jboss-as-standalone.sh service to list of automatically started services, using the chkconfig service management command.
    [user@host init.d]$ sudo chkconfig --add jboss-as-standalone.sh
  5. Start the service.

    Test that the service has been installed correctly by using the standard syntax for starting Red Hat Enterprise Linux services.
    [user@host bin]$ sudo service jboss-as-standalone.sh start
    If everything has gone correctly, you should get a green [OK]. If you get an error, check the error logs and make sure your paths are correct in the configuration file.
  6. Make the service start automatically when you restart your server.

    To add the service to the list of services which start automatically when your server restarts, issue the following command.
    [root@host ~]# chkconfig jboss-as-standalone.sh on
    The service will now be started when your server reaches run-level 3, and will be stopped when your server is shut down or restarted.

    Note

    The steps above describe running EAP as a service in standalone mode. In order to run EAP as a service in domain mode, use the same steps but replace the start-up script with jboss-as-domain.sh.
Result

JBoss EAP 6 starts automatically when the Red Hat Enterprise Linux reaches its default run-level, and stops automatically when the operating system goes through its shutdown routine.