In this article, we will have explained the necessary steps to install and configure GlassFish on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with
sudo privileges. All the commands in this tutorial should be run as a non-root user.
GlassFish is a fully-fledged open-source reference implementation of Java EE application server for developing and deploying Java-based applications. It supports JPA, JSF, JSP/Servlet, JMS, RMI, as well as many other Java-based technologies. It also provides both web and CLI-based administration consoles for easier configuration and management of your Java applications and their respective components.
Install GlassFish on Ubuntu 20.04
Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.
sudo apt update sudo apt upgrade
Step 2. Install Java.
GlassFish is powered by Java, it must be installed and configured on your Ubuntu server first. Run the following commands to install the OpenJDK 8 JDK package:
sudo apt install openjdk-8-jdk
Verify the installation:
Now we need to append the Java location to our environment file. Modify the path accordingly based on your Java path:
For changes to take effect on your current shell you can either log out and log in or run the following source command:
Finally, steps, verify that the JAVA_HOME environment variable was correctly set:
Step 3. Install GlassFish on the Ubuntu system.
Now download the latest nightly build version of GlassFish from their official GlassFish website:
Next, extract the files to the current directory:
sudo unzip latest-glassfish.zip
Step 4. Setting Up GlassFish Service.
systemd for GlassFish:
sudo nano /etc/systemd/system/glassfish.service
Add the following lines:
[Unit] Description = GlassFish Server v5.0 After = syslog.target network.target [Service] ExecStart=/opt/glassfish5/bin/asadmin start-domain ExecReload=/opt/glassfish5/bin/asadmin restart-domain ExecStop=/opt/glassfish5/bin/asadmin stop-domain Type = forking [Install] WantedBy = multi-user.target
Save and exit. Now we need to reload system services:
sudo systemctl daemon-reload sudo systemctl enable glassfish sudo systemctl start glassfish
Step 5. Accessing GlassFish.
After successfully installed, Open the browser and point to the URL
http://your-ip-address:4848 to check the homepage of GlassFish Server.
Open the browser and point to the URL http://your-ip-address:4848 / to check the homepage of GlassFish Server.
That’s all you need to do to install GlassFish on Ubuntu 20.04 LTS Focal Fossa. I hope you find this quick tip helpful. For further reading on GlassFish, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.