AlmaLinuxRHEL Based

How To Install WildFly on AlmaLinux 10

Install WildFly on AlmaLinux 10

Installing WildFly on AlmaLinux 10 provides enterprises with a robust, open-source Java application server solution. WildFly, formerly known as JBoss AS, delivers exceptional performance for enterprise Java applications while maintaining the stability and security characteristics of AlmaLinux 10’s enterprise-grade platform. This comprehensive guide walks through every step necessary to successfully deploy WildFly on AlmaLinux 10, from initial system preparation through complete configuration and optimization.

WildFly stands as one of the most popular Java application servers in enterprise environments, offering features like clustering, load balancing, and comprehensive management capabilities. AlmaLinux 10 serves as an ideal foundation for WildFly deployment, providing enterprise stability, security updates, and long-term support that mission-critical applications demand.

Prerequisites and System Requirements

Hardware Requirements

WildFly deployment on AlmaLinux 10 requires adequate system resources to ensure optimal performance. The minimum recommended hardware specifications include 2 GB of RAM, though production environments typically benefit from 4 GB or more. Processor requirements encompass a dual-core 2 GHz CPU as the baseline, with multi-core processors providing better performance for concurrent user loads.

Storage requirements vary based on application needs, but allocating at least 10 GB of free disk space accommodates the operating system, WildFly installation, application deployments, and log files. SSD storage significantly improves application startup times and overall responsiveness compared to traditional hard drives.

Software Prerequisites

AlmaLinux 10 server installation with administrative privileges forms the foundation for WildFly deployment. Root or sudo access enables package installation, service configuration, and system-level modifications required throughout the installation process. Active internet connectivity allows downloading WildFly packages, Java runtime environments, and security updates.

Basic Linux command-line proficiency helps administrators navigate the installation process effectively. Familiarity with text editors like nano or vim, file permissions, and service management concepts streamlines the configuration process.

Security Considerations

User permissions and security practices play crucial roles in WildFly deployment security. Creating dedicated service accounts prevents privilege escalation vulnerabilities while maintaining operational functionality. Firewall configuration requires careful planning to balance accessibility with security constraints.

SELinux compatibility considerations impact WildFly deployment on AlmaLinux 10. Understanding SELinux contexts, policies, and troubleshooting techniques prevents common deployment issues while maintaining system security standards.

Preparing the AlmaLinux 10 Environment

System Update

Maintaining current system packages ensures compatibility and security for WildFly installation. The DNF package manager provides comprehensive update capabilities for AlmaLinux 10 systems. Execute the following commands to update package repositories and install available updates:

sudo dnf update -y
sudo dnf upgrade -y

System updates include kernel patches, security fixes, and package compatibility improvements that support stable WildFly operation. Reboot the system after major updates to ensure all changes take effect properly.

Installing Java OpenJDK

WildFly requires Java Runtime Environment (JRE) or Java Development Kit (JDK) for operation. Java 21 OpenJDK represents the recommended choice for WildFly’s latest versions, providing long-term support and performance optimizations. Install Java OpenJDK using DNF package manager:

sudo dnf install java-21-openjdk java-21-openjdk-devel -y

Alternative Java versions including Java 11 and Java 17 also support WildFly operation, though Java 21 offers the most recent performance enhancements and security features. Verify Java installation success and version information:

java -version
javac -version

Configure the JAVA_HOME environment variable to ensure WildFly locates Java correctly:

echo 'export JAVA_HOME=/usr/lib/jvm/java-21-openjdk' >> ~/.bashrc
source ~/.bashrc

Creating Dedicated WildFly User

Security best practices recommend running WildFly under a dedicated system account rather than root privileges. Create a wildfly system user and group with restricted permissions:

sudo groupadd wildfly
sudo useradd -g wildfly -d /opt/wildfly -s /bin/false wildfly

This configuration creates a system account without login capabilities, reducing security risks while providing necessary file access permissions for WildFly operation.

Downloading and Installing WildFly

Obtaining WildFly

WildFly downloads are available from the official WildFly website, ensuring authenticity and compatibility with AlmaLinux 10. Navigate to the downloads directory and retrieve the latest stable version:

cd /tmp
wget https://github.com/wildfly/wildfly/releases/download/37.0.1.Final/wildfly-37.0.1.Final.tar.gz

Verification of download integrity protects against corrupted or tampered files. Download the corresponding SHA256 checksum file and verify the archive:

wget https://github.com/wildfly/wildfly/releases/download/37.0.1.Final/wildfly-37.0.1.Final.tar.gz.sha256
sha256sum -c wildfly-37.0.1.Final.tar.gz.sha256

WildFly versioning follows semantic versioning principles, with major.minor.patch format indicating compatibility and feature sets. Final releases provide production stability, while Beta and CR (Candidate Release) versions offer preview features for testing environments.

Installation Process

Extract WildFly archive to the /opt directory, which serves as the standard location for optional software packages in Linux systems. Create the installation directory and extract files:

sudo tar -xzf wildfly-37.0.1.Final.tar.gz -C /opt/
sudo ln -s /opt/wildfly-37.0.1.Final /opt/wildfly

Symbolic links facilitate version management by providing a consistent path (/opt/wildfly) regardless of the specific version installed. This approach simplifies configuration files and scripts that reference WildFly directories.

Set proper file ownership and permissions to ensure the wildfly user can access necessary files while maintaining security:

sudo chown -R wildfly:wildfly /opt/wildfly*
sudo chmod +x /opt/wildfly/bin/*.sh

Basic Directory Structure

WildFly’s directory structure organizes components logically for administration and deployment tasks. Key directories include:

  • /opt/wildfly/bin/ – Contains startup scripts, administrative tools, and utility programs
  • /opt/wildfly/standalone/ – Standalone server configuration, deployments, and data
  • /opt/wildfly/domain/ – Domain mode configuration for clustered deployments
  • /opt/wildfly/docs/ – Documentation, examples, and reference materials

Configuration files reside primarily in standalone/configuration/ for standalone deployments or domain/configuration/ for domain mode. Log files are located in standalone/log/ or domain/log/ directories respectively.

Configuring WildFly as a System Service

Creating Systemd Service Configuration

Systemd service configuration enables automatic WildFly startup, process monitoring, and lifecycle management. Create the WildFly configuration directory and copy default configuration:

sudo mkdir -p /etc/wildfly
sudo cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.conf /etc/wildfly/

Edit the configuration file to specify WildFly parameters:

sudo nano /etc/wildfly/wildfly.conf

Configure essential parameters including WILDFLY_MODE (standalone or domain), WILDFLY_CONFIG (configuration file), and WILDFLY_BIND (network binding address):

WILDFLY_MODE=standalone
WILDFLY_CONFIG=standalone.xml
WILDFLY_BIND=0.0.0.0
JAVA_HOME=/usr/lib/jvm/java-21-openjdk

The launch script requires copying and configuration to integrate properly with systemd:

sudo cp /opt/wildfly/docs/contrib/scripts/systemd/launch.sh /opt/wildfly/bin/
sudo chmod +x /opt/wildfly/bin/launch.sh

Systemd Service File Setup

Copy the systemd service unit file to enable service management through standard systemd commands:

sudo cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.service /etc/systemd/system/

Understanding service file parameters helps administrators customize WildFly startup behavior. Key parameters include ExecStart (startup command), User (execution user), and Environment (environment variables).

Create the PID file directory with appropriate permissions:

sudo mkdir -p /var/run/wildfly
sudo chown wildfly:wildfly /var/run/wildfly

Set executable permissions on service-related scripts:

sudo chmod +x /opt/wildfly/bin/standalone.sh
sudo chmod +x /opt/wildfly/bin/domain.sh

Service Management

Reload the systemd daemon to recognize the new service configuration:

sudo systemctl daemon-reload

Start WildFly service and enable automatic startup on system boot:

sudo systemctl start wildfly
sudo systemctl enable wildfly

Verify service status and troubleshoot potential startup issues:

sudo systemctl status wildfly

Monitor service logs for startup progress and error identification:

sudo journalctl -u wildfly -f

Common service issues include Java path problems, permission errors, and port conflicts. Log analysis typically reveals specific error conditions requiring resolution.

Security Configuration

SELinux Configuration

SELinux (Security-Enhanced Linux) provides mandatory access controls that may restrict WildFly operation without proper configuration. Understanding SELinux contexts ensures WildFly can access required files and network resources.

Set appropriate SELinux file contexts for WildFly directories:

sudo setsebool -P httpd_can_network_connect 1
sudo semanage fcontext -a -t bin_t "/opt/wildfly/bin(/.*)?"
sudo restorecon -R /opt/wildfly/bin/

Configure network permissions for WildFly ports:

sudo semanage port -a -t http_port_t -p tcp 8080
sudo semanage port -a -t http_port_t -p tcp 9990

SELinux troubleshooting involves examining audit logs and adjusting policies as needed. The sealert tool provides detailed analysis of SELinux denials and recommended solutions.

Firewall Configuration

Firewall configuration balances accessibility with security by opening only necessary ports. WildFly typically requires port 8080 for application access and port 9990 for management console access.

Open required ports using firewall-cmd:

sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --permanent --add-port=9990/tcp
sudo firewall-cmd --reload

Verify firewall rules and port accessibility:

sudo firewall-cmd --list-ports
sudo netstat -tulpn | grep java

Production environments should restrict management port access to specific IP addresses or subnets. Consider implementing VPN access or SSH tunneling for remote administration.

User Management and Security

Administrative user creation enables secure management console access without exposing system accounts. Use WildFly’s add-user.sh script to create management users:

sudo /opt/wildfly/bin/add-user.sh

Follow the interactive prompts to create administrative users with appropriate roles. Management realm security isolates administrative functions from application authentication mechanisms.

Production security best practices include disabling default users, implementing strong password policies, and configuring SSL/TLS encryption for management interfaces. Regular security audits identify potential vulnerabilities and configuration weaknesses.

WildFly Configuration and Management

Accessing WildFly Management Console

Management interface configuration determines console accessibility and security characteristics. Edit the standalone configuration file to configure management binding:

sudo nano /opt/wildfly/standalone/configuration/standalone.xml

Locate the management interface configuration and adjust binding addresses as needed:

<interface name="management">
    <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>

Access the web-based administration console through a web browser:

http://your-server-ip:9990/console

The management console provides comprehensive server monitoring, configuration management, deployment tools, and performance metrics. Remote management considerations include network security, authentication requirements, and SSL/TLS encryption.

Basic Configuration

Understanding standalone versus domain mode helps administrators choose appropriate deployment architectures. Standalone mode suits single-server deployments, while domain mode supports clustered environments with centralized management.

Configure server binding addresses to control network interface accessibility:

sudo nano /opt/wildfly/bin/standalone.conf

Add JVM arguments for memory allocation and performance tuning:

JAVA_OPTS="$JAVA_OPTS -Xms1024m -Xmx2048m -XX:MetaspaceSize=256m"

Memory and JVM tuning basics include heap size allocation, garbage collection optimization, and performance monitoring. Production environments require careful tuning based on application requirements and usage patterns.

Logging configuration controls log levels, output destinations, and rotation policies. Customize logging through the management console or configuration files to balance information needs with storage requirements.

Deployment Basics

WildFly supports multiple deployment methods accommodating different development and operational workflows. The deployment scanner automatically detects and deploys applications placed in the deployments directory:

sudo cp application.war /opt/wildfly/standalone/deployments/

Manual deployment through the management console provides granular control over deployment parameters and timing. Upload application archives through the web interface and manage deployment lifecycle states.

Command-line interface (CLI) deployment options enable scripted and automated deployment processes:

/opt/wildfly/bin/jboss-cli.sh --connect --command="deploy /path/to/application.war"

Testing and Verification

Service Verification

Confirm WildFly operates correctly by checking service status and port accessibility. Verify the WildFly service is running and listening on configured ports:

sudo systemctl is-active wildfly
sudo netstat -tulpn | grep :8080
sudo netstat -tulpn | grep :9990

Test default welcome page accessibility through web browser or command-line tools:

curl -I http://localhost:8080

Successful responses indicate proper service startup and network configuration. HTTP 200 status codes confirm WildFly is accepting connections and serving content.

Management console access verification ensures administrative functionality:

curl -I http://localhost:9990/console

Basic Application Deployment Test

Deploy a simple test application to verify deployment functionality and application serving capabilities. Create a basic HTML file for testing:

sudo mkdir -p /tmp/test-app/WEB-INF
echo '<html><body><h1>WildFly Test Application</h1></body></html>' | sudo tee /tmp/test-app/index.html

Create a web.xml descriptor:

sudo tee /tmp/test-app/WEB-INF/web.xml << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://java.sun.com/xml/ns/javaee">
    <display-name>Test Application</display-name>
</web-app>
EOF

Package and deploy the test application:

cd /tmp && sudo jar -cvf test-app.war -C test-app/ .
sudo cp test-app.war /opt/wildfly/standalone/deployments/

Verify deployment success through log files and application accessibility:

sudo tail -f /opt/wildfly/standalone/log/server.log
curl http://localhost:8080/test-app/

Troubleshooting Common Issues

Installation Issues

Java-related problems frequently occur during WildFly installation, particularly with incorrect JAVA_HOME configuration or incompatible Java versions. Verify Java installation and environment variables:

echo $JAVA_HOME
which java
java -version

Permission issues prevent WildFly from accessing configuration files, deployment directories, or log locations. Ensure proper file ownership and permissions:

sudo chown -R wildfly:wildfly /opt/wildfly
find /opt/wildfly -type f -name "*.sh" -exec chmod +x {} \;

Download and extraction problems may result from network interruptions, insufficient disk space, or corrupted archives. Verify file integrity using checksums and ensure adequate storage space.

Path and environment variable issues can prevent service startup or cause runtime errors. Double-check configuration files and environment variable assignments for accuracy.

Service and Runtime Issues

Service startup failures often stem from configuration errors, permission problems, or resource conflicts. Examine systemd logs for specific error messages:

sudo journalctl -u wildfly --no-pager -l

Port conflicts occur when other services occupy WildFly’s default ports (8080, 9990). Identify conflicting processes and adjust port configurations:

sudo netstat -tulpn | grep :8080
sudo lsof -i :9990

Memory issues manifest as OutOfMemoryError exceptions or poor performance. Adjust JVM heap size and monitoring memory usage:

sudo nano /opt/wildfly/bin/standalone.conf
# Add: JAVA_OPTS="$JAVA_OPTS -Xms2048m -Xmx4096m"

SELinux blocking issues prevent file access or network connections. Examine SELinux audit logs and adjust policies:

sudo ausearch -m avc -ts recent | grep wildfly

Network and Access Issues

Firewall blocking connections prevents external access to WildFly services. Verify firewall rules and port accessibility:

sudo firewall-cmd --list-all
telnet localhost 8080

Binding address problems restrict WildFly to localhost-only access when external connectivity is required. Modify binding configuration in standalone.xml or startup scripts:

-Djboss.bind.address=0.0.0.0

Management console access issues may result from authentication failures, network restrictions, or SSL configuration problems. Test console access from multiple network locations and verify user credentials.

Remote access troubleshooting involves network connectivity testing, DNS resolution verification, and security group configuration in cloud environments.

Performance Optimization and Best Practices

JVM Tuning

Memory allocation recommendations depend on application requirements, concurrent user loads, and available system resources. Production environments typically allocate 60-70% of available RAM to JVM heap space:

# For 8GB RAM system
JAVA_OPTS="$JAVA_OPTS -Xms4096m -Xmx5120m"

Garbage collection optimization reduces application pause times and improves response consistency. Configure appropriate garbage collection algorithms based on application characteristics:

JAVA_OPTS="$JAVA_OPTS -XX:+UseG1GC -XX:MaxGCPauseMillis=200"

JVM flags for production environments include memory management, garbage collection, and monitoring options:

JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/wildfly/logs/"

JVM performance monitoring tools like JConsole, VisualVM, or application performance management (APM) solutions provide insight into memory usage, thread activity, and garbage collection behavior.

Production Deployment Considerations

Security hardening checklists encompass multiple configuration areas including user accounts, network access, SSL/TLS encryption, and application isolation. Implement defense-in-depth strategies combining multiple security layers.

Monitoring and logging best practices include centralized log aggregation, performance metric collection, and alert configuration for critical events. Tools like ELK Stack (Elasticsearch, Logstash, Kibana) or Graylog provide comprehensive logging solutions.

Backup and maintenance procedures ensure data protection and system availability. Regular configuration backups, application deployment packages, and database snapshots facilitate disaster recovery.

Scaling considerations include horizontal scaling through clustering, vertical scaling through hardware upgrades, and load balancing for distribution of user requests across multiple servers.

Congratulations! You have successfully installed WildFly. Thanks for using this tutorial for installing WildFly open-source application server for Java Enterprise Edition (Java EE) on your AlmaLinux OS 10 system. For additional help or useful information, we recommend you check the official WildFly website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button