標題: (如何安裝JAVA在CentOS6)How to install and setup Oracle JAVA JDK in CentOS 6 [打印本頁] 作者: woff 時間: 2014-4-28 19:24 標題: (如何安裝JAVA在CentOS6)How to install and setup Oracle JAVA JDK in CentOS 6 1.Update the system(更新系統)
2.Remove any installed versions(移除任何JAVA版本)
3.Download JAVA JDK6, JDK7 or JDK8(下載JDK)
4.Install JAVA JDK6, JDK7 or JDK8(安裝JDK)
5.Set-up JAVA JDK6 or JDK7(設定JDK)
6.Confirm JAVA JDK6 or JDK7 installation(確認安裝JDK安裝完成)
If instead you want to do this on Debian Wheezy then check how to install and set-up Oracle JAVA 7 on Debian Wheezy article
1. The first thing I've done was to make sure the CentOS 6 system is fully up-to-date, so I ran(首先更新系統到最新)
yum update
複製代碼
2. Once the update completed, I then checked the system for any other installed JAVA packages using(檢查JDK版本)
rpm -qa | grep -E '^open[jre|jdk]|j[re|dk]'
複製代碼
there was the java-1.6.0-openjdk-1.6.0.0-1.56.1.11.8.el6_3.i686 package already installed so I removed it by running(移除JDK6版)
yum remove java-1.6.0-openjdk
複製代碼
3. The next step was to go and download the required JAVA JDK package for the system I was working on. It was a 32 bit CentOS 6 so I needed to get the 32 bit JAVA JDK package from Oracle's JAVA download page(到JDK下載頁面)
Note that I needed to install an older version of JAVA JDK since it was specific to the software I was setting up.
4. Once the JAVA JDK package got downloaded I proceeded with installing the package.
a) Installing the JAVA JDK6 package in CentOS 6(安裝JDK 6)
for 32bit (x86) system(設定32位元 系統權限)
chmod +x /opt/jdk-6u45-linux-i586-rpm.bin
/opt/./jdk-6u45-linux-i586-rpm.bin
複製代碼
for 64bit (x86_64) system
(設定32位元 系統權限)
chmod +x /opt/jdk-6u45-linux-x64-rpm.bin
/opt/./jdk-6u45-linux-x64-rpm.bin
複製代碼
b) Installing the JAVA JDK7 package in CentOS 6(安裝JDK 7)
for 64bit (x86_64) system(安裝64位元 系統)
rpm -Uvh /opt/jdk-7-linux-x64.rpm
複製代碼
for 32bit (x86) system(安裝32位元 系統)
rpm -Uvh /opt/jdk-7-linux-i586.rpm
複製代碼
c) Installing the JAVA JDK8 package in CentOS 6(安裝JDK 8)
for 64bit (x86_64) system(安裝64位元 系統)
rpm -Uvh /opt/jdk-8-linux-x64.rpm
複製代碼
for 32bit (x86) system(安裝32位元 系統)
rpm -Uvh /opt/jdk-8-linux-i586.rpm
複製代碼
5. Once the JAVA JDK package is installed, I then needed to configure it on the system using the alternatives command. This is in order to tell the system what are the default commands for JAVA. Most sys admins aren't aware about this and I think that it is a vital part when setting the JAVA package
a) Setting up the JAVA JDK6 package(設定JDK 6 alternatives進行管理)
6. Finally I verified the installed version of JAVA(確認JDK版本)
java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
複製代碼
I know this how-to will serve me as a quick reference for installing Oracle JAVA in the future and I truly hope this will help someone else too. 作者: 菊常香姝 時間: 2014-6-9 08:26
绝对喜欢,好帖子不多哦,顶一下作者: vftqp 時間: 2014-9-4 21:58
不看不知道,看了才知道,好帖