CentOS 7/8 安装JDK8
# 创建目录
mkdir /usr/local/java
# 下载JDK并上传到/usr/local/java
# https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html
# 解压缩 cd /usr/local/java tar -zxvf jdk-8u261-linux-x64.tar.gz
# 设置环境变量 vim /etc/profile
# 在文件最后添加以下内容 export JAVA_HOME=/usr/local/java/jdk1.8.0_261 export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$JAVA_HOME/bin:$PATH # 设置立即生效 source /etc/profile
# 验证 java -version