Red hat底下安裝glassfish並註冊成為service
前兩步是要用oracle jdk取代open jdk,glassfish安裝從第3步開始
Table of Contents
- 移除open jdk所有版本
- 安裝oracle jdk
- 安裝glassfish
- glassfish asadmin指令(包含domain的啟動關閉,check status指令)
- 註冊glassfish service
移除open jdk所有版本
|
|
安裝oracle jdk
- 下載jdk1.7
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
Java SE Development Kit 7u55
Linux x64 jdk-7u55-linux-x64.tar.gz 解壓縮到/usr/java/
1tar -zxvf jdk1.7.0_55.tar.gz修改/etc/profile與/etc/bashrc,加入以下
123# JDK environmentJAVA_HOME=/usr/java/jdk1.7.0_55PATH=$PATH:$JAVA_HOME/bin/登出再登入,or source /etc/profile
- 檢查123echo $PATHjava -version#結果:java version "1.7.0_55"
安裝glassfish
- 下載glassfish4.0
http://download.java.net/glassfish/4.0/release/glassfish-4.0.zip 解壓縮到/usr/glassfish
1unzip glassfish4.zip開啟glassfish server
12cd /usr/glassfish/glassfish4/glassfish/bin./asadmin start-domain domain1
glassfish asadmin指令(包含domain的啟動關閉,check status指令)
use asadmin to start glassfish domain1:
12cd /usr/glassfish/glassfish4/glassfish/bin./asadmin start-domain domain1use asadmin to stop glassfish domain1:
12cd /usr/glassfish/glassfish4/glassfish/bin./asadmin stop-domain domain1use asadmin to check glassfish domain status:
12./asadmin list-domains#結果: domain1 runninguse ps to check glassfish:
1ps -ef | grep glassfishglassfish admin tool page:
1http://localhost:4848
註冊glassfish service
- ./asadmin create-service
會在/etc/init.d裡多一個shell file: GlassFish_domain1
/etc/rcX.d裡多soft link S20GlassFish_domain1 or K20GlassFish_domain1 - 修改/etc/init.d/GlassFish_domain1
最上面加入source /etc/profile