How to Install WildFly (JBoss) on Ubuntu 18.04

Requirements

  • A fresh Alibaba Cloud instance with Ubuntu 18.04 desktop installed.
  • A root password is set up to your instance.

Launch Alibaba Cloud ECS Instance

apt-get update -y

Install Java

mkdir /usr/lib/jvm/
tar -zxvf jdk-8u221-linux-x64.tar.gz -C /usr/lib/jvm/
update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_221/bin/java 1
java -version
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)

Install WildFly

groupadd -r wildfly
useradd -r -g wildfly -d /opt/wildfly -s /sbin/nologin wildfly
wget https://download.jboss.org/wildfly/17.0.1.Final/wildfly-17.0.1.Final.zip
unzip wildfly-17.0.1.Final.zip
mv wildfly-17.0.1.Final /opt/wildfly
chown -RH wildfly: /opt/wildfly

Configure Systemd File for WildFly

mkdir -p /etc/wildfly
cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.conf /etc/wildfly/
cp /opt/wildfly/docs/contrib/scripts/systemd/launch.sh /opt/wildfly/bin/
sh -c 'chmod +x /opt/wildfly/bin/*.sh'
cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.service /etc/systemd/system/
systemctl daemon-reload
systemctl start wildfly
systemctl enable wildfly
systemctl status wildfly
● wildfly.service - The WildFly Application Server
Loaded: loaded (/etc/systemd/system/wildfly.service; disabled; vendor preset: enabled)
Active: active (running) since Sat 2019-08-03 09:10:00 UTC; 7s ago
Main PID: 15938 (launch.sh)
Tasks: 52 (limit: 1098)
CGroup: /system.slice/wildfly.service
├─15938 /bin/bash /opt/wildfly/bin/launch.sh standalone standalone.xml 0.0.0.0
├─15943 /bin/sh /opt/wildfly/bin/standalone.sh -c standalone.xml -b 0.0.0.0
└─16003 java -D[Standalone] -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true
Aug 03 09:10:00 hitesh systemd[1]: Started The WildFly Application Server.

Configure WildFly Authentication

/opt/wildfly/bin/add-user.sh
What type of user do you wish to add? 
a) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a): a
Enter the details of the new user to add.
Using realm 'ManagementRealm' as discovered from the existing property files.
Username : letscloud
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 :
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 'letscloud' for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user 'letscloud' to file '/opt/wildfly/standalone/configuration/mgmt-users.properties'
Added user 'letscloud' to file '/opt/wildfly/domain/configuration/mgmt-users.properties'
Added user 'letscloud' with groups to file '/opt/wildfly/standalone/configuration/mgmt-groups.properties'
Added user 'letscloud' 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 <secret value="YWRtaW5AMTIz" />

Configure WildFly to Access From Remote Location

nano /etc/wildfly/wildfly.conf
WILDFLY_CONSOLE_BIND=0.0.0.0
nano /opt/wildfly/bin/launch.sh
if [ "x$WILDFLY_HOME" = "x" ]; then
WILDFLY_HOME="/opt/wildfly"
fi
if [[ "$1" == "domain" ]]; then
$WILDFLY_HOME/bin/domain.sh -c $2 -b $3 -bmanagement $4
else
$WILDFLY_HOME/bin/standalone.sh -c $2 -b $3 -bmanagement $4
fi
nano /etc/systemd/system/wildfly.service
[Unit]
Description=The WildFly Application Server
After=syslog.target network.target
Before=httpd.service
[Service]
Environment=LAUNCH_JBOSS_IN_BACKGROUND=1
EnvironmentFile=-/etc/wildfly/wildfly.conf
User=wildfly
LimitNOFILE=102642
PIDFile=/var/run/wildfly/wildfly.pid
ExecStart=/opt/wildfly/bin/launch.sh $WILDFLY_MODE $WILDFLY_CONFIG $WILDFLY_BIND $WILDFLY_CONSOLE_BIND
StandardOutput=null
[Install]
WantedBy=multi-user.target
mkdir /var/run/wildfly/
chown wildfly:wildfly /var/run/wildfly/
systemctl daemon-reload
systemctl restart wildfly

Access WidFly Web Console

Conclusion

Original Source

--

--

--

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

CKS Exam: Tips and tricks

We did not find the options to request scopes.

How I Programmed Rock, Paper, Scissors in Python

Getting started on lemon.markets — the infrastructure powering algorithmic trading

250k GMEE staking event celebration!

Making Containerized Applications Highly Available — Embracing Failures

Installing Elasticsearch and Kibana with ECS

Extend Your Business with a Hybrid Cloud Solution

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

More from Medium

Debugging and Testing

What exactly is Apache Maven?

Migrating from Mockito 1 to Mockito 2 on Java 11

4 ways to fix Spring4Shell Vulnerability in Older versions of Spring — Termlex