How To Run Wildfly on CentOS 7
Enjoying this content? Subscribe to the Channel!
WildFly Installation Guide: Setting Up Your Java EE Application Server on CentOS 7
Hello, tech enthusiasts! Darren here from Darren’s Tech Tutorials.
WildFly (formerly known and loved as JBoss AS) is one of the most powerful and popular application servers written in Java, offering full implementation of the Java Platform, Enterprise Edition (Java EE) specifications. Whether you are deploying modern microservices or robust enterprise applications, WildFly is a fantastic choice.
In this comprehensive guide, we are going step-by-step through the process of installing and configuring WildFly on a CentOS 7 machine. This process is straightforward, but careful attention to configuration steps, especially regarding network access, is key!
Let’s dive in and get your new Java EE environment up and running!
Prerequisites and Preparation
Before we begin downloading WildFly, there are two crucial steps we must complete on your CentOS 7 server: ensuring you have Java installed and setting up a secure working directory.
Step 1: Installing OpenJDK
Since WildFly is a Java application server, we must first install the Java Development Kit (JDK). We recommend using OpenJDK.
Use the following yum command to install OpenJDK 8 (a widely compatible version):
sudo yum install java-1.8.0-openjdk-devel -y
Confirm the installation by checking the Java version:
java -version
Step 2: Downloading the WildFly Package
Next, we need to download the WildFly distribution file. We recommend creating a dedicated folder for your application server files, typically under /opt.
Navigate to the optimal directory and use wget to fetch the latest stable WildFly version (you may need to update the URL below to the absolute newest release):
cd /opt
sudo wget http://download.jboss.org/wildfly/[VERSION_NUMBER]/wildfly-[VERSION_NUMBER].tar.gz
(Note: Replace [VERSION_NUMBER] with the specific version you wish to download.)
Step 3: Extracting and Preparing WildFly
Once the download is complete, use the tar utility to extract the contents. This will unpack the server files into a new directory (e.g., /opt/wildfly-[VERSION_NUMBER]).
sudo tar xzf wildfly-[VERSION_NUMBER].tar.gz
For easier command-line use, let’s create a symbolic link named wildfly pointing to the extracted directory:
sudo ln -s wildfly-[VERSION_NUMBER] wildfly
Finally, set proper ownership for the extracted directory. It’s best practice to run application servers under a non-root user (e.g., a service account named wildfly):
sudo chown -R wildfly:wildfly /opt/wildfly
(You must create the wildfly user account beforehand if it doesn’t exist.)
Configuration for Network and Management
By default, WildFly only binds to the localhost IP (127.0.0.1). If you plan to access the server from another machine or deploy applications that need external access, we need to change this binding.
Step 4: Making WildFly Available from Any IP Address
To allow WildFly to listen on all available network interfaces (i.e., making it accessible from any external IP address), you must start the server with the host binding flag set to 0.0.0.0.
This is done when executing the startup script, as shown in Step 6.
Step 5: Adding a Management User
The WildFly Management Console (accessible via port 9990) requires a dedicated management user. Without this user, you cannot administer the server through the web interface.
Navigate into the WildFly bin directory and run the add-user.sh script:
cd /opt/wildfly/bin
./add-user.sh
Follow the prompts:
- Choose option
afor Management User (default). - Enter your desired username (e.g.,
admin). - Enter and confirm a strong password.
- Confirm that the user is intended for the administrative console.
Running and Verification
We are now ready to launch the WildFly server!
Step 6: Running WildFly on CentOS
Start the server using the standalone.sh script, ensuring you include the necessary binding argument (-b 0.0.0.0) to make it externally accessible, and the management interface binding (-bmanagement 0.0.0.0) for administrative access:
cd /opt/wildfly/bin
./standalone.sh -b 0.0.0.0 -bmanagement 0.0.0.0
(Note: If you plan to run WildFly as a persistent system service rather than a console process, you would configure a systemd unit file instead.)
If you are running a CentOS machine with an active firewall (firewalld), you will need to open the default ports used by WildFly before accessing them externally:
sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --permanent --add-port=9990/tcp
sudo firewall-cmd --reload
Step 7: Confirming WildFly is Running
With the server started, navigate to your server’s IP address in your web browser to confirm everything is working:
-
Welcome Page: Access the default application page on port 8080:
http://[YOUR_SERVER_IP]:8080 -
Management Console: Access the administrative interface on port 9990:
http://[YOUR_SERVER_IP]:9990You will be prompted to log in using the management user credentials you created in Step 5.
If you see the standard WildFly Welcome screen and can log into the Management Console, congratulations—your Java EE application server is fully installed and ready for deployment!
Conclusion and Next Steps
We successfully installed OpenJDK, downloaded and configured WildFly, set the necessary IP bindings, and secured the management interface on your CentOS 7 system. You now have a robust, enterprise-grade application server ready to handle whatever Java applications you throw at it!
If you found this guide helpful, be sure to check out the full command list and text tutorial here. Don’t forget to grab the Free Linux Cheat Sheet here for quick reference on other crucial Linux commands!
Ready to dive deeper into the Linux ecosystem? Make sure you Like this post, Subscribe to Darren’s Tech Tutorials for more clear and accessible guides, and let me know in the comments what you plan to deploy on your new WildFly server! Happy coding!