How To Install WildFly (JBoss) on Debian 11 / Debian 10

Posted on 47 views

WildFly is a powerful and lightweight application server created to help you build amazing applications with ease. With its modular design it is easy to extend the functionalities. The JBoss Modules are used to provide true application isolation and hiding server implementation classes from the application while only linking with JARs your application needs. WildFly provides management capabilities which are exposed in a unified manner across many forms of access – CLI, a web based administration console, a native Java API, an HTTP/JSON based REST API, and a JMX gateway.

In this article, we shall discuss the installation process for WildFly (JBoss) on Debian 11 / Debian 10 system. The WildFly project now produces two appserver variants, standard WildFly and WildFly Preview, it’s upon you to choose the correct one for your needs. In this post, we shall focus on the setup of standard WildFly variant. We shall use the WildFly distribution which contains a large number of default configurations that allows you to select the server features and operating modes.

Install WildFly (JBoss) on Debian 11 / Debian 10

Follow the steps outlined in the next sections to install and configureWildFly (JBoss) on Debian 11 / Debian 10.

#1) Install Java in your Debian system

We’ll begin the setup with Java installation on our Debian system. Run the commands below to install the latest JDK release distributed in your OS repositories:

sudo apt update
sudo apt install default-jdk

After the installation, confirm installation by checking Java version:

$ java -version
openjdk version "11.0.13" 2021-10-19
OpenJDK Runtime Environment (build 11.0.13+8-post-Debian-1deb11u1)
OpenJDK 64-Bit Server VM (build 11.0.13+8-post-Debian-1deb11u1, mixed mode, sharing)

With Java installed and working on our system, we can proceed to the next step.

#2) Download WildFly zipped distribution

We shall use the zipped distribution to install a complete WildFly server with support for both standalone and managed domain operating modes.

Download the archive file using wget

sudo apt install wget curl
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

Extract the file downloaded:

tar xvf wildfly-$WILDFLY_RELEASE.tar.gz

Move the downloaded file to /opt directory:

sudo mv wildfly-$WILDFLY_RELEASE /opt/wildfly

#3) ConfigureWildFly on Debian Linux system

In this section, we shall create wildfly user and systemd service unit forWildFly

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

Next we created directory that hosts configuration files forWildFly

sudo mkdir /etc/wildfly

Copy all files required to manageWildFly service:

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
sudo cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.conf /etc/wildfly/

Set directory permissions correctly:

sudo chown -R wildfly:wildfly /opt/wildfly

Reload system units and start the service:

sudo systemctl daemon-reload
sudo systemctl start wildfly
sudo systemctl enable wildfly

Check ifWildFly service is now in running state:

$ systemctl status wildfly
● wildfly.service - The WildFly Application Server
     Loaded: loaded (/etc/systemd/system/wildfly.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2021-12-24 09:42:22 UTC; 42s ago
   Main PID: 46946 (launch.sh)
      Tasks: 51 (limit: 2340)
     Memory: 291.8M
        CPU: 7.659s
     CGroup: /system.slice/wildfly.service
             ├─46946 /bin/bash /opt/wildfly/bin/launch.sh standalone standalone.xml 0.0.0.0
             ├─46947 /bin/sh /opt/wildfly/bin/standalone.sh -c standalone.xml -b 0.0.0.0
             └─47040 java -D[Standalone] -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djav>

Dec 24 09:42:22 debian-bullseye-01 systemd[1]: Started The WildFly Application Server.
Dec 24 09:42:27 debian-bullseye-01 systemd[1]: /etc/systemd/system/wildfly.service:11: PIDFile= references a path below legacy directory /var/run/, updating /var/run/wildfly/wildfly.pid → /run/wild>
lines 1-14/14 (END)

Service will bind to port 8080 in the system. Ensure this port is not being used by any other service

[email protected]:~$ ss -tunelp | grep 8080
tcp   LISTEN 0      4096                            0.0.0.0:8080       0.0.0.0:*    uid:997 ino:208664 sk:9 cgroup:/system.slice/wildfly.service <->

#4) Creating Management / Application users in WildFly

WildFly is distributed with security enabled for the management interfaces. The first management user is created manually using a script distributed by the application.

We can execute the command below to add first user:

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

Select the type of user to be added to the system. We’ll choose a for first admin user creation. For application user created choose b:

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 username for user being added to the system.

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

Input and confirm the user password:

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 : 
Re-enter Password :  

Proceed with the configuration as prompted by the script:

What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[  ]:
About to add user 'myadminuser' for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user 'myadminuser' to file '/opt/wildfly/standalone/configuration/mgmt-users.properties'
Added user 'myadminuser' to file '/opt/wildfly/domain/configuration/mgmt-users.properties'
Added user 'myadminuser' with groups  to file '/opt/wildfly/standalone/configuration/mgmt-groups.properties'
Added user 'myadminuser' 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 Jakarta Enterprise Beans calls.
yes/no? yes
To represent the user add the following to the server-identities definition 

#5) Accessing WildFly Admin Console

All WildFly binary files and scripts are located in the /opt/wildfly/bin/ directory. This directory should be in our PATH. Let’s add it accordingly:

cat >> ~/.bashrc <

Source the bashrc file before using the script.

source ~/.bashrc

Use the jboss-cli.sh command to access WildFly CLI console:

$ jboss-cli.sh --connect
Authenticating against security realm: ManagementRealm
Username: myadminuser
Password: 
[[email protected]:9990 /] version
JBoss Admin Command-line Interface
JBOSS_HOME: /opt/wildfly
Release: 26.0.1.Final
Product: WildFly Full 26.0.1.Final
JAVA_HOME: null
java.version: 11.0.13
java.vm.vendor: Debian
java.vm.version: 11.0.13+8-post-Debian-1deb11u1
os.name: Linux
os.version: 5.10.0-8-amd64

Type exit to get out of the console

[[email protected]: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
● wildfly.service - The WildFly Application Server
     Loaded: loaded (/etc/systemd/system/wildfly.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2021-12-24 12:11:21 EAT; 6s ago
   Main PID: 8205 (launch.sh)
      Tasks: 70 (limit: 9482)
     Memory: 159.8M
        CPU: 12.265s
     CGroup: /system.slice/wildfly.service
             ├─8205 /bin/bash /opt/wildfly/bin/launch.sh standalone standalone.xml 0.0.0.0
             ├─8206 /bin/sh /opt/wildfly/bin/standalone.sh -c standalone.xml -b 0.0.0.0 -bmanagement=0.0.0.0
             └─8305 java -D[Standalone] -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava>

Des 24 12:11:21 ubuntu22 systemd[1]: Started The WildFly Application Server.

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=9496,fd=320)) uid:999 ino:73367 sk:c <->

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

wildfly-console-login

Input username and password created earlier to access WildFly web based administration console:

install-jboss-wildfly-debian-01-1024x529

After successful access to the web console. Explore various sections to be conversant with how it looks and works. The main sections of the interface are:

  • Deployments: Add and manage deployments
  • Configuration: Configure subsystem settings
  • Runtime: Monitor server status
  • Access Control: Manage user and group permissions for management operations
  • Patching: Manage WildFly Full patches

Screenshot example of Runtime section

install-jboss-wildfly-debian-02-2048x736

To this point, we have had a successful setup of WildFly on Debian 11 / Debian 10 Linux system. Visit WildFly Documentation page for further reading to understand all the concepts, how it works and how you can start hosting your applications on WildFly application server.

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.