Install WildFly / JBoss Application Server on CentOS 7 - CentLinux


Sunday, 19 May 2019

Install WildFly / JBoss Application Server on CentOS 7

Install WildFly / JBOSS Application Server on CentOS 7

WildFly, formerly known as JBoss AS (Application Server), is the free and open-source Java EE Application Server supported by JBoss community. Red Hat also developed a commercial version of WildFly, named as JBoss EAP (Enterprise Application Platform). JBoss EAP is also open-source, but Red Hat charges to provide a support subscription.

WildFly has full stack support for Java EE and it is a certified Java EE conatiner. Currently, an stable version 16 of WildFly is available. In this article, we will install WildFly / JBoss Application Server 16 on CentOS 7, Configure WildFly Administration Console for Remote Access and at the end Deploy a Java Application on WildFly Server.


This Article Provides:


    System Specification:

    We have a minimally installed CentOS 7 server with following specifications.

    • Hostname -
    • IP Address -
    • Operating System - CentOS 7.6
    • WildFly version - 16.0.0


    Installing OpenJDK 8 on CentOS 7:

    Connect with using ssh as root user.

    WildFly is a Java based application platform, therefore it requires a JDK (Java Development Kit) to be installed on the server.

    WildFly 16 requires Java EE 8 or above, therefore, we are installing OpenJDK 8 using yum command.

    [root@wildfly-01 ~]# yum install -y java-1.8.0-openjdk ... Installed: java-1.8.0-openjdk.x86_64 1: Dependency Installed: atk.x86_64 0:2.28.1-1.el7 avahi-libs.x86_64 0:0.6.31-19.el7 cairo.x86_64 0:1.15.12-3.el7 copy-jdk-configs.noarch 0:3.3-10.el7_5 cups-libs.x86_64 1:1.6.3-35.el7 dejavu-fonts-common.noarch 0:2.33-6.el7 dejavu-sans-fonts.noarch 0:2.33-6.el7 fontconfig.x86_64 0:2.13.0-4.3.el7 fontpackages-filesystem.noarch 0:1.44-8.el7 fribidi.x86_64 0:1.0.2-1.el7 gdk-pixbuf2.x86_64 0:2.36.12-3.el7 giflib.x86_64 0:4.1.6-9.el7 graphite2.x86_64 0:1.3.10-1.el7_3 gtk-update-icon-cache.x86_64 0:3.22.30-3.el7 gtk2.x86_64 0:2.24.31-1.el7 harfbuzz.x86_64 0:1.7.5-2.el7 hicolor-icon-theme.noarch 0:0.12-7.el7 jasper-libs.x86_64 0:1.900.1-33.el7 java-1.8.0-openjdk-headless.x86_64 1: javapackages-tools.noarch 0:3.4.1-11.el7 jbigkit-libs.x86_64 0:2.0-11.el7 libICE.x86_64 0:1.0.9-9.el7 libSM.x86_64 0:1.2.2-2.el7 libX11.x86_64 0:1.6.5-2.el7 libX11-common.noarch 0:1.6.5-2.el7 libXau.x86_64 0:1.0.8-2.1.el7 libXcomposite.x86_64 0:0.4.4-4.1.el7 libXcursor.x86_64 0:1.1.15-1.el7 libXdamage.x86_64 0:1.1.4-4.1.el7 libXext.x86_64 0:1.3.3-3.el7 libXfixes.x86_64 0:5.0.3-1.el7 libXft.x86_64 0:2.3.2-2.el7 libXi.x86_64 0:1.7.9-1.el7 libXinerama.x86_64 0:1.1.3-2.1.el7 libXrandr.x86_64 0:1.5.1-2.el7 libXrender.x86_64 0:0.9.10-1.el7 libXtst.x86_64 0:1.2.3-1.el7 libXxf86vm.x86_64 0:1.1.4-1.el7 libfontenc.x86_64 0:1.1.3-3.el7 libglvnd.x86_64 1:1.0.1-0.8.git5baa1e5.el7 libglvnd-egl.x86_64 1:1.0.1-0.8.git5baa1e5.el7 libglvnd-glx.x86_64 1:1.0.1-0.8.git5baa1e5.el7 libjpeg-turbo.x86_64 0:1.2.90-6.el7 libthai.x86_64 0:0.1.14-9.el7 libtiff.x86_64 0:4.0.3-27.el7_3 libwayland-client.x86_64 0:1.15.0-1.el7 libwayland-server.x86_64 0:1.15.0-1.el7 libxcb.x86_64 0:1.13-1.el7 libxshmfence.x86_64 0:1.2-1.el7 lksctp-tools.x86_64 0:1.0.17-2.el7 mesa-libEGL.x86_64 0:18.0.5-4.el7_6 mesa-libGL.x86_64 0:18.0.5-4.el7_6 mesa-libgbm.x86_64 0:18.0.5-4.el7_6 mesa-libglapi.x86_64 0:18.0.5-4.el7_6 pango.x86_64 0:1.42.4-2.el7_6 pcsc-lite-libs.x86_64 0:1.8.8-8.el7 pixman.x86_64 0:0.34.0-1.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:2019a-1.el7 xorg-x11-font-utils.x86_64 1:7.5-21.el7 xorg-x11-fonts-Type1.noarch 0:7.5-9.el7 Complete!

    Set Java related enironment variables.

    [root@wildfly-01 ~]# echo "export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk-" >> /etc/profile [root@wildfly-01 ~]# . /etc/profile [root@wildfly-01 ~]# env | grep JAVA_HOME JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk-

    Ensure Java installation by checking the version.

    [root@wildfly-01 ~]# java -version openjdk version "1.8.0_212" OpenJDK Runtime Environment (build 1.8.0_212-b04) OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)

    OpenJDK 8 has been installed on CentOS 7 server.


    Installing WildFly / JBoss AS on CentOS 7:

    Create a user to own WildFly software.

    [root@wildfly-01 ~]# useradd -r -d /opt/wildfly -s /sbin/nologin wildfly

    We have create a system user wildfly without login privileges and with a custom home directory.

    Latest or previous releases of WildFly are available on their website. We are downloading Java EE Full & Web Distribution (16.0.0.Final) in TGZ format.

    [root@wildfly-01 ~]# cd /tmp [root@wildfly-01 tmp]# curl -O % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 172M 100 172M 0 0 568k 0 0:05:10 0:05:10 --:--:-- 595k

    Extract TGZ file in /opt directory.

    [root@wildfly-01 tmp]# tar xf wildfly-16.0.0.Final.tar.gz -C /opt/

    Create a symbolic link /opt/wildfly for WildFly installation directory. You will find this symbolic link quiet useful, if you want to upgrade / downgrade WildFly to a different version.

    [root@wildfly-01 tmp]# ln -s /opt/wildfly-16.0.0.Final/ /opt/wildfly

    Change owner of the /opt/wildfly directory to wildfly user.

    [root@wildfly-01 tmp]# chown -RH wildfly:wildfly /opt/wildfly


    Create a Systemd service for WildFly:

    Create WildFly configurations in /etc directory.

    [root@wildfly-01 tmp]# mkdir /etc/wildfly [root@wildfly-01 tmp]# cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.conf /etc/wildfly/

    Check WildFly configurations.

    [root@wildfly-01 tmp]# cat /etc/wildfly/wildfly.conf # The configuration you want to run WILDFLY_CONFIG=standalone.xml # The mode you want to run WILDFLY_MODE=standalone # The address to bind to WILDFLY_BIND=

    By default, WildFly runs in Standalone mode with only required technologies. You can customize configurations according to your requirements. For more information please refer to WildFly 16 documentation.

    Copy the script in /opt/wildfly/bin directory. This file is required to start WildFly as a service.

    [root@wildfly-01 tmp]# cp /opt/wildfly/docs/contrib/scripts/systemd/ /opt/wildfly/bin/

    Copy WildFly service unit in Systemd configuration directory.

    [root@wildfly-01 tmp]# cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.service /usr/lib/systemd/system/

    Create the directory to hold PIDfile for WildFly service.

    [root@wildfly-01 tmp]# mkdir /var/run/wildfly/ [root@wildfly-01 tmp]# chown -R wildfly:wildfly /var/run/wildfly/

    Enable and start WildFly service.

    [root@wildfly-01 tmp]# systemctl enable wildfly.service Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/wildfly.service. [root@wildfly-01 tmp]# systemctl start wildfly.service


    Configure Linux Firewall for WildFly:

    Allow WildFly service port in Linux firewall.

    [root@wildfly-01 tmp]# firewall-cmd --permanent --add-port=8080/tcp success [root@wildfly-01 tmp]# firewall-cmd --reload success

    Browse URL in a client's browser.


    It shows that WildFly has been installed successfully on our CentOS 7 server and its service is running on designated port.


    Configure WildFly Administration Console for Remote Access:

    By default, WildFly Administration Console is running on localhost. If we want to access it across the network, then we have to configure it accordingly.

    To login to WildFly Administration console, we need an Admin user. Therefore, create an Admin user with following script.

    [root@wildfly-01 tmp]# /opt/wildfly/bin/ What type of user do you wish to add? a) Management User ( b) Application User ( (a): a Enter the details of the new user to add. Using realm 'ManagementRealm' as discovered from the existing property files. Username : ahmer 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 'ahmer' for realm 'ManagementRealm' Is this correct yes/no? yes Added user 'ahmer' to file '/opt/wildfly-16.0.0.Final/standalone/configuration/' Added user 'ahmer' to file '/opt/wildfly-16.0.0.Final/domain/configuration/' Added user 'ahmer' with groups to file '/opt/wildfly-16.0.0.Final/standalone/configuration/' Added user 'ahmer' 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="QWhtZXJAMTIzNA==" />

    Create a environment variable in /etc/wildfly/wildfly.conf.

    [root@wildfly-01 tmp]# cat >> /etc/wildfly/wildfly.conf << EOF > # the address to bind console to > WILDFLY_CONSOLE_BIND= > EOF

    Edit /opt/wildfly/bin/ script.

    [root@wildfly-01 tmp]# vi /opt/wildfly/bin/

    and update it as follows

    #!/bin/bash if [ "x$WILDFLY_HOME" = "x" ]; then WILDFLY_HOME="/opt/wildfly" fi if [[ "$1" == "domain" ]]; then $WILDFLY_HOME/bin/ -c $2 -b $3 -bmanagement $4 else $WILDFLY_HOME/bin/ -c $2 -b $3 -bmanagement $4 fi

    Save and exit.

    Finally edit WildFly service.

    [root@wildfly-01 tmp]# vi /usr/lib/systemd/system/wildfly.service

    and edit the settings as follows.

    [Unit] Description=The WildFly Application Server Before=httpd.service [Service] Environment=LAUNCH_JBOSS_IN_BACKGROUND=1 EnvironmentFile=-/etc/wildfly/wildfly.conf User=wildfly LimitNOFILE=102642 PIDFile=/var/run/wildfly/ ExecStart=/opt/wildfly/bin/ $WILDFLY_MODE $WILDFLY_CONFIG $WILDFLY_BIND $WILDFLY_CONSOLE_BIND StandardOutput=null [Install]

    Restart WildFly service.

    [root@wildfly-01 tmp]# systemctl daemon-reload [root@wildfly-01 tmp]# systemctl restart wildfly.service

    Allow service port of WildFly Administration Console in Linux firewall.

    [root@wildfly-01 tmp]# firewall-cmd --permanent --add-port=9990/tcp success [root@wildfly-01 tmp]# firewall-cmd --reload success

    Browse URL from a client's browser, to access WildFly Administration Console.


    Login using the admin user, that we have created above.


    We are now reached at the Dashboard of the WildFly Administration Console.


    Deploy a Java Application in WildFly Server:

    Download a Helloworld Java Application from GitHub.

    [root@wildfly-01 ~]# cd /opt/wildfly/standalone/deployments/ [root@wildfly-01 deployments]# curl -O % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 74333 100 74333 0 0 20801 0 0:00:03 0:00:03 --:--:-- 20798

    Check files in deployments directory..

    [root@wildfly-01 deployments]# ls helloworld.war helloworld.war.deployed README.txt

    If there is a file name *.deployed, it means that the Java application has been deployed successfully. Otherwise you may find *.failed file here.

    For more details you can check WildFly server logs.

    [root@wildfly-01 deployments]# tail /opt/wildfly/standalone/log/server.log | grep helloworld 2019-05-18 14:49:35,438 INFO [] (MSC service thread 1-1) WFLYSRV0027: Starting deployment of "helloworld.war" (runtime-name: "helloworld.war") 2019-05-18 14:49:38,831 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 77) WFLYUT0021: Registered web context: '/helloworld' for server 'default-server' 2019-05-18 14:49:39,016 INFO [] (DeploymentScanner-threads - 2) WFLYSRV0010: Deployed "helloworld.war" (runtime-name : "helloworld.war")

    Browse URL from a client's browser.


    Our HelloWorld Java application has been deployed on WildFly server.

    In this article, we have successfully installed WildFly / JBoss Application Server on CentOS 7, configured Administration Console and deployed a Java App on WildFly server. To start using WildFly you can either refer to WildFly 16 documentation or read WildFly Administration Guide by ItBuzzPress.


    1. when I apply the following command the following error appears
      line 75: /usr/lib/jvm/jre-1.8.0-openjdk- The file or directory

      1. Please verify that you have set JAVA_PATH variable correctly.

      2. I was getting the same error then i checked the installed Java version by using command "java -version" and found different version "1.8.0_181" than used in this tutorail.
        Then I checked the path of JAVA_PATH "/usr/lib/jvm/jre-1.8.0-openjdk-" and modified accordingly, and now its working fine.

    2. Dear Sir, is it possible to have multiple deployment folders in jboss. I have a requirement to run multiple projects in the same server. I should able to restart each deployments separately after modification without disturbing other war deployments.