2.10. Service Configuration
2.10.1. Configure JBoss EAP 6 as a Service in Red Hat Enterprise Linux (RPM Method)
Prerequisites
- Install JBoss EAP 6 using the RPM Method (Graphical or Text Based).
- Administrator privileges on the server are required.
Important
Use the following procedure to install JBoss EAP 6 as a service on Red Hat Enterprise Linux when the installation has been done using the RHN (RPM) method.
Procedure 2.17. Configure JBoss EAP 6 as a Service using the RPM Method in Red Hat Enterprise Linux
Install JBoss EAP 6
Install JBoss EAP 6 via the RPM method using one of the steps listed in the prerequisite sections listed above.Enable the service
The RPM install method for JBoss EAP 6 installs the requisite service files in their correct locations. All you need to do to set it up as service is issue the following command:chkconfig jbossas onTo set it up as a service in domain mode, issue the following command:chkconfig jbossas-domain 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.
2.10.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 2.18. 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.Customize the start-up options in the
jboss-as.conffileOpen the filejboss-as.confin a text editor. There are several options within thejboss-as.conffile. At the minimum, specify the correct values forJBOSS_HOMEand theJBOSS_USERvariables. If these variables are absent, add them.Copy files into system directories
- Create the
/etc/jboss-asdirectory if it doesn't already exist.sudo mkdir /etc/jboss-as - Copy the modified configuration file to the
/etc/jboss-asdirectory.sudo cp EAP_HOME/bin/init.d/jboss-as.conf /etc/jboss-as - Copy the start-up script to the
/etc/init.ddirectory.sudo cp EAP_HOME/bin/init.d/jboss-as-standalone.sh /etc/init.dTo make the start-up script executable.sudo chmod +x /etc/init.d/jboss-as-standalone.sh
Add the start-up script as a service.
Add the newjboss-as-standalone.shservice to list of automatically started services, using thechkconfigservice management command.sudo chkconfig --add jboss-as-standalone.shStart 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:
sudo service jboss-as-standalone.sh start - For Red Hat Enterprise Linux 7:
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.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 2.19. 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
stopcommand 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.confImportant
/etc/jboss-asis 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.
2.10.3. Configure JBoss EAP 6 as a Service in Microsoft Windows Server (Zip, Installer)
Prerequisites
- Install JBoss EAP 6 using the Zip installation, Graphical Installer, or Text-based Installer:
- Administrator privileges on the server are required.
- The
JAVA_HOMEsystem environment variable must be set. - The JBoss EAP 6 server instance must not be running.
Important
set command at a Windows Server command prompt will not permanently set the environment variable. You must use either the setx command, or the System interface in the Control Panel.
Use the following procedures to configure JBoss EAP 6 as a service on Microsoft Windows Server.
Procedure 2.20. Configure a Service for JBoss EAP 6 in Microsoft Windows Server
Create system environment variables
Create two system environment variables:JBOSS_HOMEpointing to the JBoss EAP 6 installation directory.NOPAUSE=1
If not already configured, download and extract the Native Utilities package for your architecture
If the Native Utilities for Windows Server package has not been installed as part of the JBoss EAP 6 installation, download the relevant 32-bit or 64-bit package from the Red Hat Customer Portal at https://access.redhat.com. Extract the Native Utilities zip archive over the JBoss EAP 6 installation.This will result in anativedirectory in the following location in the JBoss EAP 6 installation:EAP_HOME\modules\system\layers\base\Install the service
Open a terminal, and change directories toEAP_HOME\modules\system\layers\base\native\sbinA new service can be created with theservice installcommand, with the available options shown in the following table.Table 2.4.
service installoptionsArgument or Switch Description /startup Indicates the services to auto start. If not specified, the service is set to be started manually./controller HOST:PORT The host and port of the management interface. If omitted, the default islocalhost:9999./host [DOMAIN_HOST] Indicates that domain mode is to be used, with an optional host controller name. If the host controller name is omitted, the default namemasteris used./loglevel LEVEL The log level for the service, either:ERROR,INFO,WARNorDEBUG. If omitted, the default isINFO/name SERVICE_NAME The name of the service to be created, must not contain spaces. If omitted, the default isJBossEAP6/desc "DESCRIPTION" The description of the service. If omitted, the default is"JBoss Enterprise Application Platform 6"/serviceuser DOMAIN\USERNAME Specifies the name of the account under which the service will run. Use an account name in the format of DOMAIN\USERNAME. If omitted, the service runs as the Local System account./servicepass PASSWORD Password for /serviceuser account./jbossuser USERNAME Optional, the JBoss EAP 6 username to use for the shutdown command./jbosspass PASSWORD Password for /jbossuser account, required if /jbossuser is specified./config XML_FILE Specifies the server-config to use. The default isstandalone.xmlordomain.xml./hostconfig XML_FILE Specifies the host config to use in Domain mode only. The default ishost.xml./base directory Specifies the base directory for server/domain content as a fully qualified path. The default is%JBOSS_HOME%\standaloneor%JBOSS_HOME%\domain./logpath path Specifies the path of the log files./baseapplies when/logpathis not defined. The default depends on the domain mode or standalone mode,%JBOSS_HOME%\domain\logor%JBOSS_HOME%\standalone\log./debug Runs the service install in debug mode.Below are basic examples of aninstallcommand to create a new service in either standalone or domain mode. Execute the following command, adjusting the log level for the service as required:- Standalone mode:
service.bat install /loglevel INFO - Domain mode:If you are not using the default master for your JBoss EAP 6 domain controller, replace master with the correct host name or alias of the JBoss EAP 6 domain controller.
service.bat install /host master /loglevel INFO
A new Windows service will be created with nameJBossEAP6.Verify the new service in the Services console
Execute the following command in a terminal to open the Windows Services console:services.mscIf the default service name was used, in the list of Windows services, the new service will have the display name:JBossEAP6. From the Services console you can start and stop the service, as well change its settings on how and when it starts.Starting and stopping the JBoss EAP 6 service from a terminal
To start the service from a terminal, use the following command, changing the service name if necessary:net start JBossEAP6To stop the service from a terminal, use the following command, changing the service name if necessary:net stop JBossEAP6
A JBoss EAP 6 service is configured in Microsoft Windows Server.
Procedure 2.21. Uninstall the JBoss EAP 6 service from Microsoft Windows Server
- If the service is running, first open a terminal and stop the service by executing the
net stopcommand with the name of the service:net stop JBossEAP6In a terminal, change directories toEAP_HOME\modules\system\layers\base\native\sbinand execute the following command:service uninstall
The JBoss EAP 6 service has been removed from Microsoft Windows Server.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.