How to Install GlassFish on Ubuntu 22.04

Install GlassFish on Ubuntu 22.04

In this article, we will have explained the necessary steps to install GlassFish on Ubuntu 22.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 an open-source Jakarta EE platform application server. It was initially developed by Sun Microsystems, then sponsored by Oracle Corporation, and now it is being maintained by the developers at Eclipse Foundation. It comes under two free software licenses Common Development and Distribution License and GNU General Public License.


  • Operating System with Ubuntu 22.04
  • Server IPv4 Address with Superuser Privileges (Root Access)
  • Gnome Terminal for Linux Desktop
  • PuTTy SSH client for Windows or macOS
  • Powershell for Windows 10/11
  • Familiar with APT Commands

Install GlassFish on Ubuntu 22.04 LTS

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
sudo apt install software-properties-common apt-transport-https wget ca-certificates gnupg2 ubuntu-keyring unzip

Step 2. Install Java.

Now we run the following command run the below-given command to install Java to your Linux system:

sudo apt install default-jdk

Once installed, we can check the version using this command:

java --version

Step 3. Install GlassFish Database on Ubuntu Linux.

Installing GlassFish on your Ubuntu 22.04 Jammy Jellyfish system is straightforward, Use the following command to download the Glassfish from their official download page:

wget -O

Once downloading the file, we need to extract it to /opt/glassfish6 and change the directory and file permission:

unzip /opt/ -d /opt
chown -R glassfish: /opt/glassfish6

Step 4. Create Systemd File.

We need to create a systemd file to manage the FlassFish service:

nano /etc/systemd/system/glassfish.service

Add the following file:

Description = GlassFish Server v6
After =

ExecStart=/opt/glassfish6/bin/asadmin start-domain
ExecReload=/opt/glassfish6/bin/asadmin restart-domain
ExecStop=/opt/glassfish6/bin/asadmin stop-domain
Type = forking

WantedBy =

Save the file and reload systemctl every time we create or modify a systemd file:

sudo systemctl daemon-reload
sudo systemctl start glassfish

Step 5. Set password for Glassfish and Enable Secure Login.

We need to configure the admin user password and enable secure admin access:

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

Then, enable the secure admin feature to be able to log in to ip:4848 in your web browser.

/opt/glassfish6/bin/asadmin --port 4848 enable-secure-admin

Next, restart the Glassfish service to apply the changes:

sudo systemctl restart glassfish

Step 6. Accessing GlassFish Web UI.

After successfully installed, now we open the browser and point to the URL http://your-ip-address:8080 to check the homepage of GlassFish Server.

Install GlassFish on Ubuntu 22.04 LTS

To access the Glassfish admin interface type the URL http://your-server-ip:4848. You will be redirected to the Glassfish login page:

Install GlassFish on Ubuntu 22.04 LTS

That’s all you need to do to install GlassFish on Ubuntu 22.04 LTS Jammy Jellyfish. I hope you find this quick tip helpful. For further reading on the installation of the GlassFish, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.