[LINUX] How to install Eclipse GlassFish 5.1.0 on CentOS 7

Here are the steps to install Eclipse GlassFish 5.1.0 on CentOS 7.

1. Environment

[email protected] ~]# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
[[email protected] ~]#


[[email protected] ~]# rpm -ivh jdk-8u241-linux-x64.rpm
warning: jdk-8u241-linux-x64.rpm:Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing...              ################################# [100%]
Updating/During installation...
   1:jdk1.8-2000:1.8.0_241-fcs        ################################# [100%]
Unpacking JAR files...
[[email protected] ~]#

2. Download Eclipse GlassFish 5.1.0

Download glassfish-5.1.0.zip with the following command. (Or download from Download Site.)

curl -OL http://mirror.kakao.com/eclipse/glassfish/glassfish-5.1.0.zip

Execution result

[[email protected] ~]# curl -OL http://mirror.kakao.com/eclipse/glassfish/glassfish-5.1.0.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  111M  100  111M    0     0   292k      0  0:06:31  0:06:31 --:--:--  302k
[[email protected] ~]#

The hash value of the file downloaded by the following command is the same as the value of Download site Make sure there is.

sha512sum glassfish-5.1.0.zip

Execution result

[[email protected] ~]# sha512sum glassfish-5.1.0.zip
10d99061319178d65e8f8604f41caaca2ea561cbdc426d0fdf6163ead549e9c63c154c6ff648133a5b37bec14940a48b7c893544fa19f900a8c62273e445ed14  glassfish-5.1.0.zip
[[email protected] ~]#



3. Unzip glassfish-5.1.0.zip

Unzip glassfish-5.1.0.zip under / opt with the following command.

unzip -d /opt glassfish-5.1.0.zip

Execution result

[[email protected] ~]# unzip -d /opt glassfish-5.1.0.zip
Archive:  glassfish-5.1.0.zip
   creating: /opt/glassfish5/
   creating: /opt/glassfish5/glassfish/
   creating: /opt/glassfish5/glassfish/domains/
   creating: /opt/glassfish5/glassfish/domains/domain1/
   creating: /opt/glassfish5/glassfish/domains/domain1/config/
  inflating: /opt/glassfish5/glassfish/domains/domain1/config/admin-keyfile

~~~ Omitted ~~~

  inflating: /opt/glassfish5/mq/lib/props/broker/default.properties
  inflating: /opt/glassfish5/mq/lib/props/broker/install.properties
  inflating: /opt/glassfish5/mq/lib/tyrus-standalone-client.jar
[[email protected] ~]# cd /opt
[[email protected] opt]# ls -l
Total 0
drwxr-xr-x.7 root root 92 January 28 2019 glassfish5
[[email protected] opt]#

4. Create glassfish user

Create a "glassfish" user with the following command. (Password is also "glassfish")

useradd -p $(perl -e 'print crypt("glassfish", "\$6\$salt03")') glassfish

Execution result

[[email protected] opt]# useradd -p $(perl -e 'print crypt("glassfish", "\$6\$salt03")') glassfish
[[email protected] opt]#

5. Change owner and group

Change the owner and group of the glassfish5 directory to glassfish with the following command.

chown -R glassfish:glassfish glassfish5

Execution result

[[email protected] opt]# chown -R glassfish:glassfish glassfish5
[[email protected] opt]# ls -l
Total 0
drwxr-xr-x.7 glassfish glassfish 92 January 28 2019 glassfish5
[[email protected] opt]#

6. Modify asenv.conf

On the last line of /opt/glassfish5/glassfish/config/asenv.conf AS_JAVA="/usr/java/jdk1.8.0_241-amd64" To add.


# Copyright (c) 2004, 2018 Oracle and/or its affiliates. All rights reserved.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0, which is available at
# http://www.eclipse.org/legal/epl-2.0.
# This Source Code may also be made available under the following Secondary
# Licenses when the conditions for such availability set forth in the
# Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
# version 2 with the GNU Classpath Exception, which is available at
# https://www.gnu.org/software/classpath/license.html.
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0

#                       * * *    N O T E     * * *
# Although the lines in this file are formatted as environment
# variable assignments, this file is NOT typically invoked as a script
# from another script to define these variables.  Rather, this file is read
# and processed by a server as it starts up.  That scanning code resolves
# the relative paths against the GlassFish installation directory.
# Yet, this file is also where users of earlier versions have sometimes added
# a definition of AS_JAVA to control which version of Java GlassFish
# should use.  As a result, in order to run a user-specified version of Java,
# the asadmin and appclient scripts do indeed invoke this file as a
# script - but ONLY to define AS_JAVA.  Any calling script should not
# rely on the other settings because the relative paths will be resolved
# against the current directory when the calling script is run, not the
# installation directory of GlassFish, and such resolution will not work
# correctly unless the script happens to be run from the GlassFish installation
# directory.


7. Firewall settings

Create the following glassfish.xml under / usr / lib / firewalld / services.


<?xml version="1.0" encoding="utf-8"?>
  <description>GlassFish Server</description>
  <port protocol="tcp" port="4848"/>
  <port protocol="tcp" port="8080"/>
  <port protocol="tcp" port="8181"/>

Set the firewall to pass through the port set in glassfish.xml with the following command.

firewall-cmd --permanent --add-service=glassfish

Execution result

[[email protected] services]# firewall-cmd --permanent --add-service=glassfish
[[email protected] services]#

Restart firewalld with the following command.

systemctl restart firewalld.service

Execution result

[[email protected] services]# systemctl restart firewalld.service
[[email protected] services]#

Confirm that glassfish is added to services with the following command.

firewall-cmd --list-all

Execution result

[[email protected] services]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: enp0s3
  services: dhcpv6-client glassfish http ssh
  ports: 8888/tcp
  masquerade: no
  rich rules:

[[email protected] services]#

8. Start glassfish

Switch to the glassfish user with the following command.

su - glassfish

Execution result

[[email protected] services]# su - glassfish
Last login: 2020/03/19 (wood) 23:39:44 JST date and time pts/0
[[email protected] ~]$

The commands to start, stop, and restart glassfish are as follows.

Start: / opt / glassfish5 / glassfish / bin / asadmin start-domain Stop: / opt / glassfish5 / glassfish / bin / asadmin stop-domain Reboot: / opt / glassfish5 / glassfish / bin / asadmin restart-domain

Start glassfish.

Execution result

[[email protected] ~]$ /opt/glassfish5/glassfish/bin/asadmin start-domain
Waiting for domain1 to start .......
Successfully started the domain : domain1
domain  Location: /opt/glassfish5/glassfish/domains/domain1
Log File: /opt/glassfish5/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.
[[email protected] ~]$

9. Check connection

Connect from your browser with the following URL.

http: // <server IP address>: 8080 /

The connection is OK when the following screen opens.


10. Management screen settings

Connect to the management screen from the browser with the following URL.

http: // <server IP address>: 4848 /


If you get an error, set the following:

Set the password for the admin user.

/opt/glassfish5/glassfish/bin/asadmin change-admin-password

Execution result

[[email protected] ~]$ /opt/glassfish5/glassfish/bin/asadmin change-admin-password
Enter admin user name [default: admin]>(As is)
Enter the admin password>(As is)
Enter the new admin password>admin
Enter the new admin password again>admin
Command change-admin-password executed successfully.
[[email protected] ~]$

Enable enable-secure-admin with the following command.

/opt/glassfish5/glassfish/bin/asadmin --host localhost --port 4848 enable-secure-admin

Execution result

[[email protected] ~]$ /opt/glassfish5/glassfish/bin/asadmin --host localhost --port 4848 enable-secure-admin
Enter admin user name>  admin
Enter admin password for user "admin">
You must restart all running servers for the change in secure admin to take effect.
Command enable-secure-admin executed successfully.
[[email protected] ~]$

Restart glassfish.

/opt/glassfish5/glassfish/bin/asadmin restart-domain

Execution result

[[email protected] ~]$ /opt/glassfish5/glassfish/bin/asadmin restart-domain
Successfully restarted the domain
Command restart-domain executed successfully.
[[email protected] ~]$

Connect to the management screen from the browser again with the following URL.

http: // <server IP address>: 4848 /


Log in with the set administrative user / password (admin / admin).


I was able to log in to the management screen.

11. Create systemd service file

Create the following glassfish.service under / usr / lib / systemd / system.


Description=GlassFish Server v5.1
After=syslog.target network.target remote-fs.target

ExecStart=/opt/glassfish5/glassfish/bin/asadmin start-domain
ExecStop=/opt/glassfish5/glassfish/bin/asadmin stop-domain
ExecReload=/opt/glassfish5/glassfish/bin/asadmin restart-domain


The start, stop, and restart with the systemctl command are as follows.

Start: systemctl start glassfish Stop: systemctl stop glassfish Reboot: systemctl restart glassfish


Eclipse GlassFish | projects.eclipse.org

Error information

This time I installed and ran jdk-8u241 as java.

However, with jdk14, the following error occurred and it could not be executed.

Execution result

[[email protected] ~]$ /opt/glassfish5/glassfish/bin/asadmin start-domain
Exception in thread "main" java.lang.NullPointerException
        at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.initializeServiceLocator(AbstractModulesRegistryImpl.java:128)
        at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.newServiceLocator(AbstractModulesRegistryImpl.java:120)
        at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.createServiceLocator(AbstractModulesRegistryImpl.java:194)
        at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.createServiceLocator(AbstractModulesRegistryImpl.java:200)
        at com.sun.enterprise.module.single.StaticModulesRegistry.createServiceLocator(StaticModulesRegistry.java:64)
        at com.sun.enterprise.admin.cli.CLIContainer.getServiceLocator(CLIContainer.java:193)
        at com.sun.enterprise.admin.cli.CLIContainer.getLocalCommand(CLIContainer.java:231)
        at com.sun.enterprise.admin.cli.CLICommand.getCommand(CLICommand.java:207)
        at com.sun.enterprise.admin.cli.AdminMain.executeCommand(AdminMain.java:347)
        at com.sun.enterprise.admin.cli.AdminMain.doMain(AdminMain.java:282)
        at org.glassfish.admin.cli.AsadminMain.main(AsadminMain.java:33)
[[email protected] ~]$

that's all

Recommended Posts

How to install Eclipse GlassFish 5.1.0 on CentOS 7
How to install PyPy on CentOS
How to install TensorFlow on CentOS 7
How to install Maven on CentOS
How to install Apache (httpd) on CentOS7
How to install Apache (httpd) on CentOS8
How to install Git GUI and Gitk on CentOS
How to install mysql-connector-python on mac
Steps to install VirtualBox on CentOS
How to install graph-tool on macOS
How to install VMware-Tools on Linux
How to install pycrypto on Windows
How to install OpenCV on Mac
How to install Go on Ubuntu
How to install music 21 on windows
How to install Python2.7 python3.5 with pyenv (on RHEL5 CentOS5) (2016 Nov)
How to install aws-session-manager-plugin on Manajro Linux
[Kivy] How to install Kivy on Windows [Python]
How to install packages on Alpine Linux
How to switch mouse operations on CentOS
How to install richzhang / colorization on Windows 10
How to install php7.4 on Linux (Ubuntu)
How to install NumPy on Raspberry Pi
How to install cx_Oracle on macOS Sierra
How to install python3 with docker centos
How to install Python
How to install pip
How to install archlinux
Install numba on CentOS 7.2
How to install python
Install Python3.4 on CentOS 6.6
How to install BayesOpt
Install mecab-python on CentOS
Install Python 2.7.3 on CentOS 5.4
How to install Nbextensions
How to install Prover9
Install awscli on centos7
Install Chainer on CentOS 6.7
[2020 version] How to install Python3 on AWS EC2
How to install OpenCV on Jetson Nano Python
How to quickly install h5py on Windows 10 [Unofficial]
How to install OpenGM on OSX with macports
How to install Camunda Modeler on Manjaro Linux
[Python] How to install OpenCV on Anaconda [Windows]
How to install / verify graphviz on anaconda / windows10
[2020.8 latest] How to install Python
How to install Python [Windows]
Tabpy 1.0 (2020-01 version) How to install
Install ImageMagick-6.2.x series on CentOS7.7
How to install Linux on a 32bit UEFI PC
Install Python 3.8 on CentOS 7 (SCL)
How to register on pypi
How to install mkl numpy
Install Chrome on CentOS 7 series
[AWS EC2] How to install Maven on Amazon Linux 2
Install Python 3.8 on CentOS 8 (AppStream)
How to install Pelican blog
How to install git on Linux such as EC2
How to install Theano on Mac OS X with homebrew
How to install python using anaconda
Steps to deploy EMLauncher on CentOS 8