With a multitude of open-source application servers available, choosing one that ticks all the boxes can be a challenging task. Among the frontrunners is Eclipse GlassFish, a powerful and reliable application server that is the Eclipse Foundation’s implementation of the Jakarta EE platform. This article will guide you through the steps to install GlassFish on openSUSE, ensuring you are equipped with the necessary knowledge to carry out the process efficiently.

Prerequisites

Before we dive into the installation process, let’s discuss the prerequisites to ensure a smooth installation:

  • Operating System: You need a server running openSUSE. A fresh OS install is recommended to avoid potential issues.
  • Terminal Access: You will need access to the terminal to execute commands. openSUSE provides the Terminal application for this purpose, which can be found in your Applications menu.
  • Internet Connection: An active internet connection is necessary to download GlassFish and its dependencies.
  • Administrative Access: You’ll need administrative (root) access or a user account with sudo privileges.

Step-by-Step Installation of GlassFish on openSUSE

Step 1: Update Your System

Before we start the installation process, it’s crucial to ensure your system is up-to-date. You can do this by running the following commands in your terminal:

sudo zypper refresh
sudo zypper update

Step 2: Install Java Development Kit (JDK)

GlassFish requires Java to function, and it is recommended to use a version of JDK compatible with the version of GlassFish you plan to install. Install OpenJDK’s JDK on openSUSE using zypper by running the following commands:

sudo zypper search openjdk-devel
sudo zypper --non-interactive install java-17-openjdk-devel

You can verify the Java version with the command: javac -version.

Step 3: Install Eclipse GlassFish

To install Eclipse GlassFish on openSUSE, visit the official Eclipse GlassFishdownload page and choose the version that suits your needs. You can use wget or curl to download the GlassFish package directly to your openSUSE system:

wget https://download.eclipse.org/ee4j/glassfish/glassfish-7.0.12.zip

Once the download is complete, extract the package to your preferred installation directory, such as /opt:

sudo unzip glassfish-7.0.12.zip-d/opt/

Step 4: Create a Dedicated User

For security reasons, it’s recommended to create a dedicated user for running GlassFish. You can do this by running:

sudo useradd -s /sbin/nologin glassfish

Next, change the ownership of the GlassFish directory to the newly created user:

sudo chown -R glassfish:glassfish /opt/glassfish7/

Step 5: Create a Systemd Service File

To manage GlassFish as a service, create a systemd service file:

sudo nano /usr/lib/systemd/system/glassfish.service

Add the following content to the file:

[Unit]
Description=GlassFish Server
After=syslog.target network.target

[Service]
User=glassfish
ExecStart=/opt/glassfish6/glassfish/bin/asadmin start-domain domain1

[Install]
WantedBy=multi-user.target

Enable and start the GlassFish service using systemd:

sudo systemctl daemon-reload
sudo systemctl enable glassfish
sudo systemctl start glassfish

Step 6: Configure GlassFish

To secure your server, set an admin password for the GlassFish domain:

/opt/glassfish7/bin/asadmin --port 4848 change-admin-password

When prompted for the user, type the default user admin, and press ENTER when asked for the password. The default GlassFish comes without a password. When prompted to set up a new password, type your password and repeat.

Step 7: Configure Firewall

When setting up GlassFish on openSUSE, it’s crucial to configure the firewall to allow traffic to and from the server. By default, GlassFish uses port 8080 for HTTP traffic and port 4848 for the admin console. However, these ports can be customized:

sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent
sudo firewall-cmd --zone=public --add-port=4848/tcp --permanent
sudo firewall-cmd --reload

You can use the firewall-cmd tool to list all open ports: sudo firewall-cmd --zone=public --list-ports.

Step 8: Access the GlassFish Admin Console Web UI

Once GlassFish is running, you can access the admin console by navigating to http://your-IP-address:4848 in your web browser.

While managing your VPS may seem complicated, with the right guidance and knowledge, it’s a task that can be accomplished with relative ease. However, if you’re still unsure or don’t have the time to manage your VPS, Shape.host offers Linux SSD VPS services starting from $4. Our team of professionals can manage your VPS, freeing up your time to focus on your core business tasks.