$ sudo rpm -ivh jdk-7-linux-i586.rpm
$ sudo rpm -ql jdk | more→ /usr/java/jdk1.7.0 みたい
$ update-alternatives --display java java -ステータスは自動です。 リンクは現在 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java を指しています。
[root@orange java]# cat mkUpAlternatives.sh #!/bin/bash JDK=/usr/java/jdk1.7.0 echo "#!/bin/bash" echo "/usr/sbin/update-alternatives --install /usr/bin/java java $JDK/bin/java 17000\\" for FILE in ${JDK}/bin/* do CMD=${FILE##*/} if [ $CMD != "java" ]; then echo " --slave /usr/bin/$CMD $CMD $FILE\\" fi done echo ""変数 JDK とバージョン番号 17000 を適宜変える。いちばん大きいバージョン番号の設定が使われることになる
[root@orange java]# ./mkUpAlternatives.sh > ./upAlternatives.sh [root@orange java]# cat ./upAlternatives.sh #!/bin/bash /usr/sbin/update-alternatives --install /usr/bin/java java /usr/java/jdk1.7.0/bin/java 17000\ --slave /usr/bin/ControlPanel ControlPanel /usr/java/jdk1.7.0/bin/ControlPanel\ --slave /usr/bin/appletviewer appletviewer /usr/java/jdk1.7.0/bin/appletviewer\ --slave /usr/bin/apt apt /usr/java/jdk1.7.0/bin/apt\ --slave /usr/bin/extcheck extcheck /usr/java/jdk1.7.0/bin/extcheck\ --slave /usr/bin/idlj idlj /usr/java/jdk1.7.0/bin/idlj\ --slave /usr/bin/jar jar /usr/java/jdk1.7.0/bin/jar\ --slave /usr/bin/jarsigner jarsigner /usr/java/jdk1.7.0/bin/jarsigner\ --slave /usr/bin/java-rmi.cgi java-rmi.cgi /usr/java/jdk1.7.0/bin/java-rmi.cgi\ --slave /usr/bin/javac javac /usr/java/jdk1.7.0/bin/javac\ --slave /usr/bin/javadoc javadoc /usr/java/jdk1.7.0/bin/javadoc\ --slave /usr/bin/javah javah /usr/java/jdk1.7.0/bin/javah\ --slave /usr/bin/javap javap /usr/java/jdk1.7.0/bin/javap\ --slave /usr/bin/javaws javaws /usr/java/jdk1.7.0/bin/javaws\ --slave /usr/bin/jconsole jconsole /usr/java/jdk1.7.0/bin/jconsole\ --slave /usr/bin/jcontrol jcontrol /usr/java/jdk1.7.0/bin/jcontrol\ --slave /usr/bin/jdb jdb /usr/java/jdk1.7.0/bin/jdb\ --slave /usr/bin/jhat jhat /usr/java/jdk1.7.0/bin/jhat\ --slave /usr/bin/jinfo jinfo /usr/java/jdk1.7.0/bin/jinfo\ --slave /usr/bin/jmap jmap /usr/java/jdk1.7.0/bin/jmap\ --slave /usr/bin/jps jps /usr/java/jdk1.7.0/bin/jps\ --slave /usr/bin/jrunscript jrunscript /usr/java/jdk1.7.0/bin/jrunscript\ --slave /usr/bin/jsadebugd jsadebugd /usr/java/jdk1.7.0/bin/jsadebugd\ --slave /usr/bin/jstack jstack /usr/java/jdk1.7.0/bin/jstack\ --slave /usr/bin/jstat jstat /usr/java/jdk1.7.0/bin/jstat\ --slave /usr/bin/jstatd jstatd /usr/java/jdk1.7.0/bin/jstatd\ --slave /usr/bin/jvisualvm jvisualvm /usr/java/jdk1.7.0/bin/jvisualvm\ --slave /usr/bin/keytool keytool /usr/java/jdk1.7.0/bin/keytool\ --slave /usr/bin/native2ascii native2ascii /usr/java/jdk1.7.0/bin/native2ascii\ --slave /usr/bin/orbd orbd /usr/java/jdk1.7.0/bin/orbd\ --slave /usr/bin/pack200 pack200 /usr/java/jdk1.7.0/bin/pack200\ --slave /usr/bin/policytool policytool /usr/java/jdk1.7.0/bin/policytool\ --slave /usr/bin/rmic rmic /usr/java/jdk1.7.0/bin/rmic\ --slave /usr/bin/rmid rmid /usr/java/jdk1.7.0/bin/rmid\ --slave /usr/bin/rmiregistry rmiregistry /usr/java/jdk1.7.0/bin/rmiregistry\ --slave /usr/bin/schemagen schemagen /usr/java/jdk1.7.0/bin/schemagen\ --slave /usr/bin/serialver serialver /usr/java/jdk1.7.0/bin/serialver\ --slave /usr/bin/servertool servertool /usr/java/jdk1.7.0/bin/servertool\ --slave /usr/bin/tnameserv tnameserv /usr/java/jdk1.7.0/bin/tnameserv\ --slave /usr/bin/unpack200 unpack200 /usr/java/jdk1.7.0/bin/unpack200\ --slave /usr/bin/wsgen wsgen /usr/java/jdk1.7.0/bin/wsgen\ --slave /usr/bin/wsimport wsimport /usr/java/jdk1.7.0/bin/wsimport\ --slave /usr/bin/xjc xjc /usr/java/jdk1.7.0/bin/xjc\
[root@orange java]# chmod +x ./upAlternatives.sh [root@orange java]# ./upAlternatives.sh
[root@orange java]# java -version java version "1.7.0" Java(TM) SE Runtime Environment (build 1.7.0-b147) Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode, sharing)
[root@orange java]# which java /usr/bin/java [root@orange java]# ls -la /usr/bin/java lrwxrwxrwx 1 root root 22 2011-09-17 23:41 /usr/bin/java -> /etc/alternatives/java [root@orange java]# ls -la /etc/alternatives/java lrwxrwxrwx 1 root root 27 2011-09-17 23:41 /etc/alternatives/java -> /usr/java/jdk1.7.0/bin/java
$ chmod +x ogs-3.1.1-unix-ml.sh $ sudo ./ogs-3.1.1-unix-ml.sh
# /usr/bin/system-config-firewall
#!/bin/sh
# chkconfig: 35 99 01
# description: Oracle Glassfish 3
GLASSFISH_HOME="/opt/glassfish3"
case "$1" in
start)
$GLASSFISH_HOME/bin/asadmin start-domain >/dev/null
;;
stop)
$GLASSFISH_HOME/bin/asadmin stop-domain >/dev/null
;;
restart)
$GLASSFISH_HOME/bin/asadmin restart-domain >/dev/null
;;
\*)
echo "usage: $0 (start|stop|restart|help)"
esac
[root@orange init.d]# chmod +x glassfish [root@orange init.d]# ./glassfish stop ドメインの停止を待機しています ..... コマンド stop-domain は正常に実行されました。 [root@orange init.d]# ./glassfish start domain1 の起動を待機しています .................... domain が正常に起動されました: domain1 domain 場所: /opt/glassfish3/glassfish/domains/domain1 ログファイル: /opt/glassfish3/glassfish/domains/domain1/logs/server.log 管理ポート: 4848 コマンド start-domain は正常に実行されました。
# /sbin/chkconfig --add glassfish # /sbin/chkconfig --list | grep glassfish glassfish 0:off 1:off 2:off 3:on 4:off 5:on 6:off
ls /etc/rc.d/rc0.d/ | grep glassfish | K01glassfish | (シャットダウン) |
ls /etc/rc.d/rc1.d/ | grep glassfish | K01glassfish | (シングルユーザ) |
ls /etc/rc.d/rc2.d/ | grep glassfish | K01glassfish | (未定義) |
ls /etc/rc.d/rc3.d/ | grep glassfish | S99glassfish | (コンソール起動) |
ls /etc/rc.d/rc4.d/ | grep glassfish | K01glassfish | (未定義) |
ls /etc/rc.d/rc5.d/ | grep glassfish | S99glassfish | (GUI起動) |
ls /etc/rc.d/rc6.d/ | grep glassfish | K01glassfish | (再起動) |
ドメイン > 管理者パスワード