How to install WildFly Server on an Ubuntu 18.04 VPS or Dedicated Server

Introduction

WildFly, formally known as JBoss, implements the Java Enterprise Edition (Java EE). It is one of the most common open source Java server applications. It offers you an administration dashboard to manage single or multiple domains efficiently. Some of the advantages provided by the server application include:

  • Lightweight in terms of memory resource usage
  • Compared to other Java Servers such as Tomcat, WildFly has the faster start up time.
  • It is easily scalable and offers a reliable connection to your applications

Before You Get Started You'll Need

  • A Dedicated Server or VPS running Ubuntu 18.04.
  • A non root user configured with granted sudo privileges.

Steps

Update your system packages

$ sudo apt update -y && sudo apt upgrade -y

Download and install Java

Since WildFly is developed in Java, you will need a Java Development Kit to run the app.

$ sudo apt install software-properties-common
$ sudo add-apt-repository ppa:linuxuprising/java
$ sudo apt update
$ sudo apt install oracle-java11-installer
$ java -versionopenjdk version "10.0.2"2018-11-07
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.3)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.3, mixed mode)

Install and Configure WildFly

$ wget http://download.jboss.org/wildfly/14.0.1.Final/wildfly-14.0.1.Final.tar.gz
$ sudo mkdir /opt/wildfly
$ sudo tar -xvzf wildfly-14.0.1.Final.tar.gz -C /opt/wildfly/

Now add a user that will authenticate to the administration dashboard. Make sure while adding the username and password, you have a strong password which you can store in a password vault of your choice.

$ cd /opt/wildfly/wildfly-14.0.1.Final/bin
$ ./add-user.shWhat type of user do you wish toadd? 
 a) ManagementUser (mgmt-users.properties) 
 b) Application User (application-users.properties)
(a): paulodera

 * Error * 
WFLYDM0039: Invalid response. (Valid responses are A, a, B, or b)


What typeofuserdo you wish toadd? 
 a) ManagementUser (mgmt-users.properties) 
 b) Application User (application-users.properties)
(a): 

Enter the details of the newuserto add.
Using realm 'ManagementRealm'as discovered from the existing property files.
Username : linuxuser
Password recommendations are listed below. Tomodify 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 followingrestrictedvalues {root, admin, administrator}
 - The password should contain atleast8characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s)
Password : 
Re-enter Password : 
What groupsdo you want this userto belong to? (Please enter a comma separated list, or leave blank fornone)[  ]: wildfly
About toadduser'linuxuser'for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user'linuxuser'tofile'/opt/wildfly/wildfly-14.0.1.Final/standalone/configuration/mgmt-users.properties'
Added user'linuxuser'tofile'/opt/wildfly/wildfly-14.0.1.Final/domain/configuration/mgmt-users.properties'
Added user'linuxuser'withgroups wildfly tofile'/opt/wildfly/wildfly-14.0.1.Final/standalone/configuration/mgmt-groups.properties'
Added user'linuxuser'withgroups wildfly tofile'/opt/wildfly/wildfly-14.0.1.Final/domain/configuration/mgmt-groups.properties'
Is this newuser going to be used for one AS process toconnectto another AS process? 
e.g. for a slave host controller connecting to the masterorfor a Remoting connectionforservertoserver EJB calls.
yes/no? Yes
To represent the useradd the followingto the server-identities definition <secret value="SnN2MCNYWV5yaQ==" />

Start the WildFly service by running the standalone.sh script in the /bin directory in the wildfly-14.0.1.Final directory.

$ sudo sh standalone.sh=====================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: /opt/wildfly/wildfly-14.0.1.Final

  JAVA: java

  JAVA_OPTS:  -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true 

=====================================================================...

By default, WildFly’s default IP address is set to localhost’s IP (127.0.0.1). You can edit this to your server’s IP to enable remote access to the dashboard.

In your/bin folder in the wildfly directory, edit the standalone.xml file.

$ sudo vim /opt/wildfly/standalone/configuration/standalone.xml<subsystem xmlns="urn:jboss:domain:webservices:2.0">
            <wsdl-host>${jboss.bind.address:192.168.56.20}</wsdl-host>
            <endpoint-config name="Standard-Endpoint-Config"/>
            <endpoint-config name="Recording-Endpoint-Config">
                <pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
                    <handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
                </pre-handler-chain>
            </endpoint-config>
            <client-config name="Standard-Client-Config"/>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:weld:4.0"/>
    </profile>
    <interfaces>
        <interface name="management">
            <inet-address value="${jboss.bind.address.management:192.168.56.20}"/>
        </interface>
        <interface name="public">
            <inet-address value="${jboss.bind.address:192.168.56.20}"/>
        </interface>
    </interfaces>

You should be able to access your console at http://YOUR_IP_ADDRESS:8080 while replacing YOUR_IP_ADDRESS with your OWN IP address.

How to install Wildfly Server on Ubuntu 18

Click on the the Administration Console and enter your credentials to log in. You should be able to see a screen similar to the one below.

How to install Wildfly Server on Ubuntu 18

Conclusion

You can now start exploring the rich features of WildFly or maybe begin a new project and start developing. You may also decide to manage different servers on one platform; the multiple servers is referred to as a domain. You can get to learn more about configuring the same in the official Wildfly documentation.

Check out these top 3 Java hosting services:

Was this article helpful?