How To Install WildFly on Fedora 42
WildFly, formerly known as JBoss, stands as a powerful open-source application server designed specifically for building robust Java applications. Its lightweight architecture, cross-platform compatibility, and extensive feature set make it an excellent choice for enterprise-level deployments. In this comprehensive guide, we’ll walk through the complete process of installing and configuring WildFly on Fedora 42, from basic setup to advanced configuration options. By following these instructions, you’ll establish a stable Java runtime environment ready for deploying your applications.
Prerequisites for Installing WildFly
Before diving into the WildFly installation process, ensure your Fedora 42 system meets the necessary requirements. A successful installation depends on proper preparation.
System Requirements:
- Fedora 42 with updated packages
- Minimum 2GB RAM (4GB recommended for production environments)
- At least 1GB free disk space
- Root or sudo privileges for installation
- Basic familiarity with Linux command line operations
- Network connectivity for downloading packages
Required Access:
- Administrative privileges (root or sudo access)
- Firewall access to configure necessary ports (8080, 9990, and others)
You should also verify your network configuration allows proper connectivity both for downloading packages and for accessing WildFly services once installed.
Installing Java OpenJDK
WildFly is a Java-based application server, making Java installation the first critical step in our process. For optimal compatibility with WildFly on Fedora 42, OpenJDK 11 or later is recommended.
To install OpenJDK, execute the following command:
sudo dnf install java-11-openjdk-devel
After installation completes, verify your Java setup with:
java --version
You should see output similar to this:
openjdk 11.0.19 2023-04-18
OpenJDK Runtime Environment (build 11.0.19+8)
OpenJDK 64-Bit Server VM (build 11.0.19+8, mixed mode, sharing)
Setting up the JAVA_HOME environment variable helps ensure that WildFly can locate your Java installation correctly. Add the following lines to your ~/.bashrc
file:
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk
export PATH=$PATH:$JAVA_HOME/bin
Then apply these changes to your current session:
source ~/.bashrc
Verify the JAVA_HOME variable is set properly:
echo $JAVA_HOME
This confirmation ensures Java is correctly installed and configured for WildFly to utilize.
Downloading WildFly
With Java installed, the next step is obtaining the WildFly software package. Always download from official sources to ensure security and integrity.
First, visit the WildFly official website or GitHub releases page to identify the latest stable version. As of this writing, we’ll use WildFly 28.0.0.Final, but you should check for newer versions.
To download WildFly using the command line:
wget https://github.com/wildfly/wildfly/releases/download/35.0.1.Final/wildfly-35.0.1.Final.zip
Once downloaded, verify the file integrity using the checksum provided on the official download page:
sha1sum wildfly-35.0.1.Final.zip
Compare the output with the SHA1 checksum from the website to ensure file integrity. Next, extract the downloaded archive:
unzip wildfly-35.0.1.Final.zip
This extracts the WildFly files to a directory named after the version. For a cleaner installation structure, move the extracted directory to /opt:
sudo mv wildfly-35.0.1.Final /opt/wildfly
This central location provides a consistent reference point for configurations and helps with future maintenance.
Creating User and Group for WildFly
For enhanced security, it’s best practice to run WildFly under a dedicated system user with limited privileges rather than using root. This approach isolates the application server from other system processes and limits potential security vulnerabilities.
Create a dedicated user and group with the following commands:
sudo groupadd --system wildfly
sudo useradd -s /sbin/nologin --system -d /opt/wildfly -g wildfly wildfly
These commands create:
- A system group called “wildfly”
- A system user also called “wildfly”
- No login shell (for security)
- Home directory set to the WildFly installation path
Next, assign proper ownership to the WildFly installation directory:
sudo chown -R wildfly:wildfly /opt/wildfly
This ownership configuration ensures that the WildFly user has the necessary permissions to access and modify files within its installation directory while preventing unauthorized access.
Installing and Configuring WildFly
With the user created and files in place, we need to properly configure the WildFly environment and establish the necessary directory structure.
First, create configuration directories:
sudo mkdir -p /etc/wildfly
sudo mkdir -p /var/run/wildfly
Copy the default standalone configuration to the /etc directory for easier management:
sudo cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.conf /etc/wildfly/
Edit the configuration file to specify your preferred operation mode:
sudo nano /etc/wildfly/wildfly.conf
The default configuration typically contains:
# The configuration you want to run
WILDFLY_CONFIG=standalone.xml
# The mode you want to run
WILDFLY_MODE=standalone
# The address to bind to
WILDFLY_BIND=0.0.0.0
Next, create proper launch scripts by copying the provided templates:
sudo cp /opt/wildfly/docs/contrib/scripts/systemd/launch.sh /opt/wildfly/bin/
sudo cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.service /etc/systemd/system/
Make the launch script executable:
sudo chmod +x /opt/wildfly/bin/launch.sh
Set appropriate permissions for the runtime directory:
sudo chown -R wildfly:wildfly /var/run/wildfly
These configurations establish the foundation for running WildFly as a system service with proper security practices and organized file management.
Setting up WildFly as a Systemd Service
Running WildFly as a systemd service enables automatic startup on boot and provides easier management through standard systemd commands. This approach is preferred for production environments to ensure service reliability.
First, verify the systemd service file exists and has the correct paths:
sudo nano /etc/systemd/system/wildfly.service
The service file should contain configurations similar to this:
[Unit]
Description=The WildFly Application Server
After=syslog.target network.target
[Service]
User=wildfly
Group=wildfly
ExecStart=/opt/wildfly/bin/launch.sh $WILDFLY_MODE $WILDFLY_CONFIG $WILDFLY_BIND
EnvironmentFile=-/etc/wildfly/wildfly.conf
Type=simple
PIDFile=/var/run/wildfly/wildfly.pid
Restart=on-failure
RestartSec=60s
[Install]
WantedBy=multi-user.target
With the service file in place, reload the systemd daemon to recognize the new service:
sudo systemctl daemon-reload
Now start the WildFly service:
sudo systemctl start wildfly
Enable auto-start on boot:
sudo systemctl enable wildfly
Verify the service status to ensure proper operation:
sudo systemctl status wildfly
You should see active (running) status in the output. If you encounter any issues, check the service logs:
sudo journalctl -u wildfly
These logs provide detailed information about startup processes and any errors encountered, making them valuable for troubleshooting service configuration problems.
Creating an Administrator User
Securing access to your WildFly server requires creating an administrator user who can access the management interfaces. This step is crucial for maintaining secure administration practices.
WildFly provides a script to create users easily:
sudo /opt/wildfly/bin/add-user.sh
When running this script, you’ll follow an interactive process:
- Select ‘a’ for Management User when prompted for user type
- Enter a username (e.g., ‘admin’)
- Create a strong password following the security requirements
- Provide optional user details if prompted
- Review information and confirm creation
- Decide whether this user will be used for one server-to-server communication
For enhanced security, consider these password requirements:
- Minimum 8 characters
- Combination of uppercase and lowercase letters
- Include numbers and special characters
- Avoid dictionary words or common patterns
You can create additional administrator accounts with varied permissions according to your organizational needs and security policies.
Configuring WildFly for Remote Access
By default, WildFly only listens on localhost (127.0.0.1), which restricts access to the local machine. For production or development environments where remote access is needed, configuration changes are required.
First, modify the standalone configuration file:
sudo nano /opt/wildfly/standalone/configuration/standalone.xml
Look for the interfaces section and update the public interface binding:
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:0.0.0.0}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:0.0.0.0}"/>
</interface>
</interfaces>
Changing from “127.0.0.1” to “0.0.0.0” allows connections from any IP address. For production environments, consider restricting to specific IP ranges for better security.
Next, configure your firewall to allow traffic on the necessary ports:
sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --permanent --add-port=9990/tcp
sudo firewall-cmd --reload
These ports are essential for WildFly operations:
- 8080: Default HTTP port for deployed applications
- 9990: Management console interface
Restart WildFly to apply the configuration changes:
sudo systemctl restart wildfly
With these configurations, your WildFly server is now accessible from remote machines, allowing distributed development and administration while maintaining necessary security controls.
Accessing and Using the Admin Console
The WildFly admin console provides a web-based interface for managing your server configuration, deployments, and monitoring system health.
To access the console:
- Open a web browser
- Navigate to:
http://your-server-ip:9990
- Enter the administrator credentials created earlier
- You should now see the WildFly management dashboard
The dashboard provides access to key areas:
- Deployments: Manage application deployments
- Configuration: Server and subsystem settings
- Runtime: Monitor server health and performance
- Access Control: User and role management
From this interface, you can perform most administrative tasks without needing command-line access. The console is intuitively organized with a navigation tree on the left and detailed views on the right.
For enhanced security, consider:
- Setting session timeouts for inactive console sessions
- Using HTTPS for console access
- Implementing IP-based access restrictions
Familiarizing yourself with this interface significantly simplifies day-to-day WildFly administration tasks and provides valuable insight into server operations.
Deploying Applications to WildFly
After configuring WildFly, you’re ready to deploy Java applications. WildFly offers multiple deployment methods to suit different workflows and requirements.
Using the Admin Console:
- Log in to the admin console at
http://your-server-ip:9990
- Navigate to the Deployments section
- Click “Add” and select “Upload Deployment”
- Browse for your application file (.war, .ear, or .jar)
- Click “Next” and then “Finish” to complete the deployment
Using the Command Line Interface:
- Access the WildFly CLI:
/opt/wildfly/bin/jboss-cli.sh --connect
- Deploy your application:
deploy /path/to/your/application.war
Using the Deployment Scanner:
Simply copy your application file to the deployments directory:
cp your-application.war /opt/wildfly/standalone/deployments/
WildFly automatically detects and deploys the application.
To verify successful deployment, access your application through a web browser at:
http://your-server-ip:8080/your-application
For proper application lifecycle management, remember these commands:
- Undeploy: Remove the application from the server
- Redeploy: Update the application with a new version
- Disable: Temporarily stop the application without removing it
These options provide flexibility for managing application updates and maintenance.
Performance Tuning WildFly
To optimize WildFly performance on Fedora 42, several key configuration areas can be adjusted based on your specific usage patterns and hardware capabilities.
JVM Memory Settings:
Edit the standalone.conf file to adjust memory allocation:
sudo nano /opt/wildfly/bin/standalone.conf
Look for the JAVA_OPTS line and modify parameters:
JAVA_OPTS="-Xms1024m -Xmx2048m -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m"
These settings allocate:
- Initial heap: 1GB
- Maximum heap: 2GB
- Initial Metaspace: 256MB
- Maximum Metaspace: 512MB
Thread Pool Configuration:
Adjust thread pools in the standalone.xml file:
sudo nano /opt/wildfly/standalone/configuration/standalone.xml
Find the subsystem section for undertow and modify worker thread settings:
<subsystem xmlns="urn:jboss:domain:undertow:12.0">
<buffer-cache name="default"/>
<server name="default-server">
<http-listener name="default" socket-binding="http" max-post-size="10485760"/>
<https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<filter-ref name="server-header"/>
<filter-ref name="x-powered-by-header"/>
<http-invoker security-realm="ApplicationRealm"/>
</host>
</server>
<servlet-container name="default">
<jsp-config/>
<websockets/>
</servlet-container>
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
</handlers>
<filters>
<response-header name="server-header" header-name="Server" header-value="WildFly/26"/>
<response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="WildFly/26"/>
</filters>
</subsystem>
Database Connection Pooling:
For applications using databases, optimize connection pools in the datasources subsystem:
<subsystem xmlns="urn:jboss:domain:datasources:6.0">
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true" statistics-enabled="true">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>100</max-pool-size>
<prefill>true</prefill>
</pool>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
Remember to restart WildFly after making these changes:
sudo systemctl restart wildfly
Monitor performance using the admin console metrics and adjust settings based on observed patterns to achieve optimal performance for your specific applications.
Troubleshooting Common Issues
When installing or running WildFly on Fedora 42, you might encounter several common issues. Here’s how to identify and resolve them effectively.
Port Conflicts:
If WildFly fails to start due to port conflicts:
- Check if ports 8080 or 9990 are already in use:
sudo ss -tulpn | grep -E '8080|9990'
- Either stop the conflicting service or modify WildFly’s ports in standalone.xml:
<socket-binding name="http" port="${jboss.http.port:8081}"/> <socket-binding name="management-http" port="${jboss.management.http.port:9991}"/>
Permission Problems:
If you encounter permission errors:
- Verify ownership of WildFly directories:
sudo ls -la /opt/wildfly sudo ls -la /var/run/wildfly
- Correct with:
sudo chown -R wildfly:wildfly /opt/wildfly sudo chown -R wildfly:wildfly /var/run/wildfly
Service Start Failures:
For systemd service failures:
- Check detailed logs:
sudo journalctl -u wildfly -n 100
- Common issues include:
- Missing PID directory: Create /var/run/wildfly
- Incorrect file permissions: Check launch.sh is executable
- Java path issues: Verify JAVA_HOME in wildfly.conf
Memory-Related Issues:
If WildFly crashes with out-of-memory errors:
- Check system memory:
free -h
- Adjust JVM settings in standalone.conf to better match available resources
- Monitor memory usage with:
sudo systemctl status wildfly top -u wildfly
Network Access Problems:
If you can’t access WildFly remotely:
- Verify interface bindings in standalone.xml are set to 0.0.0.0 instead of 127.0.0.1
- Check firewall settings:
sudo firewall-cmd --list-all
- Test connectivity using:
curl -I http://localhost:8080
For persistent issues, consult the detailed logs in /opt/wildfly/standalone/log/server.log which often contain specific error messages that can guide troubleshooting efforts.
Congratulations! You have successfully installed WildFly. Thanks for using this tutorial for installing the WildFly on your Fedora 42 Linux system. For additional help or useful information, we recommend you check the official WildFly website.