How to Install GlassFish on Ubuntu 18.04 Bionic Beaver

Install GlassFish on Ubuntu

In this article, we will have explained the necessary steps to install and configure GlassFish on Ubuntu 18.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 application server project started by Sun Microsystems for the Java EE platform and is now sponsored by Oracle Corporation. The supported version is called Oracle GlassFish Server.


  • Operating System with Ubuntu 18.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

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.

Add the PPA for installing Java by running the following command:

add-apt-repository ppa:webupd8team/java

Run the following command to install the oracle packages:

apt update
apt install oracle-java8-installer

Once the installation is done, Set the environment variable:

nano /etc/environment
JAVA_HOME=" /usr/lib/jvm/java-8-oracle"

Then reload the file:

source /etc/environment

Step 3. Install GlassFish on Ubuntu 18.04 LTS.

First download the glassfish server package:

wget -d /opt/

To setup PATH variable for GlassFish, open and edit the ” ~/.profile” file as shown below:

nano ~/.profile
export PATH=/opt/glassfish4/bin:$PATH

Reload the file by using the following command:

source ~/.profile

Step 4. Run GlassFish.

You can easily start your GlassFish 5 by using the following command:

asadmin start-domain

Now to set the password for the application by using the following command:

asadmin change-admin-password

To access the administration panel remotely, use the following command:

asadmin enable-secure-admin

After setting the administrative panel, restart the domain:

asadmin restart-domain

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 18.04. I hope you find this quick tip helpful. If you have questions or suggestions, feel free to leave a comment below.