1、 下载jdk到本地
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2.使用xshell连接到服务器。
输入用户名和密码
用rz命令将jdk上传到服务器。没有安装rz的话先执行 yum install lrzsz
[[email protected] ~]# rz
-bash: rz: 未找到命令
[[email protected] ~]# yum install -y lrzsz
已加载插件:fastestmirror, langpacks
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirror.lzu.edu.cn
* updates: mirrors.neusoft.edu.cn
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/4): base/7/x86_64/group_gz | 166 kB 00:00:00
(2/4): extras/7/x86_64/primary_db | 174 kB 00:00:01
(3/4): updates/7/x86_64/primary_db | 5.0 MB 00:00:16
(4/4): base/7/x86_64/primary_db | 5.9 MB 00:00:20
正在解决依赖关系
--> 正在检查事务
---> 软件包 lrzsz.x86_64.0.0.12.20-36.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
====================================================================================================================
Package 架构 版本 源 大小
====================================================================================================================
正在安装:
lrzsz x86_64 0.12.20-36.el7 base 78 k
事务概要
====================================================================================================================
安装 1 软件包
总下载量:78 k
安装大小:181 k
Downloading packages:
警告:/var/cache/yum/x86_64/7/base/packages/lrzsz-0.12.20-36.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
lrzsz-0.12.20-36.el7.x86_64.rpm 的公钥尚未安装
lrzsz-0.12.20-36.el7.x86_64.rpm | 78 kB 00:00:00
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 检索密钥
导入 GPG key 0xF4A80EB5:
用户ID : "CentOS-7 Key (CentOS 7 Official Signing Key) <[email protected]>"
指纹 : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
软件包 : centos-release-7-5.1804.el7.centos.x86_64 (@anaconda)
来自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : lrzsz-0.12.20-36.el7.x86_64 1/1
验证中 : lrzsz-0.12.20-36.el7.x86_64 1/1
已安装:
lrzsz.x86_64 0:0.12.20-36.el7
完毕!
[[email protected] ~]#
解压jdk
sudo tar -vxf jdk-8u181-linux-x64.tar.gz -C/usr/local
配置环境变量
[[email protected] ~]# sudo vim /etc/profile
export JAVA_HOME=/usr/local/jdk1.8.0_181
export JRE_HOME=${JAVA_HOME}/jre
exportCLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
生效配置并测试
[[email protected] ~]# source /etc/profile
[[email protected] ~]# java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
————————————————
版权声明:本文为CSDN博主「Mr_daiven」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/DWL0208/article/details/81705178
原文地址:https://www.cnblogs.com/poison-future/p/11828873.html