How to Install WildFly on Ubuntu 18.04

How to Install WildFly on Ubuntu 18.04

In this tutorial, we will install and configure the latest version of WildFly and all necessary components on an Ubuntu 18.04 VPS.

WildFly, formerly known as JBoss, is a free and open-source Java web application server designed around speed and being lightweight. WildFly aims to provide users with a fast and stable Java runtime environment.

WildFly comes with a lot of helpful features. Listed below are some of them:

  • Fast Speed
  • Easily Install WildFly on Ubuntu 18.04Ultimate Web Performance & Scalability
  • Slimable / Customizable Runtime
  • Unified configuration & Management
  • Domain & Standalone Management
  • Fast Linking & Concurrent Loading
  • Smarter Development

Prerequisites:

  • Ubuntu 18.04 VPS
  • A system user with root privileges, or access to the root user itself

Step 1: Log in and Update the System

Log in to your Ubuntu 18.04 VPS via SSH as the root user, or as a user with root privileges:

ssh root@IP_address -p Port_number

Remember to replace IP_address and Port_number with the actual IP address and SSH port number for your server.

and run the following commands to make sure that all installed packages on the server are updated to the latest available version

apt update && apt upgrade

You can also enable automatic updates as described in one of our previous blog posts https://www.rosehosting.com/blog/how-to-enable-automatic-updates-on-a-linux-vps/

Step 2: Install Java

In order to run WildFly on the server, we have to install Java. We will install and use OpenJDK, which is a free and open-source implementation of the Java Platform. To install it on your Ubuntu 18.04 server, just run the following command.

install -y default-jdk

Once all necessary packages are installed, you can then check the version of Java that’s installed on your server.

Java --version

The output should look something like this:

openjdk 10.0.2 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)

Step 3: Create a system user

It is not recommended to run WildFly as the root uset, so we’ll have to create a new system user. Execute the following commands to create a ‘wildfly’ system user and group:

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

Step 4: Download WildFly

Go to WildFly’s official website and download the latest stable release of the application to your server. At the moment of writing this tutorial it is version 16.0.0. We have included the link in our command below.

wget https://download.jboss.org/wildfly/16.0.0.Final/wildfly-16.0.0.Final.zip

Once the downloaded ZIP arhive is downloaded, unpack it by executing the following command.

unzip wildfly-16.0.0.Final.zip -d /opt

All of WildFly’s files and directories will be stored in a new ‘wildfly-16.0.0.Final’ directory. We will rename it simply to ‘wildfly’

mv wildfly-16.0.0.Final wildfly

Since we will run WildFly under the newly created ‘wildfly’ user, set the correct ownership to the WildFly files:

chown -R wildfly:wildfly /opt/wildfly

Step 5: Configure WildFly

Next, we will configure WildFly to run as a service. We will start by creating a ‘/etc/wildfly’ directory.

mkdir /etc/wildfly

WildFly comes with all of the necessary scripts and configuration files needed to run. Copy the configuration file to the newly created directory:

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

Then copy the launch.sh script and the systemd unit file to the appropriate directories, as shown below.

cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.service /etc/systemd/system/wildfly.service
cp /opt/wildfly/docs/contrib/scripts/systemd/launch.sh /opt/wildfly/bin/launch.sh

Enable and start the WildFly service:

systemctl enable wildfly
systemctl start wildfly

You can verify that WildFly is running on your server using the following command:

systemctl status wildfly

If everything is OK, you will get an output that looks similar to the following:

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
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS
wildfly.service - The WildFly Application Server
   Loaded: loaded (/etc/systemd/system/wildfly.service; enabled; vendor preset: enabled)
   Active: active (running)
 Main PID: 9294 (launch.sh)
    Tasks: 25 (limit: 2320)
   CGroup: /system.slice/wildfly.service
           ââ9294 /bin/bash /opt/wildfly/bin/launch.sh standalone standalone.xml 0.0.0.0
           ââ9295 /bin/sh /opt/wildfly/bin/standalone.sh -c standalone.xml -b 0.0.0.0
           ââ9388 java -D[Standalone] -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true --add-exports=java.base
systemd[1]: Started The WildFly Application Server.

At this point, you should be able to access your WildFly instance at http://IP_Address:8080 and you will get the default WildFly home page.

WildFly Installed on Ubuntu 18.04 VPS

Step 6: Configure Management Console and Create a User

In order to enable the administrative management console, we’ll have to create an administrative user for the WildFly instance. Wildfly has a script specifically made for this purpose. Run the script and follow the steps to complete the user creation.

/opt/wildfly/bin/add-user.sh

You can use the following settings:

What type of user do you wish to add?
 a) Management User (mgmt-users.properties)
 b) Application User (application-users.properties)
(a): a

Enter the details of the new user to add.
Using realm 'ManagementRealm' as discovered from the existing property files.
Username : rosehosting
Password recommendations are listed below. To modify 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 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 :
WFLYDM0098: The password should be different from the username
Are you sure you want to use the password entered yes/no? yes
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 'rosehosting' for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user 'rosehosting' to file '/opt/wildfly/standalone/configuration/mgmt-users.properties'
Added user 'rosehosting' to file '/opt/wildfly/domain/configuration/mgmt-users.properties'
Added user 'rosehosting' with groups  to file '/opt/wildfly/standalone/configuration/mgmt-groups.properties'
Added user 'rosehosting' with groups  to file '/opt/wildfly/domain/configuration/mgmt-groups.properties'
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? no

Now you will be able to log in to the administrative console as the user ‘rosehosting’ using the password you’ve set for this user. Feel free to set a different name for the user.

For more information on how to configure and use Wildfly, please check their official documentation.


Install WildFly Quickly on Your Ubuntu 18.04 VPSOf course, you don’t have to install WildFly on Ubuntu 18.04 if you use one of our Managed VPS Hosting services, in which case you can simply ask our expert Linux admins to install WildFly on Ubuntu 18.04 for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post on how to install WildFly on Ubuntu 18.04, please share it with your friends on the social networks using the share buttons below, or simply leave a comment in the comments section. Thanks.

Leave a Comment