In this tutorial, our objective is to install WildFly on an unmanaged CentOS 7 server. WildFly is a managed application runtime server and Java software platform used to provision Java applications and services. It is an open-source software which is consistently being improved by its user community. While the WildFly software remains open-source, if paid support is needed, it is provided by Red Hat who currently develops the software (apart from the community forums). Some may be more familiar with WildFly's previous name, which was JBoss AS. RedHat continues to develop its version of this software under the JBoss EAP name.
Here is a summary of the prerequisites and environment that we will be using in this tutorial.
|Category||Requirements, Conventions or |
Software Version Used
|OS||CentOS 7 (Unmanaged)|
|User Type||Root/basic Linux user|
|Task Difficulty||Medium (A basic working knowledge |
of the command line is required)
|Other||The Latest version is 19.0.0. Beta3 but in this tutorial |
we will use 18.0.1 which is last stable version.
Our first step before doing any work on the server is to ensure we have the latest updates and software installed. To accomplish this, we will run the following commands.
root@host:~# yum check-update root@host:~# yum clean all root@host:~# yum update
OpenJDK (or the Open Java Development Kit) is a free and open-source implementation of the Java Platform, Standard Edition. It is one of the most popular open-source Java platforms used today. We will be installing OpenJDK prior to installing WildFly.
Initially, we need to log in to the server via SSH as the root user. The first command we will run will install the OpenJDK software. This installation will produce quite a bit of output, which we have concatenated for brevity.
root@host [~]# yum install java-1.8.0-openjdk-devel -y Installing : libxslt-1.1.28-5.el7.x86_64 1/17 Installing : python-lxml-3.2.1-4.el7.x86_64 2/17 Installing : python-javapackages-3.4.1-11.el7.noarch 3/17 Installing : javapackages-tools-3.4.1-11.el7.noarch 4/17 Installing : ttmkfdir-3.0.9-42.el7.x86_64 5/17 Installing : lksctp-tools-1.0.17-2.el7.x86_64 6/17 Installing : tzdata-java-2019c-1.el7.noarch 7/17 Installing : pcsc-lite-libs-1.8.8-8.el7.x86_64 8/17 Installing : libXtst-1.2.3-1.el7.x86_64 9/17 Installing : libfontenc-1.1.3-3.el7.x86_64 10/17 Installing : 1:xorg-x11-font-utils-7.5-21.el7.x86_64 11/17 Installing : xorg-x11-fonts-Type1-7.5-9.el7.noarch 12/17 Installing : copy-jdk-configs-3.3-10.el7_5.noarch 13/17 Installing : 1:java-1.8.0-openjdk-headless-22.214.171.124.b08-0.el7_7.x86_64 14/17 Installing : giflib-4.1.6-9.el7.x86_64 15/17 Installing : 1:java-1.8.0-openjdk-126.96.36.199.b08-0.el7_7.x86_64 16/17 Installing : 1:java-1.8.0-openjdk-devel-188.8.131.52.b08-0.el7_7.x86_64 17/17 Verifying : 1:xorg-x11-font-utils-7.5-21.el7.x86_64 1/17 Verifying : 1:java-1.8.0-openjdk-184.108.40.206.b08-0.el7_7.x86_64 2/17 Verifying : giflib-4.1.6-9.el7.x86_64 3/17 Verifying : xorg-x11-fonts-Type1-7.5-9.el7.noarch 4/17 Verifying : libxslt-1.1.28-5.el7.x86_64 5/17 Verifying : copy-jdk-configs-3.3-10.el7_5.noarch 6/17 Verifying : python-javapackages-3.4.1-11.el7.noarch 7/17 Verifying : 1:java-1.8.0-openjdk-headless-220.127.116.11.b08-0.el7_7.x86_64 8/17 Verifying : libfontenc-1.1.3-3.el7.x86_64 9/17 Verifying : 1:java-1.8.0-openjdk-devel-18.104.22.168.b08-0.el7_7.x86_64 10/17 Verifying : python-lxml-3.2.1-4.el7.x86_64 11/17 Verifying : libXtst-1.2.3-1.el7.x86_64 12/17 Verifying : pcsc-lite-libs-1.8.8-8.el7.x86_64 13/17 Verifying : javapackages-tools-3.4.1-11.el7.noarch 14/17 Verifying : tzdata-java-2019c-1.el7.noarch 15/17 Verifying : lksctp-tools-1.0.17-2.el7.x86_64 16/17 Verifying : ttmkfdir-3.0.9-42.el7.x86_64 17/17 ... Installed: java-1.8.0-openjdk-devel.x86_64 1:22.214.171.124.b08-0.el7_7 Dependency Installed: copy-jdk-configs.noarch 0:3.3-10.el7_5 giflib.x86_64 0:4.1.6-9.el7 java-1.8.0-openjdk.x86_64 1:126.96.36.199.b08-0.el7_7 java-1.8.0-openjdk-headless.x86_64 1:188.8.131.52.b08-0.el7_7 javapackages-tools.noarch 0:3.4.1-11.el7 libXtst.x86_64 0:1.2.3-1.el7 libfontenc.x86_64 0:1.1.3-3.el7 libxslt.x86_64 0:1.1.28-5.el7 lksctp-tools.x86_64 0:1.0.17-2.el7 pcsc-lite-libs.x86_64 0:1.8.8-8.el7 python-javapackages.noarch 0:3.4.1-11.el7 python-lxml.x86_64 0:3.2.1-4.el7 ttmkfdir.x86_64 0:3.0.9-42.el7 tzdata-java.noarch 0:2019c-1.el7 xorg-x11-font-utils.x86_64 1:7.5-21.el7 xorg-x11-fonts-Type1.noarch 0:7.5-9.el7 Complete!
Now that we have JDK installed, let’s move on to the installation of WildFly
As a side note, we should never run WildFly as the root user due to the security risks it poses. Because of this, we will create a new system user and group. To start this next step, we will run the groupadd command to create the “wildfly” user group.
root@host [~]# groupadd -r wildfly
Now, we can add the wildfly user with the useradd command.
root@host [~]# useradd -r -g wildfly -d /opt/wildfly -s /sbin/nologin wildfly
Now that we have created the user and group, we can proceed to installation itself. We will change directories to move to our /tmp directory and then download the latest stable version of WildFly.
root@host [~]# cd /tmp && wget https://download.jboss.org/wildfly/18.0.0.Final/wildfly-18.0.0.Final.tar.gz
When download completes, we need to unpack the archive that we downloaded. We will use the following command to accomplish this.
root@host [~]# tar -xf wildfly-18.0.0.Final.tar.gz -C /opt
This command unpacks our archive, and moved it to the /opt directory. Now we need to create a symbolic link to WildFly that will point to the WildFly installation directory. We will use the following command for this task.
root@host [~]# ln -s /opt/wildfly-18.0.0. /opt/wildfly
Now, WildFly will run under the WildFly user and thus, have access to the installation directory.
In the last step of the installation, we will change the ownership of the installation directory to WildFly user with the following command
root@host [~]# chown -RH wildfly: /opt/wildfly-18.0.0.Final/
That completes the installation process. We will now move on to configuring the Wildfly service.
First, we need to create the directory for the WildFly configuration file.
root@host [~]# mkdir -p /etc/wildfly
Copy the configuration file to new directory:
cp /opt/wildfly-18.0.0.Final/docs/contrib/scripts/systemd/wildfly.conf /etc/wildfly/
This is how default configuration file will look.
# The configuration you want to run<br>WILDFLY_CONFIG=standalone.xml # The mode you want to run<br>WILDFLY_MODE=standalone # The address to bind to<br>WILDFLY_BIND=0.0.0.0
This means that WildFly will run in standalone mode. This can be adjusted according to the needs of the user. In this tutorial we will use it as it is and that means it will listen on all interfaces.
Next step is to copy the WildFly launch.sh script to the binary directory.
cp /opt/wildfly-18.0.0.Final/docs/contrib/scripts/systemd/launch.sh /opt/wildfly-18.0.0.Final/bin/
Once the script is inside binary directory, we need to set it to be executable. We will use the chmod command for this task.
sh -c 'chmod +x /opt/wildfly-18.0.0.Final/bin/*.sh'
Next, we need to copy the systemd unit service file now to /etc/systemd/system/.
cp /opt/wildfly-18.0.0.Final/docs/contrib/scripts/systemd/wildfly.service /etc/systemd/system/
In the next several commands, we will tell systemd that a new service unit file is in place. After this, we will start the WildFly service, and then we will ensure the service is up and running.
systemctl daemon-reload systemctl start wildfly systemctl enable wildfly Created symlink from /etc/systemd/system/multi-user.target.wants/wildfly.service to /etc/systemd/system/wildfly.service.
The output of the Wildfly status command will look like this.
systemctl status wildfly ● wildfly.service - The WildFly Application Server Loaded: loaded (/etc/systemd/system/wildfly.service; enabled; vendor preset: disabled) Active: active (running) since Sat 2020-03-14 12:10:27 EDT; 6s ago Main PID: 2562 (launch.sh) CGroup: /system.slice/wildfly.service ├─2562 /bin/bash /opt/wildfly-18.0.0.Final/bin/launch.sh standalone standalone.xml 184.108.40.206 ├─2564 /bin/sh /opt/wildfly-18.0.0.Final/bin/standalone.sh -c standalone.xml -b 220.127.116.11 └─2621 java -D[Standalone] -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djbo... Mar 14 12:10:27 doh.trainingtest.tk systemd: Started The WildFly Application Server.
With this completed, we have confirmed that WildFly is up and running.
Now, to run WildFly, we need to make sure port 8080 is open in our firewall. This can be accomplished using the following command.
firewall-cmd --zone=public --permanent --add-port=8080/tcp
Next, we need to reload the firewall.
To login to Wildfly, we need to complete one last step which is creation of the Wildfly dashboard user. We will use the built-in add-user.sh script for this task. The script is located within the binary directory of WildFly.
When we run this script, it will ask us the following question:
- What type of user do you wish to add?
- a - Management User (mgmt-users.properties)
- b - Application User (application-users.properties)
Here, we will select the “a” option and then, the script will ask us for some basic user info. Finally, we will select our username, password and then press enter to use the defaults on the rest of the questions unless we need modify a specific setting.
That's it regarding the software installation! We can now type in the IP address of our site/server with port 8080. For example, 111.222.333.444:8080, and we will see the Wildfly welcome screen.
We are now ready to use WildFly on our server. Enjoy!
Get Started Today!
Are you a Java developer seeking to launch a new platform in which you can run your web apps? If so, reach out to us today to find out how we can fulfill all of your server needs. Give us a call at 800.580.4985, or open a chat or ticket with us to speak with one of our knowledgeable Solutions Team or an experienced Hosting Advisors today!
Our Sales and Support teams are available 24 hours by phone or e-mail to assist.