This guide will walk you through the installation of WildFly (JBoss) Server on Ubuntu 22.04|20.04|18.04. WildFly formerly known as JBoss is an application server written in Java and developed by Red Hat. WildFly Application Server is an exceptionally fast, lightweight and powerful implementation of the Java Enterprise Edition 8 Platform specifications.
As of this writing, WildFly 29 is the latest release in a series of JBoss open-source application server offerings. This article provides a quick overview on how to download and install WildFly latest available version on Ubuntu 22.04|20.04|18.04 for your application development.
Step 1: Install Java JDK on Ubuntu
WildFly is written in Java and it need to be installed as pre-requisite. There are two options of installing Java on Ubuntu Linux system.
- Install OpenJDK
- Install Java SE Development Kit
The simplest way of getting Java is installing OpenJDK on your Ubuntu system by running the commands below.
sudo apt update
sudo apt -y install default-jdk
The default Java version installed from above command is Java 10+. This is supported by WildFly.
$ java --version
openjdk 11.0.13 2021-10-19
OpenJDK Runtime Environment (build 11.0.13+8-Ubuntu-0ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.13+8-Ubuntu-0ubuntu1, mixed mode, sharing)
Step 2: Download WildFly Installation archive
Install curl and wget tools
sudo apt install curl wget
Check WildFly Downloads page for latest releases before downloading the file. Here we will download WildFly 29.x.
WILDFLY_RELEASE=$(curl -s https://api.github.com/repos/wildfly/wildfly/releases/latest|grep tag_name|cut -d '"' -f 4)
wget https://github.com/wildfly/wildfly/releases/download/${WILDFLY_RELEASE}/wildfly-${WILDFLY_RELEASE}.tar.gz
Once the file is downloaded, extract it.
tar xvf wildfly-${WILDFLY_RELEASE}.tar.gz
Move resulting folder to /opt/wildfly
.
sudo mv wildfly-${WILDFLY_RELEASE} /opt/wildfly
Step 3: Configure Systemd for WildFly
Let’s now create a system user and group that will run WildFly service.
sudo groupadd --system wildfly
sudo useradd -s /sbin/nologin --system -d /opt/wildfly -g wildfly wildfly
Create WildFly configurations directory.
sudo mkdir /etc/wildfly
Copy WildFly systemd service, configuration file and start scripts templates from the /opt/wildfly/docs/contrib/scripts/systemd/ directory.
sudo cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.conf /etc/wildfly/
sudo cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.service /etc/systemd/system/
sudo cp /opt/wildfly/docs/contrib/scripts/systemd/launch.sh /opt/wildfly/bin/
sudo chmod +x /opt/wildfly/bin/launch.sh
Set /opt/wildfly
permissions.
sudo chown -R wildfly:wildfly /opt/wildfly
Reload systemd service.
sudo systemctl daemon-reload
Start and enable WildFly service:
sudo systemctl start wildfly
sudo systemctl enable wildfly
Confirm WildFly Application Server status.
sudo systemctl status wildfly
Sample output:
Service should bind to port 8080
.
$ ss -tunelp | grep 8080
tcp LISTEN 0 128 0.0.0.0:8080 0.0.0.0:* users:(("java",pid=6854,fd=389)) uid:999 ino:30339 sk:3 <->
Step 4: Add WildFly Users
By default WildFly 16 is now distributed with security enabled for the management interfaces. We need to create a user who can access WildFly administration console or remotely use the CLI. A script is provided for managing users.
Run it by executing the command:
sudo /opt/wildfly/bin/add-user.sh
You will be asked to choose type of user to add. Since this the first user, we want to make it admin. So choose a.
What type of user do you wish to add?
a) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a): a
Provide desired username for the user.
Enter the details of the new user to add.
Using realm 'ManagementRealm' as discovered from the existing property files.
Username : neveropen
Set password for the user:
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 : <Enter Password>
Re-enter Password : <Confirm Password>
Press enter and agree to subsequent prompts to finish user creation.
What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[ ]: <Enter>
About to add user 'neveropen' for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user 'neveropen' to file '/opt/wildfly/standalone/configuration/mgmt-users.properties'
Added user 'neveropen' to file '/opt/wildfly/domain/configuration/mgmt-users.properties'
Added user 'neveropen' with groups to file '/opt/wildfly/standalone/configuration/mgmt-groups.properties'
Added user 'neveropen' 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? yes
To represent the user add the following to the server-identities definition
Notice that:
User information is kept on: /opt/wildfly/domain/configuration/mgmt-users.properties
Group information is kept on: /opt/wildfly/standalone/configuration/mgmt-groups.properties
Step 5: Accessing WildFly Admin Console
To be able to run WildFly scripts from you current shell session, add /opt/wildfly/bin/
to your $PATH.
cat >> ~/.bashrc <<EOF
export WildFly_BIN="/opt/wildfly/bin/"
export PATH=\$PATH:\$WildFly_BIN
EOF
Source the bashrc file.
source ~/.bashrc
Now test by connecting to WildFly Admin Console from CLI with jboss-cli.sh
command.
$ jboss-cli.sh --connect
Authenticating against security realm: ManagementRealm
Username: neveropen
Password:
[standalone@localhost:9990 /] version
JBoss Admin Command-line Interface
JBOSS_HOME: /opt/wildfly
Release: 29.0.1.Final
Product: WildFly Full 29.0.1.Final
JAVA_HOME: null
java.version: 11.0.13
java.vm.vendor: Ubuntu
java.vm.version: 11.0.13+8-Ubuntu-0ubuntu1
os.name: Linux
os.version: 5.13.0-19-generic
[standalone@localhost:9990 /] exit
Accessing WildFly Admin Console from Web Interface
By default, the console is accessible on localhost IP on port 9990.
$ ss -tunelp | grep 9990
tcp LISTEN 0 50 127.0.0.1:9990 0.0.0.0:* users:(("java",pid=6769,fd=404)) uid:999 ino:30407 sk:3 <->
We can start it on a different IP address accessible from outside the local server. Edit /opt/wildfly/bin/launch.sh
to look like this:
$ sudo vim /opt/wildfly/bin/launch.sh
#!/bin/bash
if [ "x$WILDFLY_HOME" = "x" ]; then
WILDFLY_HOME="/opt/wildfly"
fi
if [[ "$1" == "domain" ]]; then
$WILDFLY_HOME/bin/domain.sh -c $2 -b $3
else
$WILDFLY_HOME/bin/standalone.sh -c $2 -b $3 -bmanagement=0.0.0.0
fi
We added -bmanagement=0.0.0.0
to start script line. This binds “management” interface to all available IP addresses.
Restart wildfly service
sudo systemctl restart wildfly
Check service status to confirm it was successful
$ systemctl status wildfly
● wildfly.service - The WildFly Application Server
Loaded: loaded (/etc/systemd/system/wildfly.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2023-12-24 12:11:21 EAT; 6s ago
Main PID: 8205 (launch.sh)
Tasks: 70 (limit: 9482)
Memory: 159.8M
CPU: 12.265s
CGroup: /system.slice/wildfly.service
├─8205 /bin/bash /opt/wildfly/bin/launch.sh standalone standalone.xml 0.0.0.0
├─8206 /bin/sh /opt/wildfly/bin/standalone.sh -c standalone.xml -b 0.0.0.0 -bmanagement=0.0.0.0
└─8305 java -D[Standalone] -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava>
Des 24 12:11:22 ubuntu22 systemd[1]: Started The WildFly Application Server.
Confirm port 9990 is listening:
$ ss -tunelp | grep 9990
tcp LISTEN 0 50 0.0.0.0:9990 0.0.0.0:* users:(("java",pid=9496,fd=320)) uid:999 ino:73367 sk:c <->
Open your browser and URL http://serverip:9990
to access WildFly Web console.
Use username created earlier and password to authenticate. WildFly console will be the next window to show.
You have successfully installed WildFly Application server on Ubuntu 22.04|20.04|18.04. Visit WildFly Documentation page for further reading.