WildFly on CentOS 8: A No‑BS Guide to Get It Running
You’ll learn how to pull a fresh copy of WildFly, make sure Java is in place, spin it up as a proper system service, and tweak the basics so it starts right out of the box. No fluff, just the steps that actually work on CentOS 8.
Why run WildFly on CentOS
WildFly is a slick Java EE server that runs fast and uses little memory. If you’re deploying microservices or experimenting with Jakarta EE, running it on a clean CentOS 8 VM keeps dependencies tidy and lets you use systemd to keep the process alive.
Prerequisites & sanity check
- Make sure you’re logged in as root or a sudo‑enabled user.
- Update the system:
sudo dnf update -y – this ensures you have the latest patches and the java‑openjdk package is available.
- Verify that the machine has at least one CPU core, 2 GB RAM, and a network interface that can reach the internet.
Downloading WildFly
1. Grab the latest LTS release from Red Hat’s archive:
wget https://download.jboss.org/wildfly/26.0.0.Final/wildfly-26.0.0.Final.zip
2. Inspect the file size: ls -lh wildfly-*.zip. If it looks suspiciously small, something went wrong with the download.
(I’ve seen this happen when a proxy drops half the data – always double‑check the checksum.)
Installing Java
WildFly requires JDK 11 or newer. On CentOS 8 you can use the default OpenJDK:
sudo dnf install java-11-openjdk-devel -y
After installation, set the JAVA_HOME environment variable so WildFly knows where to find it:
echo "export JAVA_HOME=$(dirname $(readlink -f $(which javac)))" >> /etc/profile.d/java.sh source /etc/profile.d/java.sh
If you skip this step, WildFly will complain about a missing Java runtime and refuse to start.
Unpacking WildFly
Create an installation directory:
sudo mkdir /opt/wildfly sudo chown $(whoami):$(whoami) /opt/wildfly
Unzip the archive into that folder:
unzip wildfly-26.0.0.Final.zip -d /opt/wildfly mv /opt/wildfly/wildfly-26.0.0.Final/* /opt/wildfly/ rmdir /opt/wildfly/wildfly-26.0.0.Final
Now /opt/wildfly contains the full server.
Setting up a dedicated user
Running WildFly as root is a security no‑no. Create a wildfly system user and give it ownership of the installation directory:
sudo useradd -r -s /sbin/nologin wildfly sudo chown -R wildfly:wildfly /opt/wildfly
This isolates the server process from other services.
Configuring systemd
Create a unit file /etc/systemd/system/wildfly.service:
[Unit] Description=WildFly Application Server After=network.target [Service] Type=simple User=wildfly Group=wildfly Environment="JAVA_HOME=/usr/lib/jvm/java-11-openjdk" ExecStart=/opt/wildfly/bin/standalone.sh -b 0.0.0.0 SuccessExitStatus=143 Restart=on-failure [Install] WantedBy=multi-user.target
-b 0.0.0.0 tells WildFly to bind on all interfaces, which is handy if you’re accessing it from a VM or container host. SuccessExitStatus=143 keeps systemd happy when the process exits cleanly after a SIGTERM.
Reload systemd and enable the service:
sudo systemctl daemon-reload sudo systemctl enable --now wildfly
Check the status: systemctl status wildfly. You should see “Active: active (running)”.
Tweaking memory & ports
If you’re running this on a low‑end machine, edit /opt/wildfly/bin/standalone.conf:
export JAVA_OPTS="-Xms512m -Xmx1024m"
And if the default HTTP port 8080 clashes with another service, change the standalone.xml or pass -Djboss.http.port=9090.
Testing it works
Open a browser and hit:
http://<your-centos-ip>:8080/manager/html
You should see the WildFly management console. Log in with the default credentials (admin/admin) – you’ll want to change them ASAP.
That’s all there is to it. WildFly is now a proper system service, listening on port 8080, and ready for your deployments. If you hit any snags—like the server refusing to start because of an incorrect JAVA_HOME—double‑check the environment file or look at /var/log/messages for clues.