JBoss

How to Install JBoss on Ubuntu: A Step-by-Step Guide

Welcome to the Greenhost.cloud blog! Whether you’re a seasoned developer or just starting in the world of Java applications, setting up JBoss on your Ubuntu machine can be a straightforward process with the right guidance. In this post, we’ll walk you through the installation steps, ensuring you can confidently launch your applications in a JBoss environment.

What is JBoss?

JBoss, now known as WildFly, is a popular open-source application server that implements the Java Platform, Enterprise Edition (Java EE). It provides a robust platform for developing and deploying enterprise applications and is favored for its reliability, scalability, and flexibility.

Prerequisites

Before we dive into the installation process, make sure you have the following:

  1. An Ubuntu server (16.04 or newer is recommended).
  2. Access to a terminal with sudo privileges.
  3. Java Development Kit (JDK) installed, preferably JDK 8 or later.

Installing Java

To install JDK, run the following commands in your terminal:

sudo apt update
sudo apt install openjdk-11-jdk

Verify the installation:

java -version

Step 1: Downloading JBoss (WildFly)

  1. Navigate to the WildFly website to obtain the latest version.
  2. Use wget in the terminal to download the server. For example, to download version 26.1.0:
cd /opt
sudo wget https://download.jboss.org/wildfly/26.1.0.Final/wildfly-26.1.0.Final.tar.gz

Step 2: Extract the WildFly Package

Once downloaded, extract the compressed file:

sudo tar -xvzf wildfly-26.1.0.Final.tar.gz

After extraction, you can remove the tar file:

sudo rm wildfly-26.1.0.Final.tar.gz

Step 3: Setting Up WildFly

  1. Change the ownership of the WildFly directory:
sudo chown -R $USER:$USER /opt/wildfly-26.1.0.Final
  1. Navigate to the WildFly directory:
cd /opt/wildfly-26.1.0.Final
  1. Start the WildFly server:
./bin/standalone.sh

Your server should now be running on port 8080! You can access the management console by visiting http://localhost:8080/.

Step 4: Configuring WildFly to Run as a Service

To ensure your JBoss server starts automatically when your system boots, you’ll want to set it up as a service.

  1. Create a new service file:
sudo nano /etc/systemd/system/wildfly.service
  1. Add the following content to the file:
[Unit]
Description=WildFly Application Server
After=network.target

[Service]
User=your_username
Group=your_groupname
ExecStart=/opt/wildfly-26.1.0.Final/bin/standalone.sh
ExecStop=/opt/wildfly-26.1.0.Final/bin/jboss-cli.sh --connect command=:shutdown
Restart=always

[Install]
WantedBy=multi-user.target

Make sure to replace your_username and your_groupname with your actual username and group.

  1. Save and exit the editor (Ctrl + X, then Y, then Enter).
  2. Reload systemd to recognize the new service:
sudo systemctl daemon-reload
  1. Start the WildFly service:
sudo systemctl start wildfly
  1. Enable it to start on boot:
sudo systemctl enable wildfly

Step 5: Access the Management Console

Now that your server is running, you need to configure your management user.

  1. Add a management user:
cd /opt/wildfly-26.1.0.Final/bin
sudo ./add-user.sh
  1. Follow the prompts to set up your management user credentials.
  2. Access the management console at http://localhost:9990/ using the credentials you just created.

Conclusion

Congratulations! You’ve successfully installed JBoss (WildFly) on your Ubuntu machine. You can now begin deploying your Java applications and exploring the powerful features that JBoss offers. If you encounter any issues during the installation, feel free to drop your questions in the comments below.

At Greenhost.cloud, we’re here to support your hosting needs with expert guidance on various platforms, whether it’s JBoss, WordPress, or any other application. Happy coding!


Recommended Resources:

Stay tuned for more helpful guides and tips on our blog!