How to Install WildFly (JBoss) on CentOS 7

Published on

7 min read

Install WildFly (JBoss) on CentOS 7

WildFly , formerly known as JBoss is a cross-platform open-source application runtime written in Java that helps you build amazing applications. WildFly is flexible, lightweight, and it is based on pluggable subsystems that can be added or removed as needed.

This tutorial explains how to install WildFly application server on CentOS 7.


You’ll need to be logged in as a user with sudo access to be able to install packages on your CentOS system.

Step 1: Install Java OpenJDK

WildFly 9 requires Java SE 8 or later. In this tutorial we will install OpenJDK , the open-source implementation of the Java Platform which is the default Java development and runtime in CentOS 7.

Install the OpenJDK package by running:

sudo yum install java-1.8.0-openjdk-devel

Step 2: Create a User

Running WildFly as the root user is a security risk and not considered best practice.

To create a new system user and group named wildfly with home directory /opt/wildfly run:

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

Step 3: Install WildFly

At the time of writing, the latest version of WildFly is 16.0.0. Before continuing with the next step you should check the download page for a new version. If there is a new version replace the WILDFLY_VERSION variable in the command below.

Download the WildFly archive in the /tmp directory using the following wget command:

WILDFLY_VERSION=16.0.0.Finalwget$WILDFLY_VERSION/wildfly-$WILDFLY_VERSION.tar.gz -P /tmp

When the download is completed, unpack the tar.gz file and move it to the /opt directory:

sudo tar xf /tmp/wildfly-$WILDFLY_VERSION.tar.gz -C /opt/

Next, create a symbolic link wildfly that will point to the WildFly installation directory:

sudo ln -s /opt/wildfly-$WILDFLY_VERSION /opt/wildfly

WildFly will run under the wildfly user which needs to have access to the WildFly installation directory.

Change the directory ownership to user and group wildfly with the following chown command :

sudo chown -RH wildfly: /opt/wildfly

Step 4: Configure Systemd

The WildFly package includes files necessary to run WildFly as a service.

Start by creating a directory which will hold the WildFly configuration file:

sudo mkdir -p /etc/wildfly

Copy the configuration file to the /etc/wildfly directory:

sudo cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.conf /etc/wildfly/

This file allows you to specify the WildFly mode and bind address. By default, WildFly will run in a standalone mode and will listen on all interfaces. You can edit the file according to your needs.

# The configuration you want to run

# The mode you want to run

# The address to bind to

Next copy the WildFly script to the /opt/wildfly/bin/ directory:

sudo cp /opt/wildfly/docs/contrib/scripts/systemd/ /opt/wildfly/bin/

The scripts inside bin directory must have executable flag :

sudo sh -c 'chmod +x /opt/wildfly/bin/*.sh'

Copy the systemd unit file named to the /etc/systemd/system/ directory:

sudo cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.service /etc/systemd/system/

Notify systemd that we created a new unit file:

sudo systemctl daemon-reload

Start the WildFly service an enable it to be automatically started at boot time by running:

sudo systemctl start wildflysudo systemctl enable wildfly

Verify that the service is running:

sudo systemctl status wildfly
● wildfly.service - The WildFly Application Server
   Loaded: loaded (/etc/systemd/system/wildfly.service; disabled; vendor preset: disabled)
   Active: active (running) since Fri 2019-03-01 20:13:39 UTC; 3s ago
 Main PID: 3680 (
   CGroup: /system.slice/wildfly.service

Step 5: Adjust the Firewall

If your server is protected by a firewall and you want to access the WildFly instance from the outside of the local network you also need to open port 8080.

Use the following commands to open the necessary port:

sudo firewall-cmd --zone=public --permanent --add-port=8080/tcpsudo firewall-cmd --reload
When running a WildFly application in a production environment most likely you will have a load balancer or reverse proxy and it’s a best practice to restrict access to port 8080 only to your internal network.

Step 6: Configure WildFly Authentication

Now that WildFly is installed and running the next step is to create a user who will be able to connect using the administration console or remotely using the CLI.

To add a new user use the script that is located the WildFly’s bin directory:

sudo /opt/wildfly/bin/

You’ll be asked what type of user do you wish to add:

What type of user do you wish to add? 
 a) Management User ( 
 b) Application User (

Select a and hit Enter:

Next, the script will prompt you to enter the details of the new user:

Enter the details of the new user to add.
Using realm 'ManagementRealm' as discovered from the existing property files.
Username : linuxize
Password recommendations are listed below. To modify these restrictions edit the 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 'linuxize' for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user 'linuxize' to file '/opt/wildfly-16.0.0.Final/standalone/configuration/'
Added user 'linuxize' to file '/opt/wildfly-16.0.0.Final/domain/configuration/'
Added user 'linuxize' with groups  to file '/opt/wildfly-16.0.0.Final/standalone/configuration/'
Added user 'linuxize' with groups  to file '/opt/wildfly-16.0.0.Final/domain/configuration/'
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 EJB calls.
yes/no? yes
To represent the user add the following to the server-identities definition <secret value="UGFuMjNkZWo3NyNA" />

The new user will be added to the properties files used for authentication.

Step 6: Test the WildFly Installation

To access the default WildFly page, open your browser and type: http://<your_domain_or_IP_address>:8080

Assuming the installation is successful, a screen similar to the following will appear:


Step 7: Access WildFly Administration Console

Command-Line Interface

To access the WildFly Administration Console from the command line you can use the script.

Navigate to the WildFly’s bin directory and run the script with the --connect option:

cd /opt/wildfly/bin/./ --connect

You will be asked to enter your administrative username and password (created in step 6):

Authenticating against security realm: ManagementRealm
Username: linuxize

Once you login the console prompt will change to [standalone@localhost:9990 /]. Type help to get a list of commands and command syntax.

From here, you can deploy and undeploy your applications, manage users and groups and configure and monitor WildFly server.

Web Interface

If you prefer to manage your server from the GUI, WildFly also provides a web-based console.

By default, the WildFly administration console is available only from localhost at http://localhost:9990/console. Sign in using the user you have created in step 6.

WildFly Administration Console

If you want to access the console from remote locations you’ll need to make small modifications to the wildfly.service, wildfly.conf and files.

Open the wildfly.conf and append WILDFLY_CONSOLE_BIND= at the end of the file.

# The configuration you want to run

# The mode you want to run

# The address to bind to

# The address console to bind to

Open the and edit the highlighted lines:


if [ "x$WILDFLY_HOME" = "x" ]; then

if [[ "$1" == "domain" ]]; then
    $WILDFLY_HOME/bin/ -c $2 -b $3 -bmanagement $4
    $WILDFLY_HOME/bin/ -c $2 -b $3 -bmanagement $4

Restart the service for changes to take effect:

sudo systemctl restart wildfly

Open the wildfly.service and edit the highlighted lines:

Description=The WildFly Application Server



Create the /var/run/wildfly directory and set correct permissions:

sudo mkdir /var/run/wildfly/sudo chown wildfly: /var/run/wildfly/

Notify systemd that the unit file was changed:

sudo systemctl daemon-reload

Restart the WildFly service by executing:

sudo systemctl restart wildfly

Assuming that port 9990 is not blocked in your firewall, you should be able to access the WildFly administration console at http://<your_domain_or_IP_address>:9990/console.


You have successfully installed WildFly on your CentOS 7 system. You can now visit the official WildFly Documentation and learn more about the WildFly features.

If you hit a problem or have feedback, leave a comment below.