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:
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:
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:
Open HTTP port in the firewall:
GlassFish will be available on HTTP port 8080 by default also port 4848 by the administration. Open your favorite browser and navigate to
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.