Cybersecurity Updates & Tools

Install WildFly on Ubuntu 18.04: Java App Server Setup Guide

Install WildFly on Ubuntu 18.04: Java App Server Setup Guide
WildFly (formerly JBoss) is an open-source, cross-platform Java application server developed by Red Hat. It is lightweight and modular, built around pluggable subsystems you can enable or remove depending on what your application needs. WildFly is a widely used platform for deploying Java EE and Jakarta EE applications in both development and production environments.

This guide shows you how to install WildFly on Ubuntu 18.04 step by step, covering Java setup, systemd integration, firewall configuration, admin user creation, and access via CLI and web console. The same steps apply to Ubuntu 16.04 and any Ubuntu-based distribution.

Prerequisite: You need sudo access.
Install WildFly on Ubuntu: Java, User, and Application Server Files<br>Install OpenJDK. WildFly requires Java to run. Install the default OpenJDK package:
bash
sudo apt update<br>sudo apt install default-jdk<br>Create a system user. WildFly should run as a dedicated, unprivileged account. The -s /sbin/nologin flag means this user cannot open an interactive shell, which limits the impact if the service is ever compromised:
bash
sudo groupadd -r wildfly<br>sudo useradd -r -g wildfly -d /opt/wildfly -s /sbin/nologin wildfly<br>Download and extract WildFly. Set the version variable and download the archive to /tmp:
bash
WILDFLY_VERSION=16.0.0.Final<br>wget https://download.jboss.org/wildfly/$WILDFLY_VERSION/wildfly-$WILDFLY_VERSION.tar.gz -P /tmp<br>Check the WildFly download page for a newer version and update WILDFLY_VERSION before continuing.

Extract the archive to /opt, create a symbolic link, and set ownership. The symlink makes upgrades easier — you only update the link instead of every path referencing the install directory:

bash
sudo tar xf /tmp/wildfly-$WILDFLY_VERSION.tar.gz -C /opt/<br>sudo ln -s /opt/wildfly-$WILDFLY_VERSION /opt/wildfly<br>sudo chown -RH wildfly: /opt/wildfly<br>Configure Systemd, Open the Firewall, and Set Up Authentication<br>WildFly ships with ready-made files to run it as a systemd service. Create the configuration directory and copy all required files:
bash
sudo mkdir -p /etc/wildfly<br>sudo cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.conf /etc/wildfly/<br>sudo cp /opt/wildfly/docs/contrib/scripts/systemd/launch.sh /opt/wildfly/bin/<br>sudo sh -c 'chmod +x /opt/wildfly/bin/*.sh'<br>sudo cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.service /etc/systemd/system/<br>wildfly.conf controls the startup mode and bind address. By default, WildFly runs in standalone mode and listens on all interfaces (0.0.0.0).

Reload systemd, start the service, and enable it to start automatically on boot:

bash

sudo systemctl daemon-reload<br>sudo systemctl start wildfly<br>sudo systemctl enable wildfly<br>Verify the service is running with sudo systemctl status wildfly. Look for Active: active (running) in the output.

Open the firewall. Allow traffic on port 8080 so clients can reach WildFly:

bash
sudo ufw allow 8080/tcp
<strong>Tip</strong>: In production, restrict port 8080 to your internal network or load balancer rather than leaving it open to all traffic.

Create an admin user. Run the add-user.sh script and select option a for a Management User when prompted:

bash
sudo /opt/wildfly/bin/add-user.sh<br>Enter a username and password. WildFly requires at least 8 characters including a letter, a digit, and a symbol. Save these credentials. You will need them to access the administration console.

Open http://your_domain_or_IP:8080 in a browser. The default WildFly welcome page confirms the installation is working.

Access WildFly via CLI and Web Administration Console
CLI access. Navigate to the WildFly bin directory and connect using jboss-cli.sh:

bash

cd /opt/wildfly/bin/<br>./jboss-cli.sh --connect<br>Enter the admin credentials you created earlier. Once connected, the prompt changes to [standalone@localhost:9990 /]. Type help to see commands for deploying applications, managing users, and monitoring the server.

Web console. The web administration console is available at http://localhost:9990/console. By default, it is bound to localhost only. To allow remote access, you need to update three files. Add WILDFLY_CONSOLE_BIND=0.0.0.0 to /etc/wildfly/wildfly.conf. Update launch.sh to pass -bmanagement $4 to the startup commands. Update the ExecStart line in wildfly.service to include $WILDFLY_CONSOLE_BIND as the fourth argument.

After editing those files, create the PID directory, reload systemd, and restart WildFly:

bash
sudo mkdir /var/run/wildfly/<br>sudo chown wildfly: /var/run/wildfly/<br>sudo systemctl daemon-reload<br>sudo systemctl restart wildfly<br>The administration console is now accessible at http://your_domain_or_IP:9990/console.

WildFly is now installed and running on your Ubuntu 18.04 server. Visit the WildFly documentation to explore deployment, clustering, and advanced configuration options. Leave a comment below if you run into any issues.