GlassFish是一款強健的商業兼容應用服務器,達到產品級質量,可免費用於開發、部署和重新分發。
環境:CentOS7.2
步驟:
一、部署JDK環境
#tarzxfjdk-8u91-linux-x64.tar.gz&&rm-rfjdk-8u91-linux-x64.tar.gz
#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/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)
二、安裝Glassfish
#unzipglassfish-4.1.1.zip
#mvglassfish4//usr/local/glassfish
#cd/usr/local/glassfish/glassfish/bin
啟動Glassfish(必須保證/etc/hosts中添加了hostname和ip對應記錄)
#./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
開放防火牆端口
#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
設置管理員賬號和口令
#cd/usr/local/glassfish/glassfish/bin/
#./asadminchange-admin-password
Enteradminusername[default:admin]>
Entertheadminpassword>
Enterthenewadminpassword>
Enterthenewadminpasswordagain>
Commandchange-admin-passwordexecutedsuccessfully.
開啟遠程訪問
#./asadminenable-secure-admin
Enteradminusername>admin
Enteradminpasswordforuser"admin">
Youmustrestartallrunningserversforthechangeinsecureadmintotakeeffect.
Commandenable-secure-adminexecutedsuccessfully.
重啟服務
#./stopserv
Commandstop-domainexecutedsuccessfully.
#./startserv
重啟服務後,可以使用上面創建的賬號遠程連接控制台
https://hostname:4848或serverip:4848
部署一個簡單應用
部署成功後,可以登錄http://hostname:8080/hello訪問
本文出自 “10319031” 博客,請務必保留此出處http://10329031.blog.51cto.com/10319031/1769068
http://xxxxxx/Linuxjc/1134332.html TechArticle