安装jdk
1.安装jdk
yum安装jdk
[root@server-01 ~]# yum -y list java* [root@server-01 ~]# yum -y install java-1.8.0-openjdk.x86_64
jdk下载:http://www.oracle.com/technetwork/java/javase/downloads/index.html
源码包安装jdk
[root@master ~]# tar xf jdk-8u191-linux-x64.tar.gz -C /usr/local/ [root@master ~]# cd /usr/local/ [root@master local]# ln -sv jdk1.8.0_191/ jdk "jdk" -> "jdk1.8.0_191/"
配置环境变量:
[root@master local]# vi /etc/profile.d/jdk.sh JAVA_HOME=/usr/local/jdk PATH=$JAVA_HOME/bin:$PATH export JAVA_HOME PATH
[root@master local]# chmod o+x /etc/profile.d/jdk.sh [root@master local]# /etc/profile.d/jdk.sh
查看java版本。
[root@master local]# ln -sv /usr/local/jdk1.8.0_191/jre/bin/java /usr/local/bin "/usr/local/bin/java" -> "/usr/local/jdk1.8.0_191/jre/bin/java" [root@master local]# java -version java version "1.8.0_191" Java(TM) SE Runtime Environment (build 1.8.0_191-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)