共计 2778 个字符,预计需要花费 7 分钟才能阅读完成。
CentOS 6.5 上安装 GlassFish4.0 过程笔记
1. 安装 JDK,注意操作系统的位数,64 or 32:
[root@linuxidc ~]# mkdir /usr/java
[root@linuxidc ~]# cd /usr/java
[root@linuxidc java]#rpm -Uvh /bak/jdk-7u55-linux-x64.rpm
[root@linuxidc java]# JAVA_HOME=/usr/java/jdk1.7.0_55
[root@linuxidc java]# export JAVA_HOME
[root@linuxidc java]# PATH=$JAVA_HOME/bin:$PATH
[root@linuxidc java]# export PATH
[root@linuxidc java]# vi /etc/profile
JAVA_HOME=/usr/java/jdk1.7.0_55
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
[root@linuxidc java]# source /etc/profile
[root@linuxidc ~]# echo $JAVA_HOME
/usr/java/jdk1.7.0_55
2. 下载并安装 glassfish 4,ml 多语言版
[root@linuxidc ~]# mv glassfish-4.0-ml.zip /usr/share/glassfish-4.0-ml.zip
[root@linuxidc ~]# cd /usr/share
[root@linuxidc share]# unzip -q glassfish-4.0-ml.zip
[root@linuxidc share]# groupadd webserver
[root@linuxidc share]# useradd -m -g webserver -G webserver webapp
[root@linuxidc share]# id webapp
[root@linuxidc share]# passwd webapp
[root@linuxidc share]# chown -R webapp:webserve /user/share/glassfish4
3. 将运行的 glassfish 设置为服务
[root@linuxidc ~]# cd /etc/init.d
[root@linuxidc 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
[root@linuxidc init.d]# chmod 755 glassfish
[root@linuxidc init.d]# chkconfig –add glassfish
[root@linuxidc init.d]# chkconfig –level 234 glassfish on
4. 启动 glassfish
[root@linuxidc 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 帐户密码
[root@linuxidc init.d]#cd /usr/share/glassfish4/glassfish/bin
[root@linuxidc bin]#./asadmin change-admin-password
6. 设置远程访问
[root@linuxidc bin]#./asadmin –host 192.168.1.114 –port 4848 enable-secure-admin
7. 重启 glassfish
[root@linuxidc ~]#service glassfish restart
8. 如果访问不到,注意开启防火墙 4848、80 端口
[root@linuxidc ~]#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
[root@linuxidc ~]#/etc/init.d/iptables restart
9. 关闭 glassfish 服务
[root@linuxidc ~]# 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