标签:下载地址 创建目录 backup x64 download 环境 ORC rpm home
创建目录,用来存放下载的 JDK
cd /usr/local
mkdir -p tools
cd tools
下载JDK,后边的下载地址你可以到 orcal 官网去获取最新的版本,或者你想要的版本进行替换。
# jdk 8 已经包含 jre
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.rpm"
# jdk 10
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/10.0.2+13/19aef61b38124481863b1413dce1855f/jdk-10.0.2_linux-x64_bin.rpm"
# jre10
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/10.0.2+13/19aef61b38124481863b1413dce1855f/jre-10.0.2_linux-x64_bin.rpm"
安装
sudo yum localinstall jdk-****-linux-x64.rpm
Now Java should be installed at /usr/java
, and linked from /usr/bin/java
.
设置环境变量
将下边的代码添加到 profile
文件末尾
vim /etc/profile
# 注意jdk安装路径保持一致
export JAVA_HOME=/usr/java/default/
export JRE_HOME=/usr/java/default/jre
PATH=$PATH:$JRE_HOME/bin:$JAVA_HOME/bin
启用新的配置
source /etc/profile
标签:下载地址 创建目录 backup x64 download 环境 ORC rpm home
原文地址:https://www.cnblogs.com/dowhile/p/cetosjdk.html