How To Install GlassFish on CentOS 8

Install GlassFish on CentOS 8

In this tutorial, we will show you how to install GlassFish on CentOS 8. For those of you who didn’t know, GlassFish is a popular app server that can run java based web applications for you. GlassFish 5 release supports the latest Java Platform: Enterprise Edition 7. It supports Enterprise JavaBeans, JPA, JavaServer Faces, JMS, RMI, JavaServer Pages, servlets, etc.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you through the step by step installation GlassFish on a CentOS 8.

Install GlassFish on CentOS 8

Step 1. First, let’s start by ensuring your system is up-to-date.

Step 2. Installing OpenJDK.

Currently, there are two LTS versions of OpenJDK – OpenJDK 8 and OpenJDK 11. You can also install the both Java version on any system and use as per your requirements.

  • Installing OpenJDK 11.
  • Installing OpenJDK 8.

Verify Java version:

Step 3. Installing Glassfish on CentOS 8.

First, create a user for Glassfish:

Next, download the latest stable version of GlassFish, At the moment of writing this article it is version 5:

Assign the ownership of /opt/glassfish5 the directory to glassfish user:

Step 4. Create systemd service.

Now we create systemd service (glassfish.service) for Glassfish server:

Add the following code lines:

Save changes and exit the file and start the glassfish server also set it to start automatically on boot:

Step 5. Configure Firewall.

Open HTTP port in the firewall:

Step 6. Accessing GlassFish Web Interface.

GlassFish will be available on HTTP port 8080 by default also port 4848 by the administration. Open your favorite browser and navigate to http://your-domain.com:8080 or http://server-ip-address:4848 and complete the required steps to finish the installation.

Congratulations! You have successfully installed GlassFish. Thanks for using this tutorial for installing the GlassFish 5 in the CentOS 8 system. For additional help or useful information, we recommend you to check the official GlassFish website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!