注:以下所有操作均在CentOS 6.5 x86_64位系统下完成。
#准备工作#
准备用rpm下载前,看系统是否已经安装有JDK,如果没有则进入正式安装步骤。
# rpm -qa | grep jdk
首先需要去下载JDK-1.7,我们选择去官网下载。但这里在下载的时候有点麻烦,默认的下载路径是没办法直接使用wget命令下载的,有个方法是:
1)进入Oracle的官网,比如:http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
2)选择Accept License Agreement,如下:
3)然后点击下载地址
这个时候浏览器就会去下载了,把浏览器下载的正式地址复制下来,然后再用wget去获取,比如:
# cd /usr/local/src # wget http://download.oracle.com/otn-pub/java/jdk/7u72-b14/jdk-7u72-linux-x64.rpm?AuthParam=1419939909_a8de536de423ecfac6886b3bf6567c0e ...... 2014-12-30 19:50:35 (292 KB/s) - 已保存 “jdk-7u72-linux-x64.rpm?AuthParam=1419939909_a8de536de423ecfac6886b3bf6567c0e” [126699825/126699825]) # ls /usr/local/src jdk-7u72-linux-x64.rpm?AuthParam=1419939909_a8de536de423ecfac6886b3bf6567c0e # mv jdk-7u72-linux-x64.rpm?AuthParam=1419939909_a8de536de423ecfac6886b3bf6567c0e jdk-7u72-linux-x64.rpm
#JDK-1.7的安装#
对已经下载完成的JDK-1.7进行安装:
# cd /usr/local/src # rpm -Uvh jdk-7u72-linux-x64.rpm Preparing... ########################################### [100%] 1:jdk ########################################### [100%] Unpacking JAR files... rt.jar... jsse.jar... charsets.jar... tools.jar... localedata.jar... jfxrt.jar... # rpm -qa | grep jdk jdk-1.7.0_72-fcs.x86_64
JDK默认安装路径是在/usr/java下:
# ls /usr/java/ default jdk1.7.0_72 latest
给当前环境添加JAVA的bin目录:
# vim /etc/profile export JAVA_HOME=/usr/java/jdk1.7.0_72 export PATH=$PATH:/usr/local/mysql/bin:$JAVA_HOME/bin # source /etc/profile
至此,JDK环境已经安装完毕。
CentOS7.2安装JDK1.7 http://www.linuxidc.com/Linux/2016-11/137398.htm
CentOS 搭建JDK环境 http://www.linuxidc.com/Linux/2015-06/118879.htm
Ubuntu 14.04安装JDK1.8.0_25与配置环境变量 http://www.linuxidc.com/Linux/2015-01/112030.htm
Ubuntu 14.04 LTS安装Oracle JDK 1.8 http://www.linuxidc.com/Linux/2014-11/109216.htm
CentOS6.3安装JDK和环境配置 http://www.linuxidc.com/Linux/2012-09/70780.htm
本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-12/138046.htm