CentOS 6.5上安装GlassFish4.0 过程笔记
1.安装JDK, 注意操作系统的位数, 64 or 32:
[[email protected] ~]# mkdir /usr/java
[[email protected] ~]# cd /usr/java
[[email protected] java]#rpm -Uvh /bak/jdk-7u55-linux-x64.rpm
[[email protected] java]# JAVA_HOME=/usr/java/jdk1.7.0_55
[[email protected] java]# export JAVA_HOME
[[email protected] java]# PATH=$JAVA_HOME/bin:$PATH
[[email protected] java]# export PATH
[[email protected] java]# vi /etc/profile
JAVA_HOME=/usr/java/jdk1.7.0_55
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
[[email protected] java]# source /etc/profile
[[email protected] ~]# echo $JAVA_HOME
/usr/java/jdk1.7.0_55
2. 下载并安装glassfish 4, ml多语言版
[[email protected] ~]# mv glassfish-4.0-ml.zip /usr/share/glassfish-4.0-ml.zip
[[email protected] ~]# cd /usr/share
[[email protected] share]# unzip -q glassfish-4.0-ml.zip
[[email protected] share]# groupadd webserver
[[email protected] share]# useradd -m -g webserver -G webserver webapp
[[email protected] share]# id webapp
[[email protected] share]# passwd webapp
[[email protected] share]# chown -R webapp:webserve /user/share/glassfish4
3. 将运行的glassfish 设置为服务
[[email protected] ~]# cd /etc/init.d
[[email protected] init.d]# vi glassfish
#!/bin/bash
# description: Glassfish Start Stop Restart
# processname: glassfish
# chkconfig: 234 20 80
JAVA_HOME=/usr/java/jdk1.7.0_55
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
GLASSFISH_HOME=/usr/share/glassfish4/glassfish
case $1 in
start)
sh $GLASSFISH_HOME/bin/asadmin start-domain domain1
;;
stop)
sh $GLASSFISH_HOME/bin/asadmin stop-domain domain1
;;
restart)
sh $GLASSFISH_HOME/bin/asadmin stop-domain domain1
sh $GLASSFISH_HOME/bin/asadmin start-domain domain1
;;
esac
exit 0
[[email protected] init.d]# chmod 755 glassfish
[[email protected] init.d]# chkconfig --add glassfish
[[email protected] init.d]# chkconfig --level 234 glassfish on
4. 启动glassfish
[[email protected] init.d]# service glassfish start
Waiting for domain1 to start .........
Successfully started the domain : domain1
domain Location: /usr/share/glassfish4/glassfish/domains/domain1
Log File: /usr/share/glassfish4/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.
5. 修改管理员admin帐户密码
[[email protected] init.d]#cd /usr/share/glassfish4/glassfish/bin
[[email protected] bin]#./asadmin change-admin-password
6. 设置远程访问
[[email protected] bin]#./asadmin --host 192.168.1.114 --port 4848 enable-secure-admin
7. 重启glassfish
[[email protected] ~]#service glassfish restart
8. 如果访问不到,注意开启防火墙4848、80端口
[[email protected] ~]#vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 4848 -j ACCEPT
[[email protected] ~]#/etc/init.d/iptables restart
9. 关闭glassfish服务
[[email protected] ~]# service glassfish stop
Waiting for the domain to stop ....
Command stop-domain executed successfully.
Ubuntu 12.04 安装 GlassFish3.1.2 http://www.linuxidc.com/Linux/2012-06/62545.htm
CentOS安装GlassFish4.0 配置JDBC连接MySQL http://www.linuxidc.com/Linux/2014-07/104572.htm
GlassFish 的详细介绍:请点这里
GlassFish 的下载地址:请点这里
更多CentOS相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14
本文永久更新链接地址:http://www.linuxidc.com/Linux/2014-10/108419.htm