Chapter 2. Installing JBoss Web Server on Red Hat Enterprise Linux
You can install JBoss Web Server on Red Hat Enterprise Linux using one of two methods:
Regardless of which method you choose, you must first install a supported Java Development Kit (JDK).
2.1. Prerequisites
2.1.1. Installing a Java Development Kit (JDK)
Before installing JBoss Web Server, you must first install a supported Java Development Kit (JDK).
Subscribe your Red Hat Enterprise Linux system to the appropriate channel:
OpenJDK:
- rhel-6-server-rpms
- rhel-7-server-rpms
Oracle:
- rhel-6-server-thirdparty-oracle-java-rpms
- rhel-7-server-thirdparty-oracle-java-rpms
IBM:
- rhel-6-server-supplementary-rpms
- rhel-7-server-supplementary-rpms
As the root user, execute the command to install a 1.7 or 1.8 JDK:
For JDK 1.7:
# yum install java-1.7.0-<VENDOR>-develReplace
<VENDOR>withoracle,ibm, oropenjdk.For JDK 1.8:
# yum install java-1.8.0-<VENDOR>-develReplace
<VENDOR>withoracle,ibm, oropenjdk.
Run the following commands as the root user to ensure the correct JDK is in use:
# alternatives --config java
# alternatives --config javac
These commands return lists of available JDK versions with the selected version marked with a plus (
+) sign. If the selected JDK is not the desired one, change to the desired JDK as instructed in the shell prompt.ImportantAll software that use the
javaandjavaccommands uses the JDK set byalternatives. Changing Java alternatives may impact on the running of other software.
2.1.2. Red Hat Enterprise Linux Package Prerequisites
Before installing JBoss Web Server on Red Hat Enterprise Linux, ensure the following prerequisites are met.
- A supported JDK is installed.
-
You must remove the
tomcatjsspackage before installing thetomcat-nativepackage. Thetomcatjsspackage uses an underlying NSS security model rather than the OpenSSL security model.
Removing the tomcatjss Package
As the root user, run the following command to remove
tomcatjss:# yum remove tomcatjss
2.2. ZIP Installation
Ensure that all of the prerequisites are met before installing JBoss Web Server.
2.2.1. Downloading and Extracting JBoss Web Server
To install JBoss Web Server, download and extract the installation ZIP files.
Downloading JBoss Web Server
- Open a browser and log in to the Red Hat Customer Portal.
- Click Downloads.
- Click Red Hat JBoss Web Server in the Product Downloads list.
- Select the correct JBoss Web Server version from the Version drop-down menu.
Click Download for each of the following files, ensuring that you select the correct platform and architecture for your system:
-
Red Hat JBoss Web Server 3.1 Application Server (
jws-application-servers-3.1.0-<platform>-<architecture>.zip)
-
Red Hat JBoss Web Server 3.1 Application Server (
Extracting JBoss Web Server
Unzip the downloaded ZIP files to your installation directory.
The directory created by extracting the ZIP archives is the top-level directory for JBoss Web Server. This is referred to as
JWS_HOME.
2.2.2. Configuring the JBoss Web Server Installation
Some configuration is required before running JBoss Web Server. This section includes the following configuration procedures:
- Setting the JAVA_HOME Environment Variable
- Creating the tomcat user for simple and secure user management: Creating a Tomcat User.
- Enabling log4j Logging for Tomcat
Setting the JAVA_HOME Environment Variable
You must set the JAVA_HOME environment variable for Tomcat before running JBoss Web Server.
In the bin directory of Tomcat (either JWS_HOME/tomcat7/bin or JWS_HOME/tomcat8/bin), create a file named setenv.sh, and insert the JAVA_HOME path definition.
For example: export JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64
Creating a Tomcat User
Follow this procedure to create the tomcat user and its parent group:
-
In a shell prompt as the root user, change directory to
JWS_HOME. Run the following command to create the
tomcatuser group:# groupadd -g 53 -r tomcat
Run the following command to create the
tomcatuser in thetomcatuser group:# useradd -c "Tomcat" -u 53 -g tomcat -s /bin/sh -r tomcat
Check that the
tomcatuser group and thetomcatuser were created correctly:$ grep tomcat /etc/group tomcat:x:53 $ grep tomcat /etc/passwd tomcat:x:53:53:Tomcat:/home/tomcat:/bin/sh
From
JWS_HOME, run the following command to assign the ownership of the Tomcat directories to thetomcatuser to allow the user to run the Tomcat service:# chown -R tomcat:tomcat tomcat<VERSION>Replace
<VERSION>with the respective Tomcat version number (7or8).You can use
ls -lto verify that thetomcatuser is the owner of the directory.Ensure that the
tomcatuser has execute permissions to all parent directories. For example:# chmod -R u+X tomcat<VERSION>
Enabling Apache Log4j Logging for Tomcat
To enable logging with Apache Log4j:
Change directory to
JWS_HOME/extras/:# cd JWS_HOME/extras/Copy
log4j-eap6.jarandlog4j.propertiesfromJWS_HOME/extras/toJWS_HOME/lib.# cp log4j.properties log4j-eap6.jar ../tomcat<VERSION>/lib/Replace
<VERSION>with the Tomcat version number (7or8).Change directory to
JWS_HOME/tomcat<VERSION>/extras/:# cd ../tomcat<VERSION>/extras/
Copy
tomcat-juli-adapters.jarfromJWS_HOME/tomcat<VERSION>/extrastoJWS_HOME/tomcat<VERSION>/lib.# cp tomcat-juli-adapters.jar ../lib/
Replace
JWS_HOME/tomcat<VERSION>/bin/tomcat-juli.jarwithJWS_HOME/tomcat<VERSION>/extras/tomcat-juli.jar:# cp tomcat-juli.jar ../bin/
2.2.3. Starting JBoss Web Server
To start JBoss Web Server, you must start the following:
- Tomcat (7 or 8).
Before starting Tomcat, ensure that the following prerequisites are met:
Starting Tomcat
Run the following command as the
tomcatuser with your respective Tomcat version (7or8):$ sh JWS_HOME/tomcat<VERSION>/bin/startup.shImportantAlthough there are multiple methods of starting Tomcat, it is recommended that you use the
startup.shscript. To start Tomcat as a service using Jsvc, see the Jsvc chapter.
2.2.4. Stopping JBoss Web Server
To stop JBoss Web Server, you must stop the following:
- Tomcat (7 or 8).
Stopping Tomcat
To stop Tomcat, run the following command as the root user with your respective Tomcat version (
7or8):# sh JWS_HOME/tomcat<VERSION>/bin/shutdown.sh
2.3. RPM Installation
Installing JBoss Web Server from RPM packages installs Tomcat as service, and installs its resources into absolute paths. The RPM installation option is only available for Red Hat Enterprise Linux 6 and Red Hat Enterprise Linux 7.
RPM installation packages for JBoss Web Server are available from Red Hat Subscription Management.
For users wanting to manage JBoss Web Server installations using Red Hat Satellite: although Red Hat Satellite 6 is recommended for managing JBoss Web Server 3.1 installations, the following Red Hat Network (RHN) channels are also provided specifically for Satellite 5 users:
For Red Hat Enterprise Linux 6:
- jws-3-x86_64-server-6-rpm
- jws-3-i386-server-6-rpm
For Red Hat Enterprise Linux 7:
- jws-3-x86_64-server-7-rpm
Red Hat Satellite 6 users can use the Red Hat Content Delivery Network (CDN) repositories.
Installing JBoss Web Server from RPM packages shares Java library files with other applications. Library version conflicts occur when using RPM packages to install both JBoss Web Server 3 and JBoss EAP 6 on the same machine. To workaround the issue, you can install either JBoss Web Server 3 or JBoss EAP 6 using the RPM installation method, and the other using the ZIP installation method.
2.3.1. Installing JBoss Web Server from RPM packages
Before downloading and installing the RPM packages, you must register your system with Red Hat Subscription Management and subscribe to the respective Content Delivery Network (CDN) repositories.
For information on registering Red Hat Enterprise Linux, see Configuring the Subscription Service for Red Hat Enterprise Linux 6 or The Subscription Manager for Red Hat Enterprise Linux 7.
Attaching subscriptions to Red Hat Enterprise Linux (if required)
If the system does not have a subscription attached that provides JBoss Web Server:
- Log in to the Red Hat Subscription Manager.
- Click on the Systems tab.
-
Click on the
Nameof the system to add the subscription to. -
Change from the Details tab to the Subscriptions tab, then click
Attach Subscriptions. -
Select the check box beside the subscription to attach, then click
Attach Subscriptions.
To verify that a subscription provides the required CDN repositories:
- Log in to: https://access.redhat.com/management/subscriptions.
-
Click the
Subscription Name. Under Products Provided, you require:
- JBoss Enterprise Web Server.
- Red Hat JBoss Core Services.
Installing JBoss Web Server from RPM packages using YUM
On a command line, subscribe to the JBoss Web Server CDN repositories for your operating system version using
subscription-manager:# subscription-manager repos --enable <repository>For Red Hat Enterprise Linux 6:
- jws-3-for-rhel-6-server-rpms
- jb-coreservices-1-for-rhel-6-server-rpms
For Red Hat Enterprise Linux 7:
- jws-3-for-rhel-7-server-rpms
- jb-coreservices-1-for-rhel-7-server-rpms
Issue the following command as the root user to install JBoss Web Server:
# yum groupinstall jws3
Note- Although not recommended, instead of using the group install, you can install each of the packages and their dependencies individually.
- The Red Hat JBoss Core Services repositories above are required for the installation of JBoss Web Server.
2.3.2. Installing the JBoss Web Server Plus Group
The JBoss Web Server Plus group contains additional packages, mainly for the addition of Hibernate and its dependencies.
To install the JBoss Web Server Plus group of packages, run the following command as the root user:
# yum groupinstall jws3plus
2.3.3. Starting JBoss Web Server
To start JBoss Web Server, you must start the following:
- Tomcat (7 or 8)
Starting Tomcat
In a shell prompt as the root user, start the Tomcat service. Replace
<VERSION>with the desired Tomcat version (7or8):For Red Hat Enterprise Linux 6:
# service tomcat<VERSION> startFor Red Hat Enterprise Linux 7:
# systemctl start tomcat<VERSION>.service
This is the only supported method of starting Tomcat for an RPM installation.
To verify that Tomcat is running, the output of the service
statuscommand should be reviewed. This can be executed as any user.For Red Hat Enterprise Linux 6:
# service tomcat<VERSION> statusFor Red Hat Enterprise Linux 7:
# systemctl status tomcat<VERSION>.service
2.3.4. Stopping JBoss Web Server
To stop JBoss Web Server, stop the Tomcat services.
Stopping Tomcat
In a shell prompt as the root user, stop the Tomcat service. Replace
<VERSION>with the desired Tomcat version (7or8):For Red Hat Enterprise Linux 6:
# service tomcat<VERSION> stopFor Red Hat Enterprise Linux 7:
# systemctl stop tomcat<VERSION>.service
To verify that Tomcat is no longer running, the output of the service
statuscommand should be reviewed. This can be executed as any user.For Red Hat Enterprise Linux 6:
# service tomcat<VERSION> statusFor Red Hat Enterprise Linux 7:
# systemctl status tomcat<VERSION>.service
2.3.5. Configuring JBoss Web Server Services to Start at Boot
You can configure JBoss Web Server to start at boot.
Use the following commands to enable the JBoss Web Server services to start at boot. Replace <VERSION> with the desired Tomcat version (7 or 8).
For Red Hat Enterprise Linux 6:
# chkconfig tomcat<VERSION> onFor Red Hat Enterprise Linux 7:
# systemctl enable tomcat<VERSION>.service
2.4. SELinux Policies
2.4.1. SELinux Policy Information
The following table contains information about the SELinux policies provided in the tomcat<version>-selinux packages.
Table 2.1. RPMs and Default SELinux Policies
| Name | Port Information | Policy Information |
|---|---|---|
| tomcat<version> |
Four ports in |
The Tomcat |
For more information about using SELinux and other Red Hat Enterprise Linux security information, see the Red Hat Enterprise Linux Security Guide.
2.4.2. SELinux Policies for an RPM Installation
SELinux policies for each Tomcat are provided via their own Tomcat sub-packages: tomcat7-selinux and tomcat8-selinux. These packages are available in the JWS channel.
-
To enable SELinux policies on Tomcat 7, install the
tomcat7-selinuxpackage. -
To enable SELinux policies on Tomcat 8, install the
tomcat8-selinuxpackage.
2.4.3. SELinux Policies for a ZIP Installation
In this release, SELinux policies are provided in the ZIP packages. The SELinux security model is enforced by the kernel and ensures applications have limited access to resources such as file system locations and ports. This helps ensure that the errant processes (either compromised or poorly configured) are restricted and in some cases prevented from running. The .postinstall.selinux file is included in each tomcat folder. If required, you can run the .postinstall.selinux script.
To install the SELinux policies using ZIP:
Install the
selinux-policy-develpackage:yum install -y selinux-policy-devel
Execute the
.postinstall.selinuxscript:cd <JWS_home>/tomcat<version> sh .postinstall.selinux
Where
tomcat<version>refers totomcat7ortomcat8.Make and install the SELinux module:
cd selinux make -f /usr/share/selinux/devel/Makefile semodule -i tomcat<version>.ppApply the SELinux contexts for JBoss Web Server:
restorecon -r <JWS_home>/tomcat<version>/
Add access permissions to the required ports for JBoss Web Server:
semanage port -a -t http_port_t -p tcp 8005 semanage port -a -t http_port_t -p tcp 8080 semanage port -a -t http_port_t -p tcp 8009 semanage port -a -t http_port_t -p tcp 8443
Start the Tomcat service:
<JWS_home>/bin/startup.shCheck the context of the running process expecting
tomcat_<version>__t:ps -eZ | grep tomcat | head -n1
To verify the contexts of the Tomcat directories, for example:
ls -lZ <JWS_home>/tomcat<version>/logs/
By default, the selinux policy provided is not active and the Tomcat processes run in the unconfined_java_t domain. This domain does not confine the processes, and it is recommended that you undertake the following security precautions if you chose not to enable the selinux policy provided:
-
Restrict file access for the
tomcatuser to only the files and directories that are necessary to the JBoss Web Server runtime. -
Do not run Tomcat as the
rootuser.

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.