Install and deploy Glassfish in CentOS 7
GlassFish is a robust business-compatible application server that delivers product-level quality and is free for development, deployment, and redistribution.
Environment: CentOS7.2
Steps:
1. Deploy the JDK Environment
Bytes
# Mvjdk1.8.0 _ 91 // usr/local/jdk
# Vim/etc/profile. d/java. sh
# Cat/etc/profile. d/java. sh
JAVA_HOME =/usr/local/jdk
JAVA_BIN = $ JAVA_HOME/bin
JRE_HOME = $ JAVA_HOME/jre
PATH = $ PATH: $ JAVA_HOME/bin: $ JAVA_HOME/jre/bin
CLASSPATH = $ JAVA_HOME/jre/lib: $ JAVA_HOME/jre/lib/charsets. jar
# Source/etc/profile. d/java. sh
# Java-version
Javaversion "1.8.0 _ 91"
Java (TM) SERuntimeEnvironment (build1.8.0 _ 91-b14)
JavaHotSpot (TM) 64-BitServerVM (build25.91-b14, mixedmode)
Ii. Install Glassfish
#Unzipglassfish-4.1.1.zip
# Mvglassfish4 // usr/local/glassfish
# Cd/usr/local/glassfish/bin
Start Glassfish (ensure that the hostname and ip corresponding records are added to/etc/hosts)
#./Startserv &
# Netstat-anput | grepjava
Tcp600: 8686: * LISTEN12826/java
Tcp600: 4848: * LISTEN12826/java
Tcp600: 8080: * LISTEN12826/java
Tcp600: 3700: * LISTEN12826/java
Tcp600: 8181: * LISTEN12826/java
Tcp600: 7676: * LISTEN12826/java
Open firewall port
# Firewall-cmd -- zone = public -- add-port = 8686/tcp -- permanent
# Firewall-cmd -- zone = public -- add-port = 4848/tcp -- permanent
# Firewall-cmd -- zone = public -- add-port = 8080/tcp -- permanent
# Firewall-cmd -- zone = public -- add-port = 3700/tcp -- permanent
# Firewall-cmd -- zone = public -- add-port = 8181/tcp -- permanent
# Firewall-cmd -- zone = public -- add-port = 7676/tcp -- permanent
# Firewall-cmd -- reload
Set the Administrator account and password
# Cd/usr/local/glassfish/bin/
#./Asadminchange-admin-password
Enteradminusername [default: admin]>
Entertheadminpassword>
Enterthenewadminpassword>
Enterthenewadminpasswordagain>
Commandchange-admin-passwordexecutedsuccessfully.
Enable remote access
#./Asadminenable-secure-admin
Enteradminusername> admin
Enteradminpasswordforuser "admin">
Youmustrestartallrunningserversforthechangeinsecureadmintotakeeffect.
Commandenable-secure-adminexecutedsuccessfully.
Restart service
#./Stopserv
Commandstop-domainexecutedsuccessfully.
#./Startserv
After restarting the service, you can use the account created above to remotely connect to the console
Https: // hostname: 4848 or serverip: 4848
Deploy a simple application
After the deployment is successful, you can log on to http: // hostname: 8080/hello for access.