** WildFly ** is a free, open source, cross-platform application written in ** Java ** and developed by Red Hat.
--A fresh Alibaba Cloud instance with the Ubuntu 18.04 desktop installed. --The instance has a root password.
Create a new ECS instance (https://www.alibabacloud.com/help/ja/doc-detail/25424.htm), select Ubuntu 18.04 as the operating system with at least 4GB RAM, and as the root user Connect to your instance (https://www.alibabacloud.com/help/ja/doc-detail/25434.htm).
After logging in to your Ubuntu 18.04 desktop instance, run the following command to update your base system with the latest available packages.
apt-get update -y
Once your account is available, log in as a non-root user to get started.
To use WildFly, Java version 8 must be installed on the server. By default, Java 8 is not available in the Ubuntu 18.04 default repository. Therefore, you need to download it from the company's official website.
After downloading Java 8, unzip it to the / usr / lib / jvm directory.
mkdir /usr/lib/jvm/
tar -zxvf jdk-8u221-linux-x64.tar.gz -C /usr/lib/jvm/
Then set the default version of Java with the following command:
update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_221/bin/java 1
Next, verify Java with the following command.
java -version
output:
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)
Before you can install WildFly, you need to create users and groups for WildFly. You can create it with the following command.
groupadd -r wildfly
useradd -r -g wildfly -d /opt/wildfly -s /sbin/nologin wildfly
Then download the latest version of WildFly with the following command:
wget https://download.jboss.org/wildfly/17.0.1.Final/wildfly-17.0.1.Final.zip
After downloading, unzip the downloaded file and change to the / opt / wildfly
directory with the following command.
unzip wildfly-17.0.1.Final.zip
mv wildfly-17.0.1.Final /opt/wildfly
Then give the Wildfly directory the appropriate permissions with the following command:
chown -RH wildfly: /opt/wildfly
Copy the files needed to configure WildFly.
Then copy the WildFly config file to / etc / directory.
mkdir -p /etc/wildfly
cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.conf /etc/wildfly/
Then move the WildFly launch.sh file to the / opt / wildfly / bin / directory.
cp /opt/wildfly/docs/contrib/scripts/systemd/launch.sh /opt/wildfly/bin/
sh -c 'chmod +x /opt/wildfly/bin/*.sh'
Then copy the WildFly systemd file with the following command:
cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.service /etc/systemd/system/
Reload the configuration file with the following command.
systemctl daemon-reload
Next, start the WildFly service so that it can be started at startup with the following command.
systemctl start wildfly
systemctl enable wildfly
You can now check the status of WildFly with the following command.
systemctl status wildfly
output:
● 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.
Next, you need to create an admin user to access the WildFly admin console. You can add it with the following command.
/opt/wildfly/bin/add-user.sh
You should see output similar to the following.
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" />
By default, WildFly can only be accessed from localhost. Therefore, you need to configure WildFly for remote access. This can be done by editing the /etc/wildfly/wildfly.conf file.
nano /etc/wildfly/wildfly.conf
Add the following line.
WILDFLY_CONSOLE_BIND=0.0.0.0
Save and close the file. Then open the /opt/wildfly/bin/launch.sh file.
nano /opt/wildfly/bin/launch.sh
Modify the file as follows:
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
Save and close the file. Open the, /etc/systemd/system/wildfly.service file.
nano /etc/systemd/system/wildfly.service
Make the following changes.
[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
Save and close the file.
Then create the / var / run / wildfly directory and set the correct permissions.
mkdir /var/run/wildfly/
chown wildfly:wildfly /var/run/wildfly/
Finally, reload the systemd daemon and restart the service for the changes to take effect.
systemctl daemon-reload
systemctl restart wildfly
Now open your web browser and enter the URL [http://your-server-ip:9990/console](http://your-server-ip:9990/console.?spm=a2c65. 11461447.0.0.40f92bacqqDcpb). You will be redirected to the next page.
Enter your username and password. Then click the Sign IN button. You should see WildFly's default dashboard on the following page.
Congratulations! WidFly is now installed and ready to use. WidFly is now installed and ready to use. Learn more: https://wildfly.org/
Thanks to Gary Stevens, CTO of Hosting Canada for helping us with this guide.
Recommended Posts