How to install and configure WildFly (JBoss) in Debian 10

WildFly, formerly known as JBoss, is a free, open source, cross-platform application server developed by Red Hat. WildFly is written in Java and helps you create great applications. Thanks to the plug-in subsystems, you can configure the application as you need. In this article, we will describe how a Debian administrator can install and configure Wildfly on his system.

We ran the commands and procedures mentioned in this article on the Debian 10 Buster system.

Install WildFly

The Debian / administrator (user sudo) can install the stable WildFly application server by carefully following these steps:

Step 1: Open a Terminal or connect to the server via SSH

We will use the Debian, Terminal command line to install and configure WildFly. You can open the Terminal application through a search in the Application Launcher as follows:

Step 2: Update Repository Index

To install the latest available version of software from online storage, your local storage index must match it. Run the following command as sudo to update the local repository index:

$ sudo apt-get update

Refresh Package Lists

Please note that only an authorized user can add, remove and configure software in Debian.

Step 3: Install OpenJDK from APT

Please run the following command as sudo to install OpenJDK from the APT repositories:

$ sudo apt-get install default-jdk

Install Java Development Kit

The system may ask you to enter a password for sudo, as well as provide the Y / n option to continue the installation. Type Y, then press Enter.

Step 4: Create a User and Group for WildFly

As a preliminary step, you need to create a user and group, which will subsequently be used to start the WildFly service.

Run the following command to create a new group:

$ sudo groupadd -r wildfly

Add Wildfly Group

Run the following command, which will be authorized to start the service in / opt / wildfly

$ sudo useradd -r -g wildfly -d /opt/wildfly -s /sbin/nologin wildfly

Add user Wildfly

Tip: You will need to use a few long commands during the installation of WildFly. Instead of entering a command, you can copy it from here and paste it into the Terminal using Ctrl + Shift + V, or using the Paste option in the context menu.

Step 5: Download the Wildfly Installation File

Now we will download tar.gz for WildFly from the official JBoss website.

First, let’s create a variable to determine the version number of WildFly that we want to download.

$ Version_Number=16.0.0.Final

I want to download version 16.0.0.Final on my system. This variable can be used in all commands where you need to specify the version of WildFly.

Run the following command to upload the tar.gz file to the / tmp folder of your Debian.

$ wget https://download.jboss.org/wildfly/$Version_Number/wildfly-$Version_Number.tar.gz -P /tmp

Download Source Code Wildfly

Step 6: Extract the WildFly tar.gz file to the / opt folder

WildFly software will be installed after you extract the downloaded .tar.gz file. Run the following command as sudo to extract the file to the / opt folder.

$ sudo tar xf /tmp/wildfly-$Version_Number.tar.gz -C /opt/

Unzip the archive

Step 7: Create a symlink pointing to the WildFly installation directory

Run the following command to create a symbolic link named wildfly. This link will point to the Wildfly installation directory.

$ sudo ln -s /opt/wildfly-$Version_Number /opt/wildfly

Create a symbolic link

Step 8: Grant access to the group and user wildfly

The user and the WildFly group must own the WildFly installation directory so that they can access and run WildFly.

To do this, run the following command:

$ sudo chown -RH wildfly: /opt/wildfly

Set the correct permissions for files and folders

Step 9: Configure Wildfly to Run as a Service

Please carefully follow these steps to configure WildFly to run as a Systemd service:

1. Create a directory into which we will copy the wildfly.conf file. This file is part of the WildFly package that you downloaded and installed.

$ sudo mkdir -p /etc/wildfly

2. Copy the wildfly.conf file from the package files into the newly created directory using the following command:

$ sudo cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.conf /etc/wildfly/

Copy the Wildfly configuration file

3. Open the configuration file in the Nano editor with the following command:

$ sudo nano /etc/wildfly/wildfly.conf

Of course, you can also use any of your favorite text editors.

This is what the file looks like:

wildfly.conf opened in nano editor

At the moment, this file includes the basic configuration for an autonomous system. Later we will explain how to edit this file for custom configurations, for example, when trying to remotely access the administrative console.

4. Then copy the launch.sh script from the WildFly package to the / opt / wildfly / bin / folder:

$ sudo cp /opt/wildfly/docs/contrib/scripts/systemd/launch.sh /opt/wildfly/bin/

In addition, make the script executable with the following command:

$ sudo sh -c 'chmod +x /opt/wildfly/bin/*.sh'

Wildfly Launch Script

5. The last file to be copied is the wildfly.service module file in the system services folder / etc / systemd / system

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

Copy the systemd system file

6. Finally, you must tell your system that you have added a new module file. This can be done by restarting the systemctl daemon:

$ sudo systemctl daemon-reload

Reboot systemd

You are now ready to start the WildFly service as an administrator.

Step 10: Launch WildFly Service

WildFly can now be launched like any other service recognized by Debian.

Run the following command as sudo to start the service:

$ sudo systemctl start wildfly

You can check if everything is working fine by checking the status of the service as follows:

$ sudo systemctl status wildfly

Check wildfly service status

An active state, as highlighted above, confirms that the service is up and running.

Another thing that will help you is to enable the wildfly service on boot:

$ sudo systemctl enable wildfly

Customize Wildfly

Now that we have installed WildFly and started it as a service, it’s time to make some settings. They mainly include:

  • Configure Your Firewall
  • Creating a secure WildFly admin
  • Verify successful setup
  • Access to the WildFly administrative console, locally and remotely

Please follow these steps one by one so that you use the WildFly portal securely.

Step 1: allow traffic through port 8080

If you want your WildFly server to be remotely accessible, you need to allow traffic through port 8080. If your Debian does not have the UFW firewall application installed by default, run the following command to install it on your system:

$ sudo apt-get install ufw

To do this, run the following command:

$ sudo ufw allow 8080/tcp

Configure Firewall

Step 2. Creating a WildFly Admin

At this point, we will create and configure the WildFly user. This user will be the managing user / administrator for the administrative web console and command line interface that can be used remotely.

Run the following command to run the add-user script from the WildFly directory:

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

The procedure below does not require explanation, but, nevertheless, we will help you.

First, the script will ask you if you want to create a managing user or application user:

Create Wildfly Admin User

Just press Enter to indicate that you want to create a management user.

Then the script will prompt you to add information about the new user. This includes adding the new administrator username and specifying and then re-entering the password as follows:

Create Admin Script

In the image above, you can see that I created a user with the name “admin-wildfly”.

The following prompt will ask you if the user should be able to use the console remotely.

Allow console access

Enter y, and the script will verify the user’s creation using the following message:

User created successfully

This user can now perform administrative functions on WildFly.

Step 3: Verify Successful WindFly Setup

Now let’s check if our WindFly server is working. Open a browser and enter the following URL:

Http: //: 8080

I check the settings on my local host:

HTTP: // local: 8080 /

Access WildFly

If you see something similar to the one shown above, we can assure you that your WildFly instance is up and running.

How to open the administrative console via the web interface?

Enter the following URL in your browser to open the administrative console through the local system:

Http: // local: 9990 / console

Open the WildFly Admin Console

Specify the username and password of the management user that you created in step 2 of “Configuring WildFly”. When you click OK, the console will open as follows:

Wildfly Admin Panel

Remote management of the administrative console

To access the administrative console remotely, you need to make small settings for the three WildFly files.

1. Open the wildfly.conf file with the following command:

$ sudo nano /etc/wildfly/wildfly.conf

Add the following lines to the end of the file:

# The address console to bind to

WILDFLY_CONSOLE_BIND=0.0.0.0

Here’s what the file should look like:

Allow remote access to the admin console

Exit the file by pressing Ctrl + X, then save the changes by pressing y and then Enter.

2. Open the .sh startup script file with the following command:

$ sudo nano /opt/wildfly/bin/launch.sh

Set up a startup script

Change the highlighted lines as follows:

$WILDFLY_HOME/bin/domain.sh -c $2 -b $3 -bmanagement $4

else

$WILDFLY_HOME/bin/standalone.sh -c $2 -b $3 -bmanagement $4

Exit the file by pressing Ctrl + X, then save the changes by pressing y and then Enter.

After that, restart the WildFly service with the following command:

$ sudo systemctl restart wildfly

3. Finally, edit the wildfly.service file with the following command:

$ sudo nano /etc/systemd/system/wildfly.service

Configure wildfly.service file

Replace the highlighted line with the following:

ExecStart=/opt/wildfly/bin/launch.sh $WILDFLY_MODE $WILDFLY_CONFIG $WILDFLY_BIND $WILDFLY_CONSOLE_BIND

Since we changed the service module file, let’s notify the system with the following command:

$ sudo systemctl daemon-reload

Also restart the WildFly service with the following command:

$ sudo systemctl restart wildfly

Reboot Wildfly

Now you can access the console by entering the following console on the remote computer:

Http: //: 9990 / console

Make sure port 9990 is open for traffic on your firewall.

How to open the CLI administrative console

Open the Debian terminal and go to the / opt / wildfly / bin folder, from which we will run the CLI script:

$ cd /opt/wildfly/bin/

Then enter the following command to run the WildFly administration console CL script:

$ ./jboss-cli.sh --connect

jboss-cli connect

You are now “[[email protected]:9990 /] console.

Enter “help” to see that everything you can do here.

JBoss CLI

I will check the version number by entering the version command:

Check out the details of the JBoss / Wildfly version

You have successfully installed and configured WildFly on your system. You also know how to configure WildFly and your system to have remote access to the administrative console.

How to install and configure WildFly (JBoss) in Debian 10

Sidebar