How to install WildFly (JBoss) Java Application Server on Ubuntu 18.04
WildFly, formerly known as JBoss, is a free and open source application server written in Java which implements the Java Enterprise Edition (Java EE) specification. It runs on multiple platforms incl. Windows and Linux. WildFly provides support for Web Sockets that allows your applications the ability to use optimized custom protocols and full-duplex communication with your backend infrastructure.
In this tutorial, I will explain how to install WildFly application server on Ubuntu 18.04 LTS.
Requirements
- A server running Ubuntu 18.04 server.
- A non-root user with sudo privileges.
- A static IP address 192.168.0.235 configure on your server.
Install Java
WildFly is written in Java, so you will need to install Java to your system. You can install Java by running the following command:
sudo apt-get install default-jdk -y
Once the Java is installed, you can check the version of Java using the following command:
java -version
Output:
openjdk version "10.0.2" 2018-07-17 OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.2) OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.2, mixed mode)
Install WildFly
First, you will need to download the latest version of WildFly from their official website. You can download it with the following command:
wget http://download.jboss.org/wildfly/14.0.1.Final/wildfly-14.0.1.Final.tar.gz
Once the download is completed, extract the downloaded file with the following command:
cd /opt
tar -xvzf wildfly-14.0.1.Final.tar.gz
sudo mv wildfly-14.0.1.Final wildfly
By default, WildFly server is binded to 127.0.0.1, you can access it only using 127.0.0.1. So you will need to change binded address to your server IP, if you want to connect WildFly from anywhere on LAN. You can do this by editing standalone.xml file:
sudo nano /opt/wildfly/standalone/configuration/standalone.xml
Change the following lines:
<subsystem xmlns="urn:jboss:domain:webservices:2.0"> <wsdl-host>${jboss.bind.address:192.168.0.235}</wsdl-host> <endpoint-config name="Standard-Endpoint-Config"/> <interface name="management"> <inet-address value="${jboss.bind.address.management:192.168.0.235}"/> </interface> <interface name="public"> <inet-address value=”${jboss.bind.address:192.168.0.235}”/> </interface>
Save and clsoe the file.
Next, you will need to add a user to access the management console. You can add the user by running the following script:
sudo /opt/wildfly/bin/add-user.sh
Answer all the questions as shown below:
What type of user do you wish to add? a) Management User (mgmt-users.properties) b) Application User (application-users.properties) (a): Enter the details of the new user to add. Using realm 'ManagementRealm' as discovered from the existing property files. Username : wildflyadmin 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)[ ]: wildfly About to add user 'wildflyadmin' for realm 'ManagementRealm' Is this correct yes/no? yes Added user 'wildflyadmin' to file '/opt/wildfly/standalone/configuration/mgmt-users.properties' Added user 'wildflyadmin' to file '/opt/wildfly/domain/configuration/mgmt-users.properties' Added user 'wildflyadmin' with groups wildfly to file '/opt/wildfly/standalone/configuration/mgmt-groups.properties' Added user 'wildflyadmin' with groups wildfly 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
Access WildFly Console
Before accessing WildFly console, you will need to start the wildfly instance. You can start it with the following command:
sudo sh /opt/wildfly/bin/standalone.sh
The above command will start the wildfly instance.
Now, open your web browser and type the URL http://192.168.0.235:8080. You will be redirected to the WildFly default page:
To access the management console, open your web browser and type the URL http://192.168.0.235:9990. You will be redirected to the following page:
Now, provide your WildFly login credentials, then click on the OK button. You should see the WildFly management console dashboard in the following page: