Chapter 7. Running and removing JBoss EAP as a service on RHEL
7.1. Running JBoss EAP as a service on RHEL
You can configure JBoss EAP to run as a service in Red Hat Enterprise Linux RHEL. This enables the JBoss EAP service to start automatically when the RHEL server starts.
Prerequisites
- You have downloaded and Installed JBoss EAP.
-
You have set the
JAVA_HOME
system environment variable. - You have administrator privileges on the server.
Procedure
-
Configure the start-up options in the
jboss-eap.conf
file by opening thejboss-eap.conf
in a text editor and set the options for your JBoss EAP installation. Copy the service initialization and configuration files into the system directories:
Copy the modified service configuration file to the
/etc/default
directory.NoteThe commands in this procedure require root privileges to run. Either run
su
- to switch to the root user or preface the commands withsudo
.sudo cp EAP_HOME/bin/init.d/jboss-eap.conf /etc/default
$ sudo cp EAP_HOME/bin/init.d/jboss-eap.conf /etc/default
Copy to Clipboard Copied! Copy the service startup script to the
/etc/init.d
directory and give it execute permissions:sudo cp EAP_HOME/bin/init.d/jboss-eap-rhel.sh /etc/init.d sudo chmod +x /etc/init.d/jboss-eap-rhel.sh sudo restorecon /etc/init.d/jboss-eap-rhel.sh
$ sudo cp EAP_HOME/bin/init.d/jboss-eap-rhel.sh /etc/init.d $ sudo chmod +x /etc/init.d/jboss-eap-rhel.sh $ sudo restorecon /etc/init.d/jboss-eap-rhel.sh
Copy to Clipboard Copied!
Add the new
jboss-eap-rhel.sh
service to the list of automatically started services using thechkconfig
service management command:sudo chkconfig --add jboss-eap-rhel.sh
$ sudo chkconfig --add jboss-eap-rhel.sh
Copy to Clipboard Copied! Verify that the service has been installed correctly by using the following command:
sudo systemctl start jboss-eap-rhel
$ sudo systemctl start jboss-eap-rhel
Copy to Clipboard Copied! Optional: To make the service start automatically when the RHEL server starts, run the following command:
sudo chkconfig jboss-eap-rhel.sh on
$ sudo chkconfig jboss-eap-rhel.sh on
Copy to Clipboard Copied!
Verification
-
To check the permissions of a file, enter the
ls -l
command in the directory containing the file. To check that the automatic service start is enabled, enter the following command:
sudo chkconfig --list jboss-eap-rhel.sh
$ sudo chkconfig --list jboss-eap-rhel.sh
Copy to Clipboard Copied!
Additional resources
- For more information about controlling the state of services, see Management system services in the JBoss EAP Configuring basic system settings guide.
- For more information about viewing error logs, see Bootup logging in the JBoss EAP Configuration Guide.
7.2. Removing JBoss EAP service on RHEL
You can remove an instance of JBoss EAP and any services associated with it. After you remove these components, you can install JBoss EAP by using a suitable installation method.
Prerequisites
- You have JBoss EAP installed.
Procedure
When the service is running, open a terminal and stop the service with one of the following command:
sudo service jboss-eap-rhel.sh stop
$ sudo service jboss-eap-rhel.sh stop
Copy to Clipboard Copied! NoteThe commands in this procedure require root privileges to run. Either run
su
- to switch to the root user or preface the commands withsudo
.Remove JBoss EAP from the list of services:
sudo chkconfig --del jboss-eap-rhel.sh
$ sudo chkconfig --del jboss-eap-rhel.sh
Copy to Clipboard Copied! Delete the configuration file and startup script:
sudo rm /etc/init.d/jboss-eap-rhel.sh sudo rm /etc/default/jboss-eap.conf
$ sudo rm /etc/init.d/jboss-eap-rhel.sh $ sudo rm /etc/default/jboss-eap.conf
Copy to Clipboard Copied!