How To Install WildFly (JBoss) on Ubuntu 18.04 / Debian 10/9

 1 year ago
source link: https://computingforgeeks.com/install-wildfly-application-server-on-ubuntu-debian/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
How To Install WildFly (JBoss) on Ubuntu 18.04

This guide will walk you through the installation of WildFly (JBoss) Server on Ubuntu 18.04 / Debian 10/9. WildFly formerly known as JBoss is an application server written in Java and developed by Red Hat. WildFly Application Server is an exceptionally fast, lightweight and powerful implementation of the Java Enterprise Edition 8 Platform specifications.

As of this writing, WildFly 16 is the latest release in a series of JBoss open-source application server offerings. This article provides a quick overview on how to download and install WildFly 16 on Ubuntu 18.04 / Debian 10/9 for your application development.

Step 1: Install Java

WildFly is written in Java and it need to be installed as pre-requisite. There are two options of installing Java on Ubuntu/Debian.

  • Install OpenJDK
  • Install Java SE Development Kit

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

sudo apt update
sudo apt -y install default-jdk

The default Java version installed from above command is Java 10+. This is supported by WildFly.

$ java --version
openjdk 10.0.2 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)

Step 2: Download WildFly

Check WildFly Downloads page for latest releases before downloading the file. Here we will download WildFly 18.0.1.Final.

export WILDFLY_RELEASE="18.0.1"
wget https://download.jboss.org/wildfly/$WILDFLY_RELEASE.Final/wildfly-$WILDFLY_RELEASE.Final.tar.gz

Once the file is downloaded, extract it.

tar xvf wildfly-$WILDFLY_RELEASE.Final.tar.gz

Move resulting folder to /opt/wildfly.

sudo mv wildfly-$WILDFLY_RELEASE.Final/ /opt/wildfly

Step 3: Configure Systemd for WildFly

Let’s now create a system user and group that will run WildFly service.

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

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.

sudo chown -R wildfly:wildfly /opt/wildfly

Reload systemd service.

sudo systemctl daemon-reload

Start and enable WildFly service:

sudo systemctl start wildfly
sudo systemctl enable wildfly

Confirm WildFly Application Server status.

sudo systemctl status wildfly

Sample output:

Service should bind to port 8080.

# ss -tunelp | grep 8080
tcp LISTEN 0 128* users:(("java",pid=6854,fd=389)) uid:999 ino:30339 sk:3 <->

Step 4: Add WildFly Users

By default WildFly 16 is now distributed 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.

Run it by executing the command:

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)

Provide desired username for the user.

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

Set password for the user:

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 'computingforgeeks' for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user 'computingforgeeks' to file '/opt/wildfly/standalone/configuration/mgmt-users.properties'
Added user 'computingforgeeks' to file '/opt/wildfly/domain/configuration/mgmt-users.properties'
Added user 'computingforgeeks' with groups to file '/opt/wildfly/standalone/configuration/mgmt-groups.properties'
Added user 'computingforgeeks' 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 Admin 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

Source the bashrc file.

source ~/.bashrc

Now test by connecting to WildFly Admin Console from CLI with jboss-cli.sh command.

# jboss-cli.sh --connect
[[email protected]:9990 /] version
JBoss Admin Command-line Interface
JBOSS_HOME: /opt/wildfly
Release: 8.0.0.Final
Product: WildFly Full 16.0.0.Final
java.version: 10.0.2
java.vm.vendor: Oracle Corporation
java.vm.version: 10.0.2+13-Ubuntu-1ubuntu0.18.04.4
os.name: Linux
os.version: 4.15.0-46-generic

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* 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:

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

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

Restart wildfly service

sudo systemctl restart wildfly


$ ss -tunelp | grep 9990
tcp LISTEN 0 50* 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.

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

You have successfully installed WildFly Application server on Ubuntu 18.04 / Debian 9. Visit WildFly Documentation page for further reading.

About Joyk

Aggregate valuable and interesting links.
Joyk means Joy of geeK