Wildfly is a modular, lightweight, and highly-optimized application server for the building and deployment of Java applications. Previously known as JBoss, Wildfly is cross-platform and offers a user-friendly web-based interface that makes for an outstanding experience for configuring the app server and deploying your apps.
Within the Wildfly application server, you’ll find the following components:
- A JBDC Connection pool
- A messaging broker
- A resource adapter
- An EJB container
- A lightweight and fast web server, dubbed Undertow
- A batch job scheduler
- MicroProfile compatibility with version 4.1 of MicroProfile specifications
The Wildfly feature set includes:
- Supports the latest standard for REST-based data access
- ActiveMQ Artemis as its JMS Broker
- Offline CLI support for domain mode to launch a host controller locally
- Undertow JS project to help you write server-side scripts to pull in CDI beans and JPA Entity Beans
- HA Singleton deployments
- Pools stateless session beans by default
The installation of Wildfly is not easy. I’m going to walk you through this process, so pay close attention to the details. I’ll be demonstrating on my go-to server of choice, Ubuntu Server 20.04. To make this work, you’ll need a running instance of Ubuntu server and a user with
Ready? Let’s make this happen.
Install the Dependencies
There are only two dependencies you need to install. First is the Java Development Kit, which can be installed with the command:
sudo apt-get install default-jdk -y
That installation will take a bit of time. Once it completes, install unzip with:
sudo apt-get install unzip -y
That’s it for the dependencies (and the easy part).
Create a Wildfly User
Let’s create a new Wildfly user. We’ll add the user in such a way that it cannot actually log into the system (for security purposes). We’ll also create it such that its default home directory is /opt/wildfly. Before we add the user, we need to add a new group with the command:
sudo groupadd -r wildfly
Now, we can add the user with:
sudo useradd -m -g wildfly -d /opt/wildfly -s /sbin/nologin wildfly
Give the new home directory the proper permissions with:
sudo chown -RH wildfly: /opt/wildfly
Download and Install Wildfly
The latest release of Wildfly is currently 26.0.1. Make sure to visit the Wildfly site to get the latest version. Download the 26.0.1 version with the command:
Unzip the downloaded file with:
Change into the newly created directory with:
Move everything in this directory with the command:
sudo mv * /opt/wildfly
Create a new Wildfly configuration directory with:
sudo mkdir -p /etc/wildfly
Copy the necessary configuration file with:
sudo cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.conf /etc/wildfly/
Copy the launch script with:
sudo cp /opt/wildfly/docs/contrib/scripts/systemd/launch.sh /opt/wildfly/bin/
Make that script executable:
sudo sh -c 'chmod +x /opt/wildfly/bin/*.sh'
Copy the Wildfly systemd file:
sudo cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.service /etc/systemd/system
Finally, start and enable Wildfly with:
sudo sytemctl enable --now wildfly
Verify the service is running with:
sudo systemctl status wildfly
You should see active (running) listed in the output.
Now that you’re certain the service runs successfully, it’s time to configure the server. The first to do is add an admin user. Issue the command:
When prompted, type a for Management User. You’ll then be prompted to create a username and password. With that out of the way, we need to make sure the Wildfly console can be accessed outside of localhost. Open the configuration file with:
sudo nano /etc/wildfly/wildfly.conf
Append the following to the bottom of the file:
Save and close the file.
Next, open the launch script for editing with:
sudo nano /opt/wildfly/bin/launch.sh
At the end of the following lines, add -bmanagement $4:
$WILDFLY_HOME/bin/domain.sh -c $2 -b $3
$WILDFLY_HOME/bin/standalone.sh -c $2 -b $3
So, those lines will look like this:
$WILDFLY_HOME/bin/domain.sh -c $2 -b $3 -bmanagement $4
$WILDFLY_HOME/bin/standalone.sh -c $2 -b $3 -bmanagement $4
Save and close the file.
We now need to make sure the management console is started with
systemd. Open the Wildfly
systemd file for editing:
sudo nano /etc/systemd/system/wildfly.service
Locate the following line:
ExecStart=/opt/wildfly/bin/launch.sh $WILDFLY_MODE $WILDFLY_CONFIG $WILDFLY_BIND
Append $WILDFLY_CONSOLE_BIND to the end, so it looks like:
ExecStart=/opt/wildfly/bin/launch.sh $WILDFLY_MODE $WILDFLY_CONFIG $WILDFLY_BIND $WILDFLY_CONSOLE_BIND
Save and close the file.
Restart the Wildfly service with:
sudo systemctl restart wildfly
Access the Web UI
Open a web browser on your network and point it to http://SERVER:9990 (Where SERVER is the IP address or domain of the hosting server). You will be prompted for a username/password. Use the credentials you created during the installation and click Sign in. You should then find yourself on the Wildfly main window (Figure 1), where you can start building Java projects.
Congratulations, you have a brand new Java application server at your disposal. Next time, we’ll discuss how to deploy a Java application with Wildfly.