3.9.2. Configure JBoss EAP 6 as a Service in Red Hat Enterprise Linux (Zip, Installer)
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
- Install JBoss EAP 6 using the Zip installation, Graphical Installer, or Text-based Installer:
- Administrator privileges on the server are required.
Procedure 3.17. Setup the Service
Locate the start-up script and configuration file
The start-up script and an associated configuration file are located in theEAP_HOME/bin/init.d/
directory. Open the configuration filejboss-as.conf
to edit it.Customize the start-up options in the
jboss-as.conf
fileThere are several options within thejboss-as.conf
file. At the minimum, specify the correct values forJBOSS_HOME
and theJBOSS_USER
variables. If these variables are absent, add them.Copy files into system directories
- 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/
- Copy the start-up script to the
/etc/init.d
directory.[user@host init.d]$
sudo cp jboss-as-standalone.sh /etc/init.d
Add the start-up script as a service.
Add the newjboss-as-standalone.sh
service to list of automatically started services, using thechkconfig
service management command.[user@host init.d]$
sudo chkconfig --add jboss-as-standalone.sh
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.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 withjboss-as-domain.sh
.
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.