CentOS 7 安装 JAVA环境(JDK 1.8)
1.打开url选择jdk1.8下载http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html我选择linux x64版本:
2.下载
wget http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz?AuthParam=1531155951_4e06a4d17c6c1dbfb8440352e19dd2ae
该下载地址已失效 请自行在官网复制下载地址下载以后通过命令检查安装包大小是否符合ls -lhthttps://images2018.cnblogs.com/blog/668104/201807/668104-20180710013041607-1295237356.png
3.安装(1)创建安装目录mkdir /usr/local/java/
(2)解压至安装目录tar -zxvf jdk-8u171-linux-x64.tar.gz -C /usr/local/java/
4.设置环境变量打开文件vim /etc/profile
在末尾添加export JAVA_HOME=/usr/local/java/jdk1.8.0_171export JRE_HOME=${JAVA_HOME}/jreexport CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/libexport PATH=${JAVA_HOME}/bin:$PATH
使环境变量生效source /etc/profile
添加软链接ln -s /usr/local/java/jdk1.8.0_171/bin/java /usr/bin/java
检查java -version
页:
[1]