Ubuntu Linux

Install GlassFish Server on Ubuntu: Quick Guide

Richard
Written by
Richard
May 30, 2022 Updated Apr 18, 2026 2 min read
Install GlassFish Server on Ubuntu: Quick Guide

This guide shows you how to install the GlassFish server on Ubuntu in 2026. GlassFish is a popular tool for running Java-based web applications. Why use it? It provides a simple way to manage and deploy your code on a server. What happens when done? You will have a fully functional application server ready to host your Java projects.

Install OpenJDK

GlassFish needs Java to run. For the best security and performance in 2026, we use OpenJDK 21. Open the terminal and run these commands:

sudo apt update
sudo apt install openjdk-21-jdk

Check the installation by typing: java –version

Download and extract GlassFish

Now, download the latest stable version of GlassFish. We will extract it to the /opt directory.

wget https://download.eclipse.org/ee4j/glassfish/glassfish-8.0.0.zip
sudo unzip glassfish-8.0.0.zip -d /opt/

Systemd configuration

For security, you should not run GlassFish as the root user. We will create a dedicated system user and group to run the service with limited permissions.

sudo groupadd glassfish
sudo useradd -s /bin/false -g glassfish -d /opt/glassfish8 glassfish
sudo chown -R glassfish:glassfish /opt/glassfish8

Next, create a service file to manage GlassFish automatically:

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

Paste these lines into the file:

[Unit]
Description=GlassFish Server v8.0.0
After=syslog.target network.target
[Service]
User=glassfish
Group=glassfish
ExecStart=/usr/bin/java -jar /opt/glassfish8/glassfish/lib/client/appserver-cli.jar start-domain
ExecStop=/usr/bin/java -jar /opt/glassfish8/glassfish/lib/client/appserver-cli.jar stop-domain
Type=forking
[Install]
WantedBy=multi-user.target

Save and close the file. Reload the system settings and start the service:

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

Administrative user password

By default, the admin account has no password. You must set one for security. Run this command:

sudo /opt/glassfish8/bin/asadmin change-admin-password

Follow the prompts to set your new password. After that, enable the secure admin listener so you can manage the server safely over the network:

sudo /opt/glassfish8/bin/asadmin enable-secure-admin

Restart the service to apply these changes:

sudo systemctl restart glassfish

Access the console

Open your web browser and go to https://localhost:4848. You will see the GlassFish admin console. Log in with your new credentials.

GlassFish admin login console on Ubuntu

Once you are logged in, you will see the main dashboard.

GlassFish administration console interface on Ubuntu

You can learn more about Java environments at OpenJDK on Ubuntu Linux. If you want to put a professional web server in front of GlassFish, check out these guides for Nginx or Apache: How to set up a reverse proxy server with Nginx How to set up a reverse proxy server with Apache.

[Unit] [Service] [Install] [1] [5111] [5111] [default: admin]

Was this guide helpful?

Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, the owner and lead writer at Geek Rewind, is a tech enthusiast passionate about simplifying complex IT topics. His years of hands-on experience in system administration and enterprise IT operations have honed his ability to provide practical insights and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

2458 articles → Twitter

📚 Related Tutorials

How to Install wkhtmltopdf & wkhtmltoimage on Ubuntu Linux
Ubuntu Linux How to Install wkhtmltopdf & wkhtmltoimage on Ubuntu Linux
How to Install TeamViewer via Command Line on Ubuntu
Ubuntu Linux How to Install TeamViewer via Command Line on Ubuntu
Set Up SFTP with Chroot on Ubuntu 24.04
Ubuntu Linux Set Up SFTP with Chroot on Ubuntu 24.04
Set Up Nginx Basic Authentication in Ubuntu 24.04
Ubuntu Linux Set Up Nginx Basic Authentication in Ubuntu 24.04

Leave a Reply

Your email address will not be published. Required fields are marked *