1,下載jdk-7u75-linux-x64.tar.gz,地址http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.htmlhtml
2,肯定系統是否自帶jdk,若是自帶,最好先卸載,卸載方法參見另外一篇博文 卸載Centos自帶open-jdk java
3,切換到root用戶,新建 /usr/local/java 目錄,並將安裝包上傳到該目錄linux
#su rootoracle
#mkdir /usr/local/java post
4,解壓 jdk-7u79-linux-x64.tar.gzurl
# tar xvf jdk-7u79-linux-x64.tar.gz spa
5,設置環境變量,編輯/etc/profile文件,在最下面 追加 jdk安裝路徑htm
#vi /etc/profileblog
export JAVA_HOME=/usr/local/java/jdk1.7.0_79
export JRE_HOME=/usr/local/java/jdk1.7.0_79/jre
export PATH=$PATH:/usr/local/java/jdk1.7.0_79/bin
export CLASSPATH=./:/usr/local/java/jdk1.7.0_79/lib:/usr/local/java/jdk1.7.0_79/jre/libget
6,設置環境變量生效,
#source profile
7,校驗是否安裝成功
#java -version