RHEL7升级openssh7.4p1教程
由于升级OpenSSH涉及到安全性问题,为保险起见,在升级前最好安装telnet服务作为备用方案,然后在升级成功后再停止telnet即可。
一、OpenSSH升级相关源码包下载地址:
zlib http://www.zlib.net/zlib-1.2.11.tar.gz
zlib其他版本下载地址 http://www.zlib.net/fossils/
openssl-fips https://www.openssl.org/source/old/fips/openssl-fips-2.0.12.tar.gz
OpenSSL https://www.openssl.org/source/openssl-1.0.2k.tar.gz
OpenSSH http://openbsd.hk/pub/OpenBSD/OpenSSH/portable/ openssh-7.4p1.tar.gz
二、RHEL7配置yum源
1.新建iso存放目录
#mkdir iso
用winscp上传rhel-server-7.1-x86_64-dvd.iso 上传至 /iso 目录
2.新建iso挂载目录 /yum
#mkdir /yum
3.上传到rhel-server-7.1-x86_64-dvd.iso 至 /iso目录,然后挂载到/yum目录下
#mount -o loop /rhel-server-7.1-x86_64-dvd.iso /yum
4、在目录/etc/yum.repos.d/创建文件文件名.repo
5、配置本地yum源
#cd /etc/yum.repos.d/ #进入yum配置目录
#touch rhel7.repo #建立yum配置文件
#vi rhel7.repo #编辑配置文件,添加以下内容:
[media]
name=RHEL7.1
baseurl=file:///yum
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
~
:wq! #保存退出
说明:
[media]
name=rhel7 #自定义名称
baseurl=file:///mnt #本地光盘挂载路径
enabled=1 #启用yum源,0为不启用,1为启用
gpgcheck=0 #检查GPG-KEY,0为不检查,1为检查
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
#yum clean all
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Cleaning repos: rhel-source
Cleaning up Everything
#yum update
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
rhel-source | 4.0 kB 00:00 ...
rhel-source/primary_db | 3.1 MB 00:00 ...
Setting up Update Process
No Packages marked for Update
#yum makecache
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
rhel-source | 4.0 kB 00:00 ...
rhel-source/filelists_db | 3.7 MB 00:00 ...
rhel-source/other_db | 1.6 MB 00:00 ...
rhel-source/group_gz | 204 kB 00:00 ...
Metadata Cache Created
三、安装telnet服务
先检查RHEL7是否已经安装以下两个安装包:telnet-server、xinetd。命令如下:
#rpm -qa telnet-server
#rpm -qa xinetd
如果没有安装,则先安装。安装命令:
1. 使用yum安装telnet
#yum list |grep telnet
telnet-server.x86_64 1:0.17-59.el7 @media
telnet.x86_64 1:0.17-59.el7 media
#yum install telnet-server.x86_64
#yum install telnet.x86_64
或
#yum -y install telnet-server
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package telnet-server.x86_64 1:0.17-59.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================
Package Arch Version Repository Size
==================================================================================
Installing:
telnet-server x86_64 1:0.17-59.el7 media 40 k
Transaction Summary
==================================================================================
Install 1 Package
Total download size: 40 k
Installed size: 55 k
Downloading packages:
warning: /yum/Packages/telnet-server-0.17-59.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Public key for telnet-server-0.17-59.el7.x86_64.rpm is not installed
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Importing GPG key 0xFD431D51:
Userid : "Red Hat, Inc. (release key 2) <security@redhat.com>"
Fingerprint: 567e 347a d004 4ade 55ba 8a5f 199e 2f91 fd43 1d51
Package : redhat-release-server-7.1-1.el7.x86_64 (@anaconda/7.1)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Importing GPG key 0x2FA658E0:
Userid : "Red Hat, Inc. (auxiliary key) <security@redhat.com>"
Fingerprint: 43a6 e49c 4a38 f4be 9abf 2a53 4568 9c88 2fa6 58e0
Package : redhat-release-server-7.1-1.el7.x86_64 (@anaconda/7.1)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 1:telnet-server-0.17-59.el7.x86_64 1/1
Verifying : 1:telnet-server-0.17-59.el7.x86_64 1/1
Installed:
telnet-server.x86_64 1:0.17-59.el7
#####################################################################################
2.使用yum安装xinetd
#yum list |grep xinetd
xinetd.x86_64 2:2.3.15-12.el7 @media
#yum install xinetd.x86_64
或
#yum install xinetd
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package xinetd.x86_64 2:2.3.15-12.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================
Package Arch Version Repository Size
==================================================================================
Installing:
xinetd x86_64 2:2.3.15-12.el7 media 128 k
Transaction Summary
==================================================================================
Install 1 Package
Total download size: 128 k
Installed size: 261 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 2:xinetd-2.3.15-12.el7.x86_64 1/1
Verifying : 2:xinetd-2.3.15-12.el7.x86_64 1/1
Installed:
xinetd.x86_64 2:2.3.15-12.el7
Complete!
2. 启动telnet服务
安装完成后,将xinetd服务加入开机自启动:
#systemctl enable xinetd.service
#将telnet服务加入开机自启动:
#systemctl enable telnet.socket
最后,启动以上两个服务即可:
#systemctl start telnet.socket
#systemctl status telnet.socket
telnet.socket - Telnet Server Activation Socket
Loaded: loaded (/usr/lib/systemd/system/telnet.socket; enabled)
Active: active (listening) since Sun 2017-04-09 01:52:57 PDT; 1min 38s ago
Docs: man:telnetd(8)
Listen: [::]:23 (Stream)
Accepted: 0; Connected: 0
#systemctl start xinetd(或service xinetd start)
#systemctl status xinetd.service
xinetd.service - Xinetd A Powerful Replacement For Inetd
Loaded: loaded (/usr/lib/systemd/system/xinetd.service; enabled)
Active: active (running) since Sun 2017-04-09 01:53:37 PDT; 4min 5s ago
Process: 3296 ExecStart=/usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid $EXTRAOPTIONS (code=exited, status=0/SUCCESS)
Main PID: 3297 (xinetd)
CGroup: /system.slice/xinetd.service
└─3297 /usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid
Apr 09 01:53:37 localhost.localdomain xinetd[3297]: removing discard
Apr 09 01:53:37 localhost.localdomain xinetd[3297]: removing discard
Apr 09 01:53:37 localhost.localdomain xinetd[3297]: removing echo
Apr 09 01:53:37 localhost.localdomain xinetd[3297]: removing echo
Apr 09 01:53:37 localhost.localdomain xinetd[3297]: removing tcpmux
Apr 09 01:53:37 localhost.localdomain xinetd[3297]: removing time
Apr 09 01:53:37 localhost.localdomain xinetd[3297]: removing time
Apr 09 01:53:37 localhost.localdomain xinetd[3297]: xinetd Version 2.3.15 start...
Apr 09 01:53:37 localhost.localdomain xinetd[3297]: Started working: 0 availabl...
Apr 09 01:53:37 localhost.localdomain systemd[1]: Started Xinetd A Powerful Re....
Hint: Some lines were ellipsized, use -l to show in full.
#查看防火墙状态
#systemctl status firewalld
#添加防火墙规则(telnet加入防火墙)
$ sudo firewall-cmd --zone=public --add-port=23/tcp --permanent
success
$ sudo firewall-cmd --reload
success
如果不使用“--permanent”标记,把么防火墙规则在重启后会失效
五、安装依赖包
#yum -y install gcc pam-devel zlib-devel openssl-devel
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Setting up Install Process
Package gcc-4.4.6-4.el6.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package openssl-devel.x86_64 0:1.0.0-20.el6_2.5 will be installed
--> Processing Dependency: krb5-devel for package: openssl-devel-1.0.0-20.el6_2.5.x86_64
---> Package pam-devel.x86_64 0:1.1.1-10.el6_2.1 will be installed
---> Package zlib-devel.x86_64 0:1.2.3-27.el6 will be installed
--> Running transaction check
---> Package krb5-devel.x86_64 0:1.9-33.el6 will be installed
--> Processing Dependency: libselinux-devel for package: krb5-devel-1.9-33.el6.x86_64
--> Processing Dependency: libcom_err-devel for package: krb5-devel-1.9-33.el6.x86_64
--> Processing Dependency: keyutils-libs-devel for package: krb5-devel-1.9-33.el6.x86_64
--> Running transaction check
---> Package keyutils-libs-devel.x86_64 0:1.4-4.el6 will be installed
---> Package libcom_err-devel.x86_64 0:1.41.12-12.el6 will be installed
---> Package libselinux-devel.x86_64 0:2.0.94-5.3.el6 will be installed
--> Processing Dependency: libsepol-devel >= 2.0.32-1 for package: libselinux-devel-2.0.94-5.3.el6.x86_64
--> Processing Dependency: pkgconfig(libsepol) for package: libselinux-devel-2.0.94-5.3.el6.x86_64
--> Running transaction check
---> Package libsepol-devel.x86_64 0:2.0.41-4.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
openssl-devel x86_64 1.0.0-20.el6_2.5 rhel-source 1.1 M
pam-devel x86_64 1.1.1-10.el6_2.1 rhel-source 204 k
zlib-devel x86_64 1.2.3-27.el6 rhel-source 44 k
Installing for dependencies:
keyutils-libs-devel x86_64 1.4-4.el6 rhel-source 28 k
krb5-devel x86_64 1.9-33.el6 rhel-source 1.2 M
libcom_err-devel x86_64 1.41.12-12.el6 rhel-source 31 k
libselinux-devel x86_64 2.0.94-5.3.el6 rhel-source 136 k
libsepol-devel x86_64 2.0.41-4.el6 rhel-source 64 k
Transaction Summary
================================================================================
Install 8 Package(s)
Total download size: 2.8 M
Installed size: 6.1 M
Downloading Packages:
--------------------------------------------------------------------------------
Total 23 MB/s | 2.8 MB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : libsepol-devel-2.0.41-4.el6.x86_64 1/8
Installing : libselinux-devel-2.0.94-5.3.el6.x86_64 2/8
Installing : libcom_err-devel-1.41.12-12.el6.x86_64 3/8
Installing : zlib-devel-1.2.3-27.el6.x86_64 4/8
Installing : keyutils-libs-devel-1.4-4.el6.x86_64 5/8
Installing : krb5-devel-1.9-33.el6.x86_64 6/8
Installing : openssl-devel-1.0.0-20.el6_2.5.x86_64 7/8
Installing : pam-devel-1.1.1-10.el6_2.1.x86_64 8/8
Installed products updated.
Verifying : openssl-devel-1.0.0-20.el6_2.5.x86_64 1/8
Verifying : keyutils-libs-devel-1.4-4.el6.x86_64 2/8
Verifying : zlib-devel-1.2.3-27.el6.x86_64 3/8
Verifying : libselinux-devel-2.0.94-5.3.el6.x86_64 4/8
Verifying : libcom_err-devel-1.41.12-12.el6.x86_64 5/8
Verifying : libsepol-devel-2.0.41-4.el6.x86_64 6/8
Verifying : krb5-devel-1.9-33.el6.x86_64 7/8
Verifying : pam-devel-1.1.1-10.el6_2.1.x86_64 8/8
Installed:
openssl-devel.x86_64 0:1.0.0-20.el6_2.5 pam-devel.x86_64 0:1.1.1-10.el6_2.1
zlib-devel.x86_64 0:1.2.3-27.el6
Dependency Installed:
keyutils-libs-devel.x86_64 0:1.4-4.el6
krb5-devel.x86_64 0:1.9-33.el6
libcom_err-devel.x86_64 0:1.41.12-12.el6
libselinux-devel.x86_64 0:2.0.94-5.3.el6
libsepol-devel.x86_64 0:2.0.41-4.el6
Complete!
启动一个服务:systemctl start postfix.service
关闭一个服务:systemctl stop postfix.service
重启一个服务:systemctl restart postfix.service
显示一个服务的状态:systemctl status postfix.service
在开机时启用一个服务:systemctl enable postfix.service
在开机时禁用一个服务:systemctl disable postfix.service
查看服务是否开机启动:systemctl is-enabled postfix.service
查看已启动的服务列表:systemctl list-unit-files|grep enabled
查看启动失败的服务列表:systemctl --failed
PS:使用命令 systemctl is-enabled postfix.service 得到的值可以是enable、disable或static,这里的 static 它是指对应的 Unit 文件中没有定义[Install]区域,因此无法配置为开机启动服务。
说明:启用服务就是在当前“runlevel”的配置文件目录/etc/systemd/system/multi-user.target.wants/里,建立/usr/lib/systemd/system里面对应服务配置文件的软链接;禁用服务就是删除此软链接,添加服务就是添加软连接
# systemctl enable telnet.socket
ln -s '/usr/lib/systemd/system/telnet.socket' '/etc/systemd/system/sockets.target.wants/telnet.socket'
六、安装zlib
1.解压
#tar -xvf zlib-1.2.11.tar.gz
#cd zlib-1.2.11
2.配置
#./configure
3.编译安装
#make
#make install
4.查看
#ll /usr/local/lib
total 240
-rw-r--r--. 1 root root 135146 Apr 8 07:59 libz.a
lrwxrwxrwx. 1 root root 14 Apr 8 07:59 libz.so -> libz.so.1.2.11
lrwxrwxrwx. 1 root root 14 Apr 8 07:59 libz.so.1 -> libz.so.1.2.11
-rwxr-xr-x. 1 root root 106088 Apr 8 07:59 libz.so.1.2.11
drwxr-xr-x. 2 root root 4096 Apr 8 07:59 pkgconfig
七、安装openssl-fips-2.0.14
1.解压
#tar -xzvf openssl-fips-2.0.14.tar.gz
#cd openssl-fips-2.0.14
2.配置
#./config
3.编译安装
#make
#make install
八、安装openssl-1.0.2k
1.解压
#tar -xzvf openssl-1.0.2k.tar.gz
#cd openssl-1.0.2k
2.配置
#./config
3.编译安装
#make
#make test
#make install
4.设置软连接
#ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl #设置软连接,如果提示已存在,则无需再设置
ln: creating symbolic link `/usr/bin/openssl': File exists
5.查看新安装的openssl版本
#openssl version -a
OpenSSL 1.0.0-fips 29 Mar 2010
九、安装openssh-7.4p1
1.解压
#tar -xzvf openssh-7.4p1.tar.gz
#cd openssh-7.4p1
2.编译
#./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --with-tcp-wrappers --with-ssl-dir=/usr/local/ssl --without-hardening
3.编译安装
#make
#make install
!!!警告,升级完openssh-7.4p1后,在未修改以下权限前,禁止断开连接,否则连不上ssh
就麻烦了
#chown :root ssh_host_rsa_key
#chmod 600 ssh_host_rsa_key
#systemctl status sshd.service
#chown :root ssh_host_ecdsa_key
#chmod 600 ssh_host_ecdsa_key
#systemctl status sshd.service
#chown :root ssh_host_ed25519_key
#chmod 600 ssh_host_ed25519_key
#system status sshd.service
#启动服务:
#systemctl start sshd.service
#查看服务状态
#systemctl status sshd.service
#添加开机启动
#systemctl enable sshd.service
enable
#验证是否开机启动
#systemctl is-enabled sshd.service
enabled
#验证openssh版本是否升级成功
#ssh -V
查看所有已启动的服务
#systemctl list-units --type=service
转载于:https://blog.51cto.com/bsoco/1914387
RHEL7升级openssh7.4p1教程相关推荐
- linux openssh升级7.4,RHEL Centos上升级OpenSSH7.4p1
二.配置yum源 1.新建光盘挂载目录/yum mkdir /yum 2.上传光盘到机器的某个目录,然后挂载到/yum目录下 mount -o loop rhel-server-6.5-x86_64- ...
- Openssh7.4p1更换为8.2
Openssh7.4p1更换为8.2 写在前面: 如果编译升级失败,就yum install -y openssh*安装回7.4p1 Openssh下载地址https://cdn.openbsd.o ...
- 服务器源码安装openssh7.4p1
系统环境: OS:Kylin-Server-10-SP2-x86-Release-Build09-20210524 软件版本:OpenSSH_8.2p1, OpenSSL 1.1.1f 一.源码安装升 ...
- 小米手机升级Android6,小米3能升级miui 6?小米3升级miui v6教程
小米3升级miui v6教程来咯~小编还带来了miui v6下载,MIUI V6系统有了很多的变化,小米3是可以升级miui6系统的哦~如果你不知道步骤的话,就请参考下文吧. 第一步.下载工具包和线刷 ...
- Vivo升级android版本,vivo手机升级Android Q教程:很简单,X27与NEX都支持
原标题:vivo手机升级Android Q教程:很简单,X27与NEX都支持 北京时间5月8日,谷歌在美国加州山景城海岸线圆形剧场召开了一年一度的I/O大会,正式发布全新一代的安卓操作系统--Andr ...
- 32位w7怎么升64位|w7系统32位升级64位教程
很多人不清楚w7系统有32位和64位系统,安装w7之后才发现安装了w7 32位,无法识别4G以上的内存,通常32位系统只识别3.5G内存,64位系统则识别4G以上内存,如果内存大于4G,这时候就需要升 ...
- P40Pro鸿蒙ota升级,华为p40pro怎么升级鸿蒙系统_华为p40pro升级鸿蒙系统教程
华为p40pro是一款华为旗下的中高端手机,这款华为p40pro手机上市后就备受关注,这次最新推出的鸿蒙系统很受关注,那么华为p40pro怎么升级鸿蒙系统?接下来一起看看华为p40pro升级鸿蒙系统教 ...
- centos6.5 离线升级openssh7.7
centos6.5 离线升级openssh7.7 测试环境需要联网准备离线升级的安装包 使用环境:centos6.5 数据迁移到centos 9 openssh 版本太低导致6.5无法ssh到9上面. ...
- mate10鸿蒙系统升级,华为Mate10怎么升级鸿蒙系统 Mate10升级鸿蒙系统教程
本周三华为正式公测了鸿蒙系统,但是可惜的是Mate10并不在第一梯队可更新鸿蒙系统的机型之中,据小编得知Mtae10更新鸿蒙系统的时间将会在2022年,那么到时候华为Mate10怎么升级鸿蒙系统呢?我 ...
最新文章
- c索引超出了数组界限_Lua数组、Lua迭代器
- u3d:动态的用代码调节材质球的属性
- 妙趣横生算法 3:寻找相同元素的指针
- python package_python之package定义
- python是最好的语言 永远二十岁_“Python才是世界上最好的语言”
- 图书管理系统【JavaWeb:部署开发环境、解决分类、图书、前台页面模块】
- archive —— 软件历史版本存档及下载、jar 包
- Delphi2010 RTTI + Attribute 简单实现ORM实例
- html表单提交数据保存到mysql中_php – Canonical:如何将HTML表单数据保存到MySQL数据库中...
- ati自定义分辨率_Windows的自定义显示分辨率实用程序
- 用Java弹个Freepiano钢琴《The truth that you leave》
- leaflet中文文档
- ios自建服务器降级,苹果系统怎样降级?iOS11降级至iOS10的方法
- 矩阵求导及其链式法则
- 朴素贝叶斯和情感分类
- 【译】雄迈摄像头爆出Mirai僵尸网络
- MSDOS(MBR)与GPT磁盘分区表
- JS 四舍五入保留两位小数
- python读取邮件标题_Python连载57- 邮件头和主题、解析邮件
- emplace 和 emplace_back
热门文章
- 通过memcached来实现对tomcat集群中Session的共享策略 .
- NME的GLSL支持情况
- command-line: line 0: Bad configuration option: PermitLocalCommand
- mysql 索引 死锁,由不同的索引更新解决MySQL死锁套路
- java输入字符串异常_设计一个 Java 程序,自定义异常类,从命令行(键盘)输入一个字符串,如果该字符串值为“XYZ”。。。...
- java王者归来pdf_《JAVA WEB整合开发王者归来》刘京华.pdf
- 黑白球JAVA_桶中取黑白球 - jiacut的个人页面 - OSCHINA - 中文开源技术交流社区
- HDU1261(高精度乘法+高精度除法)
- 最小割 ---- 集合冲突模型
- asp.net js函数弹出登录窗口_JS基础 | Cocos Creator 开发环境搭建