In this tutorial, we will show you how to install GlassFish on Fedora 38. In the realm of web application development, the utilization of robust and efficient servers is paramount. GlassFish, an exemplary Java EE application server, has earned its reputation as a stalwart in deploying and managing Java applications.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of GlassFish on a Fedora 38.
- A server running one of the following operating systems: Fedora 38.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for GlassFish.
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Install GlassFish on Fedora 38
Step 1. Before we can install GlassFish on Fedora 38, it’s important to ensure that our system is up-to-date with the latest packages. This will ensure that we have access to the latest features and bug fixes and that we can install GlassFish without any issues:
sudo dnf update sudo dnf install dnf-plugins-core
Step 2. Installing Java Development Kit (JDK)
GlassFish thrives on Java, so installing the Java Development Kit (JDK) is non-negotiable. To do so, embrace the power of the terminal:
sudo dnf install java-11-openjdk-devel
After the Java installation, you can verify the Java version using the following command:
Step 3. Installing GlassFish on Fedora 38.
First, create a dedicated user to run GlassFish:
useradd -m -d /opt/glassfish6 -U -s /bin/false glassfish
Navigate to the official GlassFish website to find the latest version of GlassFish. Use
wget to download the package:
Extract the downloaded package and move it to the desired installation location:
unzip glassfish-7.0.7.zip sudo mv glassfish7 /opt/glassfish
Change the ownership of the Glassfish directory:
chown -R glassfish:glassfish /opt/glassfish
Step 4. Create a Systemd Service File.
Now create a
systemd service file to manage the GlassFish service via
Add the following file:
[Unit] Description = GlassFish Server v7 After = syslog.target network.target [Service] User=glassfish ExecStart=/opt/glassfish/bin/asadmin start-domain ExecReload=/opt/glassfish/bin/asadmin restart-domain ExecStop=/opt/glassfish/bin/asadmin stop-domain Type = forking [Install] WantedBy = multi-user.target
Save and close the file, then reload the
systemd daemon to apply the changes:
sudo systemctl daemon-reload sudo systemctl start glassfish sudo systemctl enable glassfish
Step 5. Setup GlassFish Admin Password.
By default, the GlassFish default admin password is not set, so you will need to set it before login GlassFish via a web browser. You can set the admin password using the following command:
sudo -u glassfish /opt/glassfish/bin/asadmin --port 4848 change-admin-password
By default, GlassFish web-based login is disabled, so you will also need to enable it via the command line:
sudo -u glassfish /opt/glassfish/bin/asadmin --port 4848 enable-secure-admin
Finally, restart the GlassFish service to apply the changes:
sudo systemctl restart glassfish
Step 6. Accessing GlassFish Web Interface.
Open your web browser and access the GlassFish Admin Console using the URL:
http://localhost:4848. If the console loads successfully, your installation is operational.
Step 7. Troubleshooting Common Issues.
- Port Conflict: If port 4848 is already in use, you can change the port by modifying the GlassFish domain’s configuration.
- Permissions: Ensure proper permissions for the GlassFish directory and domain files.
- Java Version: Make sure you’re using a compatible version of Java (OpenJDK 11 in this case).
Congratulations! You have successfully installed GlassFish. Thanks for using this tutorial for installing GlassFish on your Fedora 38 system. For additional help or useful information, we recommend you check the official GlassFish website.