4.9.2. Configure JBoss EAP 6 as a Service in Red Hat Enterprise Linux (Zip, Installer)
Prerequisites
- Install JBoss EAP 6 using the Zip installation, Graphical Installer, or Text-based Installer:
- Administrator privileges on the server are required.
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.
Procedure 4.17. Set Up the Service
Note
jboss-as-standalone.sh
with jboss-as-domain.sh
.
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 one of the following commands for Red Hat Enterprise Linux.- For Red Hat Enterprise Linux 5 and 6:
[user@host bin]$
sudo service jboss-as-standalone.sh start
- For Red Hat Enterprise Linux 7:
[user@host bin]$
sudo service jboss-as-standalone 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.Note
The green [OK] does not appear for Red Hat Enterprise Linux 7.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.[user@host init.d]$
sudo chkconfig jboss-as-standalone.sh on
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.
Procedure 4.18. Uninstall the JBoss EAP 6 service from Red Hat Enterprise Linux
Note
jboss-as-standalone.sh
with jboss-as-domain.sh
.
- If the service is running, first open a terminal and stop the service by executing the
stop
command with the name of the service:sudo service jboss-as-standalone.sh stop
- Remove JBoss EAP from the list of services:
sudo chkconfig --del jboss-as-standalone.sh
- Remove the system directory files.
- Remove the service start-up script:
sudo rm /etc/init.d/jboss-as-standalone.sh
- Remove the service configuration file:
sudo rm /etc/jboss-as/jboss-as.conf
Important
/etc/jboss-as
is not a standard system directory. Only if there are no other files being used there, also remove the directory itself:sudo rm -rf /etc/jboss-as/
JBoss EAP 6 service is uninstalled from the server.