注:使用的Linux系统的版本:CentOS Linux release 8.0.1905 (Core) 查看命令:
[root@VM-16-15-centos ~]# cat /etc/redhat-release
CentOS Linux release 8.0.1905 (Core)
安装准备
1、JDK版本可从我准备好的工具库直接下载
链接: https://pan.baidu.com/s/1rWYvUQEUqVlxR4g_jryfvg 提取码: f8ji
开始安装
1、上传文件到服务器并解压
# 将下载好的文件上传到/opt/software目录下
# software 是自己创建的文件夹,方便以后管理
[root@VM-16-15-centos opt]# cd software/
[root@VM-16-15-centos software]# ls
jdk-8u221-linux-x64.tar.gz
2、解压文件到 /opt/local202109 文件下
tar -zxvf jdk-8u221-linux-x64.tar.gz -C /opt/local202109
3、环境配置,修改配置文件profile
vim /etc/profile
配置以下内容:
export JAVA_HOME=/opt/local202109/jdk1.8.0_221
export PATH=:$JAVA_HOME/bin:$PATH
配置完后,执行 source /etc/profile生效
4、查看是否安装成功
Java -version
出现以下信息,代表成功:
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)