How to Install WildFly 14 on CentOS 7

How to Install WildFly 14 on CentOS 7

WildFly is a state-of-the-art Java web application server designed around speed and being lightweight. Formerly known as JBoss, WildFly is open-source and aims to provide the fastest Java runtime environment possible. With features such as subsystem blocks made to be easily added and removed, centralized configurations between environments, support for the latest Java enterprise standards, and much more, WildFly is an excellent choice for an application server.

In this tutorial, we will cover the full installation process for installing WildFly 14 onto your CentOS 7 machine. However, in order to complete this tutorial, your current setup has some requirements that need to be met. You must have a VPS or a machine running CentOS 7, a user with root access, and a static public IP address set up for your server.

Step 1: Installing Java

In order for WildFly to work, it needs the Java Developer Kit, or JDK. Install JDK version 10.0.2 (the latest version at the time of writing) onto your system by downloading the JDK to your server from Oracle’s site. Open a terminal on your CentOS VPS/machine and execute these two commands:

cd /opt
sudo wget --no-cookies --no-check-certificate --header "Cookie:; oraclelicense=accept-securebackup-cookie" ""

You then need to extract the downloaded tarball using the ‘tar’ command:

tar -zxvf jdk-10.0.2_linux-x64_bin.tar.gz

(You can now delete the downloaded tarball)

Once this has been downloaded and extracted onto your machine, we can use ‘alternatives’ to set up the JDK onto your system without interfering with already existing installs (if present). Use these commands to set up this new version of Java:

sudo alternatives --install /usr/bin/java java /opt/jdk-10.0.2/bin/java 2
sudo alternatives --config java

Once this is done, you can then set the ‘java’ and ‘javac’ locations using the ‘alternatives’ command.

sudo alternatives --install /usr/bin/jar jar /opt/jdk-10.0.2/bin/jar 2
sudo alternatives --install /usr/bin/javac javac /opt/jdk-10.0.2/bin/javac 2
sudo alternatives --set jar /opt/jdk-10.0.2/bin/jar
sudo alternatives --set javac /opt/jdk-10.0.2/bin/javac

Once done, you can now check what version of Java is currently active on your system:

sudo java --version

The output should look similar to this:

java 10.0.2 2018-07-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)

When this is completed, you will then need to set your environment variables to correspond with the locations of your Java executables. You will need to create new files using your favorite text editor.

The Bourne Again shell configuration file should be created at the location “/etc/profile.d/”, and should contain these contents:

if ! echo ${PATH} | grep -q /opt/jdk-10.0.2/bin ; then
   export PATH=/opt/jdk-10.0.2/bin:${PATH}
if ! echo ${PATH} | grep -q /opt/jdk-10.0.2/jre/bin ; then
   export PATH=/opt/jdk-10.0.2/jre/bin:${PATH}
export JAVA_HOME=/opt/jdk-10.0.2
export JRE_HOME=/opt/jdk-10.0.2/jre
export CLASSPATH=.:/opt/jdk-10.0.2/lib/tools.jar:/opt/jdk-10.0.2/jre/lib/rt.jar

Once you have entered and saved this in that new file, you can now create a configuration file for the C Shell. This file should be located and named as “/etc/profile.d/java.csh”. The file should contain these contents:

if ( "${path}" !~ */opt/jdk-10.0.2/bin* ) then
   set path = ( /opt/jdk-10.0.2/bin $path )
if ( "${path}" !~ */opt/jdk-10.0.2/jre/bin* ) then
    set path = ( /opt/jdk-10.0.2/jre/bin $path )
setenv JAVA_HOME /opt/jdk-10.0.2
setenv JRE_HOME /opt/jdk-10.0.2/jre
setenv CLASSPATH .:/opt/jdk-10.0.2/lib/tools.jar:/opt/jdk-10.0.2/jre/lib/rt.jar

You have now set the environment variables for Java. Make sure to change the file permissions to the correct values:

sudo chmod 755 /etc/profile.d/
sudo chmod 755 /etc/profile.d/java.csh

We can now continue with the installation of WildFly.

Step 2: Installing WildFly

The first step is downloading and extracting the WildFly software package from WildFly’s website – download the latest version (14.0.1 at the time of writing this tutorial) by using the following command:


Once the download is finished, you can then extract it by using the next command:

tar -zxvf wildfly-14.0.1.Final.tar.gz

(You can now delete the downloaded tarball)

You will now need to set two variables found in the standalone configuration file, found at the location “/opt/wildfly-14.0.1.Final/bin/standalone.conf”. The two variables set the location of WildFly, and your Java install location. Using your text editor of choice, add these next two lines to that file:


Once this is done, we can now edit the XML configuration file. This file is located at the filepath “/opt/wildfly-14.0.1.Final/standalone/configuration/standalone.xml”. Open it with your favorite text editor, and replace all instances of a localhost IP address (they need to be written as “”) with your server’s public IP address. This will allow us to access WildFly from an external network. Once done, we can now start the server and create our first user.

Starting WildFly is simple. Just run the executable:

sudo /opt/wildfly-14.0.1.Final/bin/

Now, while this executable will run the server just fine, it will also run inside of your terminal session, meaning that when your session ends, the server will close as well. You can run it in a screen as well by using the “screen” package, but you will still need to start it manually every time your server reboots. To get around this, we created a simple file that will allow you to register WildFly as a service. Just follow these next couple of steps, and you will be able to start and stop WildFly as a regular service, as well as have it run on server boot.

Create a new file at the location “/lib/systemd/system/” named ‘wildfly.service’. The full path should be “/lib/systemd/system/wildfly.service”. Enter the following text into it, and save it.

Description=WildFly Server


Now, all you need to do is reload the service list:

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer

Now just $43 .99

systemctl daemon-reload

And you can now start it as a regular service – just run it like any other service:

systemctl start wildfly.service

And if you wish to enable it so that it runs every time your machine or server boots, that can be done as well:

systemctl enable wildfly.service

Step 3: Creating a User

In order to use WildFly, you’ll need to create a user. This can be done by running the ‘add-user’ script found in “/opt/wildfly-14.0.1.Final/bin/” like so:

sudo /opt/wildfly-14.0.1.Final/bin/

Note: You will need to make sure that you create a Management user, as well as add this user to the group “ManagementRealm” in order for you to be able to log in.

The script will then guide you through creating a new user. Once the new user is created you can then log in and access WildFly through the web interface. To access your server, simply enter “your.public.ip.address:8080” or “your.public.ip.address:9990”. Make sure that ports 8080 and 9990 are both open since those ports are the ones that WildFly listens to. If necessary, you can edit your firewall rules using firewall-cmd or iptables to open these ports for use. Congratulations, you can now begin to use WildFly on your CentOS 7 machine.

install wildfly 14 on centos 7

installing wildfly 14 on centos 7Of course, you do not need to install WildFly 14 on your CentOS 7 VPS yourself if you have a CentOS VPS hosted with us, in which case you can simply ask our expert admins to install it for you. They are available 24/7 and will cater to any requests or questions that you may have.

P.S. If you liked this post, feel free to share it with your friends on social networks by using the share shortcuts, or simply leave a comment below. Thanks.

Leave a Comment