In the next article we are going to take a look at WildFly (formerly known as Jboss AS). This is a lightweight, fast and highly optimized Java EE application server based on Java with which large applications can be developed from a single IDE. In the following lines we are going to see how to install it in Ubuntu 18.04.
WildFly is cross-platform. It offers a robust control panel that makes changing a configuration in the application server is very simple and fast. It is not necessary to navigate through unnecessary pages to customize the environment looking for what suits your needs.
Install OpenJDK
WildFly is written in Java, that's why requires Java JDK to work. To meet this requirement, users can choose to install Oracle's official Java JDK or use the open source alternative called OpenJDK. For this example, we will opt for the open source version of Java, so in a terminal (Ctrl + Alt + T) we will write:
sudo apt update; sudo apt install default-jdk
After installing OpenJDK, we can check installation typing in the terminal:
java -version
If the terminal returns some lines like the ones in the previous screenshot, Java will be installed and ready.
Set up the WildFly user
Since this is an application server, generally it is recommended to use a dedicated service account. Run in the terminal (Ctrl + Alt + T) the following commands to create a WildFly service account to manage the server:
sudo groupadd -r wildfly sudo useradd -r -g wildfly -d /opt/wildfly -s /sbin/nologin wildfly
Finished, we continue with the download and installation of WildFly.
Download and install WildFly
Once the Java JDK installation is finished and the creation of a service account for WildFly is finished, we will execute the following commands to download package for WildFly. At this precise moment, the current version is 16.0.0.Final. The latest version available can be consulted in your download page.
If we open a terminal (Ctrl + Alt + T), we can use the wget command to download the package easily using the following commands:
cd /tmp wget https://download.jboss.org/wildfly/16.0.0.Final/wildfly-16.0.0.Final.tar.gz
Once the download is finished, we will have to execute the following commands to create WildFly folder in directory / Opt and to change your ownership to the WildFly service account.
tar xvf wildfly-16.0.0.Final.tar.gz sudo mv wildfly-16.0.0.Final/ /opt/wildfly sudo chown -RH wildfly: /opt/wildfly
We continue creating the WildFly service folder in the directory / etc / with the following command:
sudo mkdir -p /etc/wildfly
After creating the directory, copy the WildFly configuration files and executables to the directory newly created.
sudo cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.conf /etc/wildfly/ sudo cp /opt/wildfly/docs/contrib/scripts/systemd/launch.sh /opt/wildfly/bin/
We also have to make scripts in directory / etc / wildfly / bin are executable.
sudo sh -c 'chmod +x /opt/wildfly/bin/*.sh'
At this point we will copy systemd file to directory / etc / systemd / system / running:
sudo cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.service /etc/systemd/system/
Now we can use the following commands to stop, start and enable the WildFly services to start automatically at boot time:
First we stop the service:
sudo systemctl stop wildfly.service
Now we start the service:
sudo systemctl start wildfly.service
And we finished enabling the service:
sudo systemctl enable wildfly.service
For verify start, run the following command:
sudo systemctl status wildfly.service
User account to connect and administer the server web console
Now that you have downloaded and installed the WildFly service, run the following command to create a user account. This will connect and manage the web console of the application server. We will create the account by typing in the terminal (Ctrl + Alt + T):
sudo /opt/wildfly/bin/add-user.sh
In the menu that can be seen in the screenshot, type "a”And hit Enter:
Now enter a new username and create your password:
Writes "Yes" for complete setup. Now WildFly should be installed and ready.
Wildfly in the browser
We can now open the browser and as URL use the hostname or IP address of the server followed by port 8080.
http://localhost:8080
Server console is restricted to local server only. If you are interested in connecting from a remote location, information on how to do so can be obtained from your documentation.
After this we can access the administration console from http://localhost:9990/console remotely then WildFly has been successfully installed on Ubuntu, 18.04 in this case.
Thanks, it's the only tutorial that works 🙂
Fantastic. It saved my life.
Thanks to it worked, now I'm trying to replicate to have two instances of wildfly running on the same server, if I run it with sh /opt/wildfly2/bin/stanalone.sh, it works correctly, but when I want to create a second service so that work with systemctl start wildlfly2, I can't get it to work. Any recommendation?