Lorem ipsum dolor sit amet, conse ctetur adip elit, pellentesque turpis.

Welcome     email: [email protected]     Follow us

Image Alt

MapubiLabs

  /  Blog   /  How to install and configure Jboss(WildFly) on Ubuntu 19.04

How to install and configure Jboss(WildFly) on Ubuntu 19.04

WildFly, formerly known as JBoss, is a free, open-source, and cross-platform application server which is now developed by Red Hat. WildFly is written in Java and helps you in building great applications. With its pluggable subsystems, you can configure the application as and when you need. In this article, we will explain how a Ubuntu administrator can install and configure Wildfly for local and remote access.

Install WildFly

To install wildfly on Ubuntu 19.04, you need to make sure you have administrator privileges. Then use the following procedures.

Step 1: Open the terminal

You will have great need for your terminal in this tutorial. So whip up your terminal by clicking your terminal icon or by pressing “Ctrl + Alt + T” shortcut.

Step 2: Installing Open JDK

In a previous tutorial, I demonstrated how to install and configure open JDK 13. So just follow the link below to make sure you get open JDK installed and you can return to this tutorial when you are done.

Install and configure open jdk on ubuntu 19.04

Step 3: Create a user and group for WildFly

As a preliminary step, you need to create a user and group that will later be used to run the WildFly service.

Run the following command to create a new group:

$ sudo groupadd -r wildfly

Run the following command to add a user who will be authorized to run the service from /opt/wildfly

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

Note: Some of these commands will be seemingly long. So don’t mind copying them from here and pasting in your terminal. When you copy these commands, in your terminal press “Ctrl + Shift + V” to paste. And then press “Enter”.

Step 4: Download the WildFly installation file

Type the following command to download the wildfly installation file and it is a tar.gz file. We will be downloading it to the /tmp directory.

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

Step 5: Extract the WildFly file

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

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

Step 6: Create symbolic link to point to the WildFly installation directory

Run the following command to create a symbolic link by the name of wildfly. This link will point to the WildFly installation directory.

$ sudo ln -s /opt/wildfly-18.0.0.Final.tar.gz /opt/wildfly

Step 7: Give access to wildfly group and user

The WildFly user and group need ownership over the WildFly installation directory so that they can access and run WildFly.

Run the following command to do so:

$ sudo chown -RH wildfly: /opt/wildfly

Step 8: Configure WildFly to be run as a service

Please follow these steps carefully so that you can configure WildFly to be run as a Systemd service:

1. Create a directory where we will copy the wildfly.conf file. This file is a 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 to the newly created directory through the following command:

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

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

$ sudo nano /etc/wildfly/wildfly.conf

You can, of course, use any of your favorite text editors too.

This is how the file looks like:

This file, for now, includes the basic configuration for a standalone system. We will later explain how to edit this file for customized configurations such as while trying to access the administrative console remotely.

4. Next, 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/

Also, make the script executable through the following command:

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

5. The last file to copy is the wildfly.service unit file to your system’s services folder /etc/systemd/system

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

6. Finally, you have to inform your system that you have added a new unit file. This can be done by reloading the systemctl daemon:

$ sudo systemctl daemon-reload

You are now ready to run wildfly service as an administrator.

Step 9: Start the WildFly service

Now the WildFly service can be run like any other service recognized by Ubuntu.

Run the following command as sudo to start the service:

$ sudo systemctl start wildfly

You can verify if all is working well by checking the status of the service as follows:

$ sudo systemctl status wildfly

The Active status, as highlighted, above verifies that the service is up and running.

Another thing that will help you as a regular WildFly user is to enable the WildFly service at boot:

$ sudo systemctl enable wildfly

Configure WildFly

Now that we have installed WildFly and made it run as a service, it is time to make some configurations. These basically include:

  • Adjusting your firewall
  • Creating a secure WildFly administrator
  • Verifying the successful setup
  • Accessing the WildFly administrative console, locally and remotely

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

Step 1: Allow Traffic on Port 8080

Ubuntu systems are by default protected by the UFW firewall. If you want that your WildFly server can be accessed remotely, you need to allow traffic on port 8080.

Run the following command to do so:

$ sudo ufw allow 8080/tcp

Step 2: Create a WildFly Administrator

In this step, we will be creating and configuring a WildFly user. This user will be a management user/administrator for the web based administrative console and the CLI 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 following here is pretty much self-explanatory, but we will guide you nonetheless.

The script will first ask you if you want to create a management user or an application user:

Simply hit Enter to specify that you want to create a management user.

The script will then prompt you to add details about the new user. This includes adding a username of the new admin and specifying and then re-entering the password as follows:

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

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

Enter y and the script will verify the user creation through the following message:

This user can now perform administrative functions on WildFly.

Step 3: Verify the successful setup of WildFly

Let us now verify if our WildFly server is up and running. Open your browser and enter the following URL:

http://<your_domain_or_IP_address>:8080

I am testing the setup on my localhost:

http://localhost:8080/

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

How to open the administrative console through the web interface

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

http://localhost:9990/console

WildFly Administrator login

Specify the User Name and Password of the management user you created in Step 2 of ‘Configure WildFly”. The console will open as follows when you click the OK button:

WilsFly Admin dashboard

Managing the Administrative console remotely

In order access the Administrative Console remotely, you need to make small configurations to three WildFly files.

1. Open the wildfly.conf file through 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

This is how the file should look like:

Allow remote access to WildFly

Quit the file through Ctrl+X and then save the changes by hitting y and then Enter.

2. Open the launch .sh script file through the following command:

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

Open WildFly Launch script

Change the highlighted lines to the following:

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

else

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

Quit the file through Ctrl+X and then save the changes by hitting y and then Enter.

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

$ sudo systemctl restart wildfly

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

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

Edit 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 have changed the service unit file, let us notify the system through the following command:

$ sudo systemctl daemon-reload

Also, restart the WildFly service through the following command:

$ sudo systemctl restart wildfly

Restart WildFly service

You can now access the console by entering the following URL on a remote machine:

http://<your_domain_or_IP_address>:9990/console

Please ensure that port 9990 is open for traffic on your firewall.

How To Open The Administrative Console CLI

Open your Ubuntu Terminal and switch to the /opt/wildfly/bin folder from where we will be running the CLI script:

$ cd /opt/wildfly/bin/

Then, enter the following command to run the WildFly Administrative Console CLI script:

$ ./jboss-cli.sh --connect

Open the Administrative Console CLI

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

Enter “help” to see what all you can do here.

WildFly Help

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

$ version 

CONGRATS!!! YOU HAVE SUCCESSFULLY INSTALLED AND CONFIGURED WILDFLY

Post a Comment

User Registration

You don't have permission to register

Reset Password