在CentOS7上安裝JDK1.8
1 通過 SecureCRT 連接到阿裡雲 CentOS7 服務器;
2 進入到目錄 /usr/local/ 中:
cd /usr/local/
3 創建目錄 tools:
mkdir -p tools
4 進入到目錄 /usr/local/tools 中:
cd tools/
5 下載 jdk-8u91-linux-x64.tar.gz:
wget --no-check-certificate --no-cookies --header "Cookie: Oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u71-b14/jdk-7u71-linux-x64.rpm
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u91-b14/jdk-8u91-linux-x64.tar.gz
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u91-b14/jdk-8u91-linux-x64.rpm
wget --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie;" http://download.oracle.com/otn-pub/java/jdk/7u65-b17/jdk-7u65-linux-x64.tar
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-3.2.6.tgz
wget http://download.redis.io/releases/redis-3.0.7.tar.gz
wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-9/v9.0.0.M4/bin/apache-tomcat-9.0.0.M4.tar.gz
wget http://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.12-1.el7.x86_64.rpm-bundle.tar
wget http://apache.fayea.com/zookeeper/zookeeper-3.4.8/zookeeper-3.4.8.tar.gz
wget http://memcached.org/files/memcached-1.4.25.tar.gz
6 加壓縮 jdk-8u91-linux-x64.tar.gz 文件:
tar -zxvf jdk-8u91-linux-x64.tar.gz
7 返回到上一級並創建 /usr/local/jdk 目錄:
cd ..
mkdir -p jdk
8 進入到 tools 目錄後將 jdk1.8.0_91 移動到 jdk 目錄中:
cd ../tools/
mv jdk1.8.0_91/ ../jdk/
9 打開 /etc/ 目錄下的 profile 文件:
vi /etc/profile
將如下代碼追加到 profile 文件末尾:
# idea - jdk8 settings start 2016-05-01
JAVA_HOME=/usr/local/jdk/jdk1.8.0_91
JRE_HOME=$JAVA_HOME/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
CLASSPATH=:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib/dt.jar
export JAVA_HOME JRE_HOME PATH CLASSPATH
# idea - jdk8 settings end - 2016-05-01
按 Esc 鍵、輸入 wq! 回車,保持並退出。
10 即可啟用新的配置:
source /etc/profile
11 輸入 java -version 查看 JDK 的版本:
[root@iZ94hws2fzlZ jdk1.8.0_91]# java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
Ubuntu 14.04安裝JDK1.8.0_25與配置環境變量
CentOS 搭建JDK環境
Ubuntu 14.04安裝JDK1.8.0_25與配置環境變量
Ubuntu 14.04 LTS安裝Oracle JDK 1.8
CentOS6.3安裝JDK和環境配置
Ubuntu 14.04 安裝 JDK8
Ubuntu下安裝JDK圖文解析
本文永久更新鏈接地址:
http://xxxxxx/Linuxjc/1141005.html TechArticle