Rechercher

Ce contenu n'est pas disponible dans la langue sélectionnée.

Chapter 3. Installing JBoss Web Server on Red Hat Enterprise Linux from RPM packages

download PDF

You can install JBoss Web Server on Red Hat Enterprise Linux (RHEL) from archive files or RPM packages. If you want to install JBoss Web Server from RPM packages, the installation packages are available from Red Hat Subscription Management.

Installing JBoss Web Server from RPM packages deploys Tomcat as a service and installs Tomcat resources into absolute paths.

Note

You can install JBoss Web Server on RHEL versions 8 and 9. Red Hat does not provide a distribution of JBoss Web Server 6.x for RHEL 7 systems.

3.1. Prerequisites

  • You have installed a supported Java Development Kit (JDK) by using the DNF package or from a compressed archive.
  • Your system is compliant with Red Hat Enterprise Linux package requirements.

3.1.1. Installing a JDK by using the DNF package manager

You can use the DNF package manager to install a Java Development Kit (JDK). For a full list of supported JDKs, see JBoss Web Server operating systems and configurations.

Note

This procedure describes how to install OpenJDK. If you want to install the Oracle JDK, see the Oracle documentation for more information.

Procedure

  1. Subscribe your Red Hat Enterprise Linux system to the appropriate channel:

    • rhel-8-server-rpms
    • rhel-9-server-rpms
  2. To install a supported JDK version, enter the following command as the root user:

    # dnf install java-<version>-openjdk-headless

    In the preceding command, replace java-<version> with java-11 or java-17.

    Note

    JBoss Web Server 6.x does not support OpenJDK 8.

  3. To ensure the correct JDK is in use, enter the following command as the root user:

    # alternatives --config java

    The preceding command returns a list 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.

    Important

    All software that uses the java command uses the JDK set by alternatives. Changing Java alternatives might impact on the running of other software.

3.1.2. Installing a JDK from a compressed archive

You can install a Java Development Kit (JDK) from a compressed archive such as a .zip or .tar file. For a full list of supported JDKs, see JBoss Web Server operating systems and configurations.

Procedure

  1. If you downloaded the JDK from the vendor’s website (Oracle or OpenJDK), use the installation instructions provided by the vendor and set the JAVA_HOME environment variable.
  2. If you installed the JDK from a compressed archive, set the JAVA_HOME environment variable for Tomcat:

    1. In the bin directory of Tomcat (JWS_HOME/tomcat/bin), create a file named setenv.sh.
    2. In the setenv.sh file, enter the JAVA_HOME path definition. For example:

      $ cat JWS_HOME/tomcat/bin/setenv.sh
      
      export JAVA_HOME=/usr/lib/jvm/jre-<version>-openjdk.x86_64

      In the preceding example, replace jre-<version> with jre-11 or jre-17.

3.1.3. Red Hat Enterprise Linux package requirements

Before you install JBoss Web Server on Red Hat Enterprise Linux, you must ensure that your system is compliant with the following package requirements.

  • On Red Hat Enterprise Linux version 8 or 9, if you want to use OpenSSL or Apache Portable Runtime (APR), you must install the openssl and apr packages that Red Hat Enterprise Linux provides.

    • To install the openssl package, enter the following command as the root user:

      # dnf install openssl
    • To install the apr package, enter the following command as the root user:

      # dnf install apr
  • You must remove the tomcatjss package before you install the tomcat-native package. The tomcatjss package uses an underlying Network Security Services (NSS) security model rather than the OpenSSL security model.

    To remove the tomcatjss package, enter the following command as the root user:

    # dnf remove tomcatjss

3.2. Attaching subscriptions to Red Hat Enterprise Linux

Before you download and install the RPM packages for JBoss Web Server, you must register your system with Red Hat Subscription Management, and subscribe to the respective Content Delivery Network (CDN) repositories. You can subsequently perform some verification steps to ensure that a subscription provides the required CDN repositories.

Procedure

  1. Log in to the Red Hat Subscription Management web page.
  2. Click the Systems tab.
  3. Click the Name of the system that you want to add the subscription to.
  4. Change from the Details tab to the Subscriptions tab, and then click Attach Subscriptions.
  5. Select the check box next to the subscription you want to attach, and then click Attach Subscriptions.

Verification

  1. Log in to the Red Hat Subscriptions web page.
  2. In the Subscription Name column, click the subscription that you want to select.
  3. Under Products Provided, you require both of the following:

    • JBoss Enterprise Web Server
    • Red Hat JBoss Core Services

3.3. Installing JBoss Web Server from RPM packages by using DNF

You can use the DNF package manager to install JBoss Web Server from RPM packages on Red Hat Enterprise Linux.

Procedure

  1. To subscribe to the JBoss Web Server CDN repositories for your operating system version, enter the following command:

    # subscription-manager repos --enable <repository>
    Note

    In the preceding command, replace <repository> with the following values:

    • On Red Hat Enterprise Linux 8, replace <repository> with jws-6-for-rhel-8-x86_64-rpms.
    • On Red Hat Enterprise Linux 9, replace <repository> with jws-6-for-rhel-9-x86_64-rpms.
  2. To install JBoss Web Server, enter the following command as the root user:

    # dnf groupinstall jws6
    Important

    When you install JBoss Web Server from RPM packages, the JWS_HOME folder is /opt/rh/jws6/root/usr/share.

Note
  • You can install each of the packages and their dependencies individually rather than use the groupinstall command. The preferred method is to use groupinstall.
  • The feature to enable NFS usage by using Software Collection is enabled. For more information about this feature, see the Packaging Guide: Using Software Collections over NFS.

3.4. Starting JBoss Web Server when installed from RPMs

When you install JBoss Web Server from RPM packages, you can use the commmand line to start JBoss Web Server. You can subsequently view the output of the service status command to verify that Tomcat is running successfully.

Procedure

  • Enter the following command as the root user:

    # systemctl start jws6-tomcat.service
    Note

    This is the only supported method of starting JBoss Web Server for an RPM installation.

Verification

  • To verify that Tomcat is running, enter the following command as any user:

    # systemctl status jws6-tomcat.service

3.5. Stopping JBoss Web Server when installed from RPMs

When you install JBoss Web Server from RPM packages, you can use the command line to stop JBoss Web Server. You can subsequently view the output of the service status command to verify that Tomcat is running successfully.

Procedure

  • Enter the followng command as the root user:

    # systemctl stop jws6-tomcat.service

Verification

  • To verify that Tomcat is no longer running, enter the following command as any user:

    # systemctl status jws6-tomcat.service

3.6. Configuring JBoss Web Server services to start at system startup

When you install JBoss Web Server from RPM packages, you can configure JBoss Web Server services to start at system startup.

Procedure

  • Enter the following command:

    # systemctl enable jws6-tomcat.service

3.7. SELinux policies for JBoss Web Server

You can use Security-Enhanced Linux (SELinux) policies to define access controls for JBoss Web Server. These policies are a set of rules that determine access rights to the product.

3.7.1. SELinux policy information for jws6-tomcat

The SELinux security model is enforced by the kernel and ensures that applications have limited access to resources such as file system locations and ports. SELinux policies ensure that any errant processes that are compromised or poorly configured are restricted or prevented from running.

The jws6-tomcat-selinux packages in your JBoss Web Server installation provide a jws6_tomcat policy. The following table contains information about the supplied SELinux policy.

Table 3.1. RPMs and default SELinux policies
NamePort InformationPolicy Information

jws6_tomcat

Four ports in http_port_t (TCP ports 8080, 8005, 8009, and 8443) to allow the tomcat process to use them

The jws6_tomcat policy is installed, which sets the appropriate SELinux domain for the process when Tomcat executes. It also sets the appropriate contexts to allow Tomcat to write to the following directories:

  • /var/opt/rh/jws6/lib/tomcat
  • /var/opt/rh/jws6/log/tomcat
  • /var/opt/rh/jws6/cache/tomcat
  • /var/opt/rh/jws6/run/tomcat.pid

Additional resources

3.7.2. Enabling SELinux policies for a JBoss Web Server RPM installation

When you install JBoss Web Server from RPM packages, the jws6-tomcat-selinux package provides SELinux policies for JBoss Web Server. These packages are available in the JBoss Web Server channel.

Procedure

  1. Install the jws6-tomcat-selinux package:

    dnf install -y jws6-tomcat-selinux
Red Hat logoGithubRedditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez leBlog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

© 2024 Red Hat, Inc.