Saturday, January 4, 2025
Google search engine
HomeGuest BlogsHow To Install WildFly (JBoss) on Debian 12 (Bookworm)

How To Install WildFly (JBoss) on Debian 12 (Bookworm)

WildFly, formerly referred to as JBoss, is an open source application server written by JBoss majorly in Java. The company behinds its development is Red Hat. WildFly implements both the Java Platform, and Enterprise Edition specification. It can run on multiple platforms including Linux, Windows and macOS.

If you need a hardened enterprise-grade WildFly build then consider JBoss Enterprise Application Platform. With JBoss EAP subscription you can enjoy Red Hat’s world-class support, long multi-year maintenance cycles, and exclusive content. You can Sign-up with Red Hat to download a no-cost 1-year development license.

In this article we shall put our focus on the installation, configuration and basic usage of WildFly (JBoss) on Debian 12 (Bookworm). As of this article writing the latest stable release of Debian is version 12, with codename Bookworm.

Step 1: Install Java Development Kit(JDK)

The Java Development Kit implements the Java Language Specification and the Java Virtual Machine Specification and provides the Standard Edition of the Java Application Programming Interface. This is a major dependency in running WildFly applications.

We can choose to install;

  • Install OpenJDK, or
  • Install Java SE Development Kit

The simplest way of getting Java is installing OpenJDK on your Debian system by running the commands below.

sudo apt update
sudo apt -y install default-jdk

Currently WildFly supports both Java 17 and Java 11. You can confirm the version installed on your system.

$ java --version
openjdk 17.0.7 2023-04-18
OpenJDK Runtime Environment (build 17.0.7+7-Debian-1deb12u1)
OpenJDK 64-Bit Server VM (build 17.0.7+7-Debian-1deb12u1, mixed mode, sharing)

Step 2: Download WildFly tarball

Next we download the archived distribution of WildFly for installation on your Debian system. if wget is not present on your system it can be installed by running the following commands in your terminal.

sudo apt install curl wget

The latest releases of the software are available in WildFly Downloads page. The commands provides enables you to pull the latest release.

WILDFLY_RELEASE=$(curl -s https://api.github.com/repos/wildfly/wildfly/releases/latest|grep tag_name|cut -d '"' -f 4)
wget https://github.com/wildfly/wildfly/releases/download/${WILDFLY_RELEASE}/wildfly-${WILDFLY_RELEASE}.tar.gz

After download extract the archive file.

tar xvf wildfly-${WILDFLY_RELEASE}.tar.gz

We should move created folder of WildFly into the /opt directory.

sudo mv wildfly-${WILDFLY_RELEASE} /opt/wildfly

Step 3: Configure WildFly Systemd Unit

For ease of service management we’re creating system unit file. Begin by adding the system user wildfly:

sudo groupadd --system wildfly
sudo useradd -s /sbin/nologin --system -d /opt/wildfly  -g wildfly wildfly

The we create WildFly configurations directory.

sudo mkdir /etc/wildfly

Copy WildFly systemd service, configuration file and start scripts templates from the /opt/wildfly/docs/contrib/scripts/systemd/ directory.

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

Set /opt/wildfly permissions with the following commands.

sudo chown -R wildfly:wildfly /opt/wildfly

Reload systemd services before starting wildfly.

sudo systemctl daemon-reload

Start and enable WildFly service:

sudo systemctl start wildfly
sudo systemctl enable wildfly

Confirm WildFly Application Server status.

$ systemctl status wildfly
 wildfly.service - The WildFly Application Server
     Loaded: loaded (/etc/systemd/system/wildfly.service; enabled; preset: enabled)
     Active: active (running) since Fri 2023-06-30 21:26:57 UTC; 18s ago
   Main PID: 3124 (launch.sh)
      Tasks: 126 (limit: 4532)
     Memory: 267.6M
        CPU: 14.457s
     CGroup: /system.slice/wildfly.service
             ├─3124 /bin/bash /opt/wildfly/bin/launch.sh standalone standalone.xml 0.0.0.0
             ├─3126 /bin/sh /opt/wildfly/bin/standalone.sh -c standalone.xml -b 0.0.0.0
             └─3252 java "-D[Standalone]" -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.h>

Jun 30 21:26:57 deb12 systemd[1]: Started wildfly.service - The WildFly Application Server.

WildFly service is listening on port 8080.

$ ss -tunelp | grep 8080
tcp   LISTEN 0      4096         0.0.0.0:8080      0.0.0.0:*    users:(("java",pid=3252,fd=488)) uid:999 ino:20878 sk:2 cgroup:/system.slice/wildfly.service <->

Step 4: Creating WildFly Users

WildFly ships with security enabled for the management interfaces. We need to create a user who can access WildFly administration console or remotely use the CLI. A script is provided for managing users. To create first user run the following commands:

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

You will be asked to choose type of user to add. Since this the first user, we want to make it admin. So choose a.

What type of user do you wish to add? 
  a) Management User (mgmt-users.properties) 
  b) Application User (application-users.properties)
 (a):  a

Input the name of the user to be created.

Enter the details of the new user to add.
 Using realm 'ManagementRealm' as discovered from the existing property files.
 Username : neveropen

Provide secure password for this user. See provided guidance on password policy.

Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file.
The password should be different from the username
The password should not be one of the following restricted values {root, admin, administrator}
The password should contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s)
Password : <Enter Password>
Re-enter Password :  <Confirm Password>

Press enter and agree to subsequent prompts to finish user creation.

What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[  ]: <Enter>
 About to add user 'neveropen' for realm 'ManagementRealm'
 Is this correct yes/no? yes
 Added user 'neveropen' to file '/opt/wildfly/standalone/configuration/mgmt-users.properties'
 Added user 'neveropen' to file '/opt/wildfly/domain/configuration/mgmt-users.properties'
 Added user 'neveropen' with groups  to file '/opt/wildfly/standalone/configuration/mgmt-groups.properties'
 Added user 'neveropen' with groups  to file '/opt/wildfly/domain/configuration/mgmt-groups.properties'
 Is this new user going to be used for one AS process to connect to another AS process? 
 e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls.
 yes/no? yes
 To represent the user add the following to the server-identities definition 

Notice that:

User information is kept on: /opt/wildfly/domain/configuration/mgmt-users.properties
Group information is kept on: /opt/wildfly/standalone/configuration/mgmt-groups.properties

Step 5: Accessing WildFly administration console

To be able to run WildFly scripts from you current shell session, add /opt/wildfly/bin/ to your $PATH.

cat >> ~/.bashrc <<EOF
export WildFly_BIN="/opt/wildfly/bin/"
export PATH=\$PATH:\$WildFly_BIN
EOF

Source the bashrc file.

source ~/.bashrc

Validate your connection to WildFly Admin Console from CLI with jboss-cli.sh command.

$ jboss-cli.sh --connect
Authenticating against security realm: ManagementRealm
Username: neveropen
Password:
[standalone@localhost:9990 /] version
JBoss Admin Command-line Interface
JBOSS_HOME: /opt/wildfly
Release: 20.0.2.Final
Product: WildFly Full 28.0.1.Final
JAVA_HOME: null
java.version: 17.0.7
java.vm.vendor: Debian
java.vm.version: 17.0.7+7-Debian-1deb12u1
os.name: Linux
os.version: 6.1.0-9-amd64
[standalone@localhost:9990 /] exit

Accessing WildFly Admin Console from Web Interface

By default, the console is accessible on localhost IP on port 9990.

$ ss -tunelp | grep 9990
tcp    LISTEN   0    50    127.0.0.1:9990  0.0.0.0:* users:(("java",pid=6769,fd=404)) uid:999 ino:30407 sk:3 <-> 

We can start it on a different IP address accessible from outside the local server. Edit /opt/wildfly/bin/launch.sh to look like this:

$ sudo vim /opt/wildfly/bin/launch.sh
#!/bin/bash

if [ "x$WILDFLY_HOME" = "x" ]; then
    WILDFLY_HOME="/opt/wildfly"
fi

if [[ "$1" == "domain" ]]; then
    $WILDFLY_HOME/bin/domain.sh -c $2 -b $3
else
    $WILDFLY_HOME/bin/standalone.sh -c $2 -b $3 -bmanagement=0.0.0.0
fi

We added -bmanagement=0.0.0.0 to start script line. This binds “management” interface to all available IP addresses.

Restart wildfly service

sudo systemctl restart wildfly

Check service status to confirm it was successful

systemctl status  wildfly

Confirm port 9990 is listening:

$ ss -tunelp | grep 9990
tcp    LISTEN   0  50     0.0.0.0:9990  0.0.0.0:*  users:(("java",pid=3252,fd=482)) uid:999 ino:20877 sk:5 cgroup:/system.slice/wildfly.service <->

Open your browser and URL http://serverip:9990 to access WildFly Web console.

wildfly console login

Use username created earlier and password to authenticate. WildFly console will be the next window to show.

wildfly web console

Learning books:

Conclusion

WildFly distribution by default comes with a large number of default configurations that allows you to select the server features and operating modes. We hope this article helped you with the installation of JBoss open-source application server offering(WildFly) on Debian 12 Linux system. Check more content available in our website.

RELATED ARTICLES

Most Popular

Recent Comments