CentLinux | Learn How to Install CentOS/Rocky Linux Servers

Thursday, January 13, 2022

How to install WildFly on CentOS/RHEL 8

Install WildFly on CentOS / Red Hat Enterprise Linux (RHEL) 8

Complete step by step guide with tips to install WildFly on CentOS / Red Hat Enterprise Linux (RHEL) 8.

 

Table of Contents:

 

Install WildFly on CentOS / Red Hat Enterprise Linux (RHEL) 8

What is WildFly? :

WildFly, formerly known as JBoss AS, or simply JBoss, is an application server authored by JBoss, now developed by Red Hat. On November 20, 2014, JBoss Application Server was renamed WildFly.

WildFly is written in Java and implements the Java Platform, Enterprise Edition (Java EE) specification. It runs on multiple platforms.

WildFly is free and open-source software, subject to the requirements of the GNU Lesser General Public License (LGPL), version 2.1.

 

Recommended Books: Red Hat RHCE 8 (EX294) Cert Guide (Certification Guide) 1st Edition

 

Environment Specification:

We are using a minimal Red Hat Enterprise Linux 8 virtual machine with following specifications.

  • CPU - 3.4 Ghz (2 cores)
  • Memory - 2 GB
  • Storage - 20 GB
  • Operating System - Red Hat Enterprise Linux 8.5
  • Hostname – wildfly-01.centlinux.com
  • IP Address - 192.168.116.243 /24

 

Update Linux Operating System:

Connect with wildfly-01.centlinux.com as root user by using a ssh client.

Build cache for enabled yum repositories on your Linux server.

# dnf makecache

Execute following command to update your Linux operating system.

# dnf update -y

If the above command updates your Linux Kernel then reboot your Linux server with the newly installed Kernel.

# reboot

After reboot, verify the version of Linux Kernel and Linux operating system.

# uname -r
4.18.0-348.7.1.el8_5.x86_64

# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.5 (Ootpa)

 

Install WildFly Prerequisites:

JBoss Application Server / WildFly is written in Java programming language. Therefore, it requires Java Runtime Environment for execution.

You can easily install OpenJDK, that is available through standard yum repositories.

# dnf install -y java-11-openjdk-devel

After installation, verify that the java command is available by querying its version as follows.

# java --version
openjdk 11.0.13 2021-10-19 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.13+8-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.13+8-LTS, mixed mode, sharing)

You may also need wget command to download WildFly installation file. Therefore, install it now by using dnf command.

# dnf install -y wget

 

Create Linux User and Group:

Create a Linux user and group to own WildFly software and processes.

# groupadd -r wildfly
# useradd -r -g wildfly -d /opt/wildfly -s /sbin/nologin wildfly

 

WildFly Installation on CentOS / Red Hat Enterprise Linux (RHEL) 8:

WildFly is a free and open source software. Therefore, you can download latest WildFly software from their official website.

WildFly Download Page

Copy the URL of your required version of WildFly software and use it with wget command to download WildFly straight from the Linux CLI.

# wget https://github.com/wildfly/wildfly/releases/download/26.0.0.Final/wildfly-26.0.0.Final.tar.gz
--2022-01-07 22:40:20--  https://github.com/wildfly/wildfly/releases/download/26.0.0.Final/wildfly-26.0.0.Final.tar.gz
Resolving github.com (github.com)... 13.234.176.102
Connecting to github.com (github.com)|13.234.176.102|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 217583886 (208M) [application/octet-stream]
Saving to: ‘wildfly-26.0.0.Final.tar.gz’

wildfly-26.0.0.Fina 100%[===================>] 207.50M  1.05MB/s    in 3m 23s

2022-01-07 22:43:45 (1.02 MB/s) - ‘wildfly-26.0.0.Final.tar.gz’ saved [217583886/217583886]

We have down TGZ file, howerver you can also download ZIP file of WildFly software.

Execute following tar command to extract WildFly TGZ file to the desired location.

# tar xf wildfly-26.0.0.Final.tar.gz -C /opt/

Create a soft link of WildFly software directory for convenience.

# ln -s /opt/wildfly-26.0.0.Final/ /opt/wildfly

Adjust ownership of extracted files as follows.

# chown -RH wildfly: /opt/wildfly

Create a directory for WildFly configuration files.

# mkdir -p /etc/wildfly

 

Configure WildFly Service:

WildFly software directory contains sample configuration files. You can use these configuration files to configure a Systemd service for your JBoss application server.

# cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.conf /etc/wildfly/
# cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.service /etc/systemd/system/
# cp /opt/wildfly/docs/contrib/scripts/systemd/launch.sh /opt/wildfly/bin/

Grant execution privileges on WildFly scripts.

# chmod +x /opt/wildfly/bin/*.sh

Enable and start WildFly service.

# systemctl daemon-reload
# systemctl enable --now wildfly.service
Created symlink /etc/systemd/system/multi-user.target.wants/wildfly.service → /etc/systemd/system/wildfly.service.

 

Configure Linux Firewall:

WildFly default service port is 8080/tcp and the Management Console uses 9990/tcp.

Therefore, you are required to allow these service ports in Linux Firewall to make the WildFly services accessible across the network.

# firewall-cmd --permanent --add-port={8080,9990}/tcp
success
# firewall-cmd --reload
success

 

Configure WildFly Management Console:

WildFly management console does not has a default user. Therefore, you must create an Admin user for using WildFly management console.

You can execute add-user.sh script to create a user for WildFly management console.

# /opt/wildfly/bin/add-user.sh

What type of user do you wish to add?
 a) Management User (mgmt-users.properties)
 b) Application User (application-users.properties)
(a):

Enter the details of the new user to add.
Using realm 'ManagementRealm' as discovered from the existing property files.
Username : centlinux
Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file.
 - The password should be different from the username
 - The password should not be one of the following restricted values {root, admin, administrator}
 - The password should contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s)
Password :
Re-enter Password :
What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[  ]:
About to add user 'centlinux' for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user 'centlinux' to file '/opt/wildfly-26.0.0.Final/standalone/configuration/mgmt-users.properties'
Added user 'centlinux' to file '/opt/wildfly-26.0.0.Final/domain/configuration/mgmt-users.properties'
Added user 'centlinux' with groups  to file '/opt/wildfly-26.0.0.Final/standalone/configuration/mgmt-groups.properties'
Added user 'centlinux' with groups  to file '/opt/wildfly-26.0.0.Final/domain/configuration/mgmt-groups.properties'
Is this new user going to be used for one AS process to connect to another AS process?
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server Jakarta Enterprise Beans calls.
yes/no? yes
To represent the user add the following to the server-identities definition <secret value="QWhtZXJAMTIzNA==" />

WildFly management console is by default configured on localhost (127.0.0.1) interface. Therefore, it is not accessible across the network.

You need to edit following configuration file to configure WildFly management console interface.

Use vim text editor to edit standalone.xml file.

# vi /opt/wildfly/standalone/configuration/standalone.xml

Locate following line in this file.

<socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>

Remove interface="management" then save and exit from vim text editor.

<socket-binding name="management-http" port="${jboss.management.http.port:9990}"/>

Restart WildFly service to apply changes.

# systemctl restart wildfly.service

Open http://wildfly-01.centlinux.com:8080 in a web browser.

WildFly Admin Console Login Page

Click on "Administration Console" and login as the admin user that you have created in previous steps.

WildFly Dashboard

After successful login, you have reached at the dashboard of WildFly Management Console.

 

Conclusion:

In this article, you have successfully installed WildFly on CentOS / Red Hat Enterprise Linux 8.

If you find this article useful? Consider supporting us by Buy Me A Coffee


© 2023 CentLinux. All Rights Reserved.