安装、部署Glassfish
GlassFish 是一款强健的商业兼容应用服务器,达到产品级质量,可免费用于开发、部署和重新分发。
环境:CentOS 7.2
步骤:
一、部署JDK环境
#tar zxf jdk-8u91-linux-x64.tar.gz && rm -rf jdk-8u91-linux-x64.tar.gz
#mv jdk1.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
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
二、安装Glassfish
#unzip glassfish-4.1.1.zip
#mv glassfish4/ /usr/local/glassfish
#cd /usr/local/glassfish/glassfish/bin
启动Glassfish(必须保证/etc/hosts中添加了hostname和ip 对应记录)
#./startserv &
#netstat -anput |grep java
tcp6 0 0 :::8686 :::* LISTEN 12826/java
tcp6 0 0 :::4848 :::* LISTEN 12826/java
tcp6 0 0 :::8080 :::* LISTEN 12826/java
tcp6 0 0 :::3700 :::* LISTEN 12826/java
tcp6 0 0 :::8181 :::* LISTEN 12826/java
tcp6 0 0 :::7676 :::* LISTEN 12826/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/
#./asadmin change-admin-password
Enter admin user name [default: admin]>
Enter the admin password>
Enter the new admin password>
Enter the new admin password again>
Command change-admin-password executed successfully.
开启远程访问
#./asadmin 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.
重启服务
#./stopserv
Command stop-domain executed successfully.
#./startserv
重启服务后,可以使用上面创建的账号远程连接控制台
https://hostname:4848 或 server ip:4848
部署一个简单应用
部署成功后,可以登录http://hostname:8080/hello 访问