How to Install GlassFish on Ubuntu 24.04 LTS (Step-by-Step Guide)
If you are working with Java enterprise applications, having a reliable application server is essential. GlassFish is a popular open-source application server that supports Jakarta EE (formerly Java EE) and is widely used for developing and deploying enterprise-grade applications.
In this guide, you will learn how to install GlassFish on Ubuntu 24.04 LTS step by step. This tutorial is beginner-friendly and suitable for developers, system administrators, and DevOps engineers.
What is GlassFish?
GlassFish is an open-source application server developed under the Eclipse Foundation. It provides a complete platform for deploying Java-based applications using Jakarta EE technologies. The introduction about GlassFish has been discussed on What is GlassFish article.
Key advantages of GlassFish:
- Full Jakarta EE support
- Lightweight and developer-friendly
- Built-in admin console
- Easy deployment of applications
- Open-source and extensible
Prerequisites
Before installing GlassFish, make sure your system meets the following requirements:
- Ubuntu 24.04 LTS server
- Root or sudo access
- Internet connection
- Minimum 2 GB RAM recommended
Step 1: Update System Packages
Start by updating your system to ensure all packages are up to date.
sudo apt update && sudo apt upgrade -y
Step 2: Install Java (OpenJDK)
GlassFish requires Java to run. Install OpenJDK (recommended version 11 or later).
sudo apt install openjdk-17-jdk -y
Verify the installation:
java -version
You should see output indicating Java 17 is installed.
Step 3: Download GlassFish
Go to the official GlassFish download page or use wget to download the latest version.
wget https://download.eclipse.org/ee4j/glassfish/glassfish-7.0.12.zip
Note: Replace the version if a newer release is available.
Step 4: Install Unzip Utility
If unzip is not installed, install it:
sudo apt install unzip -y
Step 5: Extract GlassFish
Extract the downloaded archive:
unzip glassfish-7.0.12.zip
Move it to /opt directory:
sudo mv glassfish7 /opt/glassfish
Step 6: Set Environment Variables
Set the GlassFish environment variables for easier management.
echo "export GLASSFISH_HOME=/opt/glassfish" >> ~/.bashrc
echo "export PATH=\$PATH:\$GLASSFISH_HOME/bin" >> ~/.bashrc
source ~/.bashrc
Step 7: Start GlassFish Server
Navigate to the GlassFish bin directory and start the domain.
cd /opt/glassfish/bin
./asadmin start-domain
If successful, you will see a message indicating the domain has started.
Step 8: Access GlassFish Admin Console
Open your browser and access:
http://your-server-ip:4848
Default:
- Username: admin
- Password: (leave empty, unless configured)
You can now manage your server via the web interface.
Step 9: Enable Secure Admin (Optional but Recommended)
For security, enable secure admin and set a password.
./asadmin change-admin-password
./asadmin enable-secure-admin
./asadmin restart-domain
Step 10: Configure Firewall (Optional)
Allow GlassFish ports if you are using UFW:
sudo ufw allow 8080
sudo ufw allow 4848
sudo ufw reload
Step 11: Test GlassFish Installation
Access the default application page:
http://your-server-ip:8080
If you see the GlassFish welcome page, your installation is successful.
How to Deploy an Application
To deploy a WAR file:
./asadmin deploy /path/to/your-app.war
Or upload via the Admin Console.
Common Commands
Start server:
./asadmin start-domain
Stop server:
./asadmin stop-domain
Restart server:
./asadmin restart-domain
Best Practices
- Always use a secure admin password
- Keep GlassFish updated
- Use HTTPS for production
- Monitor logs in
/opt/glassfish/domains/domain1/logs - Backup configuration regularly
Troubleshooting Tips
GlassFish not starting?
Check logs:
cat /opt/glassfish/domains/domain1/logs/server.log
Port already in use?
Change port in configuration or stop conflicting services.
Permission issues?
Ensure correct ownership:
sudo chown -R $USER:$USER /opt/glassfish
Conclusion
Installing GlassFish on Ubuntu 24.04 LTS is straightforward and provides a powerful platform for running Jakarta EE applications. With its robust features and ease of use, GlassFish remains a strong choice for developers and enterprises.
By following this guide, you now have a fully functional GlassFish server ready for deploying Java applications.
FAQ
What Java version is required for GlassFish?
GlassFish 7 typically requires Java 11 or newer (Java 17 recommended).
Is GlassFish production-ready?
Yes, GlassFish supports enterprise applications, but some prefer Payara for extended support.
Can I run GlassFish with Docker?
Yes, GlassFish can be deployed using Docker containers.
What port does GlassFish use?
Default ports are 8080 (HTTP) and 4848 (Admin Console).











