1恕曲、在/var/local 目錄下新建Java文件夾
# mkdir /usr/local/java?
2禽捆、轉入新建文件夾內
# cd /usr/local/java?
3、下載
#wget? http://................
官網(wǎng)鏈接:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
4勋篓、解壓 安裝包
tar xvf? jdk-8u131-linux-x64.tar.gz
5蚌吸、環(huán)境變量
# vi /etc/profile ?( 點鍵盤 ?i 進入插入命令)
export JAVA_HOME=/usr/local/java/jdk1.8.0_131
export JRE_HOME=/usr/local/java/jdk1.8.0_131/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$PATH
(填寫完后补憾,ESC ?—— ctrl + : ?—— wq ?——回車)
#? source /etc/profile ?運行命令姻蚓,使profile生效
# java -version ?檢驗是否成功
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
(成功S帷)