From Evernote: |
3. 架設Tomcat 6 MySql VPS CentOs 6 JDK 安裝設定 |
3. JDK 安裝設定
3-1檢查 jdk 現有的版本
[root@jay /]# sudo yum list \*java-1\* | grep open #確認現有提供的版本 java-1.6.0-openjdk.i686 1:1.6.0.0-1.61.1.11.11.el6_4 updates java-1.6.0-openjdk-demo.i686 1:1.6.0.0-1.61.1.11.11.el6_4 updates java-1.6.0-openjdk-devel.i686 1:1.6.0.0-1.61.1.11.11.el6_4 updates java-1.6.0-openjdk-javadoc.i686 1:1.6.0.0-1.61.1.11.11.el6_4 updates java-1.6.0-openjdk-src.i686 1:1.6.0.0-1.61.1.11.11.el6_4 updates java-1.7.0-openjdk.i686 1:1.7.0.25-2.3.10.3.el6_4 updates java-1.7.0-openjdk-demo.i686 1:1.7.0.25-2.3.10.3.el6_4 updates java-1.7.0-openjdk-devel.i686 1:1.7.0.25-2.3.10.3.el6_4 updates java-1.7.0-openjdk-javadoc.noarch 1:1.7.0.25-2.3.10.3.el6_4 updates java-1.7.0-openjdk-src.i686 1:1.7.0.25-2.3.10.3.el6_4 updates [root@jay /]# |
3-2安裝 jdk 與 develop 版本
yum install java-1.7.0-openjdk.i686
yum install java-1.7.0-openjdk-devel.i686
[root@jay /]#yum install java-1.7.0-openjdk.i686 ==== Is this ok [y/N]: y [root@jay /]#yum install java-1.7.0-openjdk-devel.i686 ==== Is this ok [y/N]: y |
3-3修改java.conf
[root@jay /]# cd /etc/java #切換目錄 [root@jay java]# ls #查看目錄 font.properties java.conf jpackage-release security [root@jay java]# cp java.conf java.conf.bak #備份java.conf [root@jay java]# ls #查看目錄 font.properties java.conf java.conf.bak jpackage-release security [root@jay java]# vi java.conf #編輯java.conf 檔 |
-*- # # JPackage Project <http://www.jpackage.org/> # Location of jar files on the system JAVA_LIBDIR=/usr/share/java # Location of arch-specific jar files on the system JNI_LIBDIR=/usr/lib/java # Root of all JVM installations JVM_ROOT=/usr/lib/jvm # You can define a system-wide JVM root here if you're not using the # default one. # # If you have the a base JRE package installed # (e.g. java-1.6.0-openjdk): #JAVA_HOME=$JVM_ROOT/jre # # If you have the a devel JDK package installed # (e.g. java-1.6.0-openjdk-devel): #JAVA_HOME=$JVM_ROOT/java #找到這一行,將行首的「#」去掉 JAVA_HOME=$JVM_ROOT/java #修改後變為此狀態 # Options to pass to the java interpreter JAVACMD_OPTS= |
3-4設定環境變數
[root@jay /]# cd etc #切換目錄 [root@jay etc]# cp profile profile.bak #備份 [root@jay etc]# vi profile #編輯profile |
HISTSIZE=1000 if [ "$HISTCONTROL" = "ignorespace" ] ; then export HISTCONTROL=ignoreboth else export HISTCONTROL=ignoredups fi export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL # By default, we want umask to get set. This sets it for login shell # Current threshold for system reserved uid/gids is 200 # You could check uidgid reservation validity in # /usr/share/doc/setup-*/uidgid file if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then umask 002 else umask 022 fi for i in /etc/profile.d/*.sh ; do if [ -r "$i" ]; then if [ "${-#*i}" != "$-" ]; then . "$i" else . "$i" >/dev/null 2>&1 fi fi done unset i unset -f pathmunge #加入以下字串編輯profile, JAVA_HOME 依實際檔名而定 JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.25 PATH=$PATH:$JAVA_HOME/bin CLASSPATH=.:$JAVA_HOME/lib export PATH JAVA_HOME CLASSPATH |
3-5檢查JAVA版本
[root@jay etc]# java -version java version "1.7.0_25" OpenJDK Runtime Environment (rhel-2.3.10.3.el6_4-i386) OpenJDK Client VM (build 23.7-b01, mixed mode, sha |
沒有留言:
張貼留言