189 8069 5689

怎样进行RHEL6_CentOS6_Openssh8.0p1升级

今天就跟大家聊聊有关怎样进行RHEL6_CentOS6_Openssh8.0p1升级,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。

我们提供的服务有:网站制作、网站建设、微信公众号开发、网站优化、网站认证、江永ssl等。为1000多家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的江永网站制作公司

创建软件存放目录:

--创建软件存放目录,并上传OS镜像、Openssh相关安装包到soft目录

[root@sshupdate ~]# 

mkdir -p /soft    

ll /soft/

mount OS系统镜像

mount -o loop /soft/rhel-server-6.9-x86_64-dvd.iso /mnt/

df -h

结果如下:

/soft/rhel-server-6.9-x86_64-dvd.iso

                      3.7G  3.7G     0 100% /mnt

配置本地YUM源

[root@sshupdate ~]# 

mkdir -p /etc/yum.repos.d/yumbak

mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/yumbak/

ll /etc/yum.repos.d/

[root@sshupdate ~]# 

[root@sshupdate ~]# vi /etc/yum.conf 

[rheldvd]

name=rheldvd

baseurl=file:///mnt

enabled=1

gpgcheck=0

[main]

[root@sshupdate ~]# yum list

Loaded plugins: product-id, refresh-packagekit, search-disabled-repos,

              : subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Installed Packages

ConsoleKit.x86_64                      0.4.1-6.el6                       @anaconda-RedHatEnterpriseLinux-201703082046.x86_64/6.9

ConsoleKit-libs.x86_64                 0.4.1-6.el6                       @anaconda-RedHatEnterpriseLinux-201703082046.x86_64/6.9

[root@sshupdate ~]# ssh -V

OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013

[root@sshupdate ~]# 

关闭防火墙

[root@sshupdate ]# 

service iptables stop

chkconfig iptables off

chkconfig iptables --list

结果如下:

iptables        0:off   1:off   2:off   3:off   4:off   5:off   6:off

安装及配置telnet

[root@sshupdate ]# yum install telnet* -y

[root@sshupdate ]# vi /etc/xinetd.d/telnet 

# default: on

# description: The telnet server serves telnet sessions; it uses \

#       unencrypted username/password pairs for authentication.

service telnet

        disable         = yes   --将yes修改为:no

}

[root@sshupdate ]# mv /etc/securetty /etc/securetty.old

[root@sshupdate ]# 

service xinetd start

service xinetd restart

chkconfig xinetd on

chkconfig xinetd --list

结果如下:

xinetd          0:off   1:off   2:on    3:on    4:on    5:on    6:off

[root@sshupdate ]# 

测试telnet

[root@sshupdate zlib-1.2.11]# telnet 192.168.147.129  或 telnet 192.168.147.129 22

Trying 192.168.147.129...

Connected to 192.168.147.129.

Escape character is '^]'.

Red Hat Enterprise Linux Server release 6.9 (Santiago)

Kernel 2.6.32-696.el6.x86_64 on an x86_64

sshupdate login: root  ----输入用户名

Password:    ----输入密码

Last login: Thu Jun 20 04:25:56 from 192.168.147.1

[root@sshupdate ~]# 

[root@sshupdate ~]# exit   --可以退出telnet操作也可以不退出

安装openssh所需要组件

[root@sshupdate ]# yum install gcc pam-devel zlib-devel -y

解压zlib库文件

[root@sshupdate ~]# 

cd /soft/openssh-update-8.0p1/

tar -xvzf zlib-1.2.11.tar.gz 

cd zlib-1.2.11

配置检查-编译-安装zlib

[root@sshupdate zlib-1.2.11]# 

./configure --prefix=/usr&&make&&make install

[root@sshupdate zlib-1.2.11]# 

echo '/usr/lib' >> /etc/ld.so.conf

ldconfig 

Cat /usr/lib

[root@sshupdate zlib-1.2.11]# ll /usr/lib/libz.so.1

lrwxrwxrwx. 1 root root 14 Jun 20 04:37 /usr/lib/libz.so.1 -> libz.so.1.2.11

[root@sshupdate zlib-1.2.11]# ll /usr/lib/libz.so

lrwxrwxrwx. 1 root root 14 Jun 20 04:37 /usr/lib/libz.so -> libz.so.1.2.11

查看已安装zlib库

[root@sshupdate ]# rpm -qa|grep zlib

zlib-devel-1.2.3-29.el6.x86_64

zlib-1.2.3-29.el6.x86_64

删除旧zlib库

[root@sshupdate ]# rpm -e --nodeps zlib

[root@sshupdate ]# 

[root@sshupdate ]# rpm -qa|grep zlib

rpm: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory

[root@sshupdate ]# 

升级openssl

[root@sshupdate zlib-1.2.11]# find / -name openssl

/etc/pki/ca-trust/extracted/openssl

/usr/lib64/openssl

/usr/bin/openssl

[root@sshupdate zlib-1.2.11]# 

[root@sshupdate zlib-1.2.11]# 

mv /usr/lib64/openssl /usr/lib64/openssl.old

mv /usr/bin/openssl /usr/bin/openssl.old

mv /etc/pki/ca-trust/extracted/openssl /etc/pki/ca-trust/extracted/openssl.old

[root@sshupdate zlib-1.2.11]# 

cp /usr/lib64/libcrypto.so.10 /usr/lib64/libcrypto.so.10.old

cp /usr/lib64/libssl.so.10 /usr/lib64/libssl.so.10.old

[root@sshupdate zlib-1.2.11]# rpm -qa|grep openssl|xargs

openssl-1.0.1e-57.el6.x86_64

[root@sshupdate ~]# 

rpm -qa|grep openssl|xargs -i rpm -e --nodeps {}

rpm -qa|grep openssl |xargs

[root@sshupdate ~]# 

cd /soft/openssh-update-8.0p1/

tar -xvzf openssl-1.0.2s.tar.gz

cd openssl-1.0.2s

./config --prefix=/usr/ --openssldir=/etc/ssl --shared zlib

make

make test

make install

查看升级后Openssl版本

[root@sshupdate openssl-1.0.2s]# openssl version

OpenSSL 1.0.2s  28 May 2019

[root@sshupdate openssl-1.0.2s]#

恢复库文件

[root@sshupdate openssl-1.0.2s]#

mv /usr/lib64/libcrypto.so.10.old /usr/lib64/libcrypto.so.10

mv /usr/lib64/libssl.so.10.old /usr/lib64/libssl.so.10

mv /etc/ssh /etc/ssh.old

升级Openssh

rpm -qa|grep openssh

rpm -qa|grep openssh|xargs -i rpm -e --nodeps {}

rpm -qa|grep openssh

install -v -m700 -d /var/lib/sshd

chown -v root:sys /var/lib/sshd/

groupadd -g 50 sshd

useradd -c 'sshd PrivSep' -d /var/lib/sshd -g sshd -s /bin/false -u 50 sshd 

[root@sshupdate ]#

cd /soft/openssh-update-8.0p1/

tar -xvzf openssh-8.0p1.tar.gz 

cd /soft/openssh-update-8.0p1/openssh-8.0p1

./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam--with-zlib --with-openssl-includes=/usr --with-privsep-path=/var/lib/sshd    ---注:是一行命令;

make

make install

结果如下:

/bin/mkdir -p /etc/ssh

ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519 

/usr/sbin/sshd -t -f /etc/ssh/sshd_config

[root@sshupdate openssh-8.0p1]# 

[root@sshupdate openssh-8.0p1]#

install -v -m755 contrib/ssh-copy-id /usr/bin/

install -v -m644 contrib/ssh-copy-id.1 /usr/share/man/man1

install -v -m755 -d /usr/share/doc/openssh-8.0p1

install -v -m744 INSTALL LICENCE OVERVIEW README* /usr/share/doc/openssh-8.0p1/

[root@sshupdate openssh-8.0p1]# ssh -V

OpenSSH_8.0p1, OpenSSL 1.0.2s  28 May 2019

[root@sshupdate openssh-8.0p1]# 

[root@sshupdate openssh-8.0p1]# 

echo "X11Forwarding yes" >> /etc/ssh/sshd_config 

echo "PermitRootLogin yes" >> /etc/ssh/sshd_config 

cat /etc/ssh/sshd_config 

结果如下:

……………………省略…………………………

X11Forwarding yes

PermitRootLogin yes

[root@sshupdate openssh-8.0p1]# 

[root@sshupdate openssh-8.0p1]# 

cp -p contrib/redhat/sshd.init /etc/init.d/sshd

chmod +x /etc/init.d/sshd 

ll /etc/init.d/sshd 

chkconfig --add sshd

chkconfig sshd on

chkconfig sshd --list

结果如下:

sshd            0:off   1:off   2:on    3:on    4:on    5:on    6:off

[root@sshupdate openssh-8.0p1]# 

[root@sshupdate openssh-8.0p1]# vi /etc/selinux/config    

SELINUX=enforcing   ----修改enforcing为:disabled     --务必修改否则ssh无法正常登录

[root@sshupdate openssh-8.0p1]# reboot

[root@sshupdate ]#

[root@sshupdate ~]# vi /etc/xinetd.d/telnet 

# default: on

# description: The telnet server serves telnet sessions; it uses \

#       unencrypted username/password pairs for authentication.

service telnet

       disable         = no   --将no修改为:yes

}

[root@sshupdate ~]# 

[root@sshupdate ~]# mv /etc/securetty.old /etc/securetty

[root@sshupdate ~]#

service xinetd stop

chkconfig xinetd off

chkconfig xinetd --list

结果如下:

xinetd          0:off   1:off   2:off   3:off   4:off   5:off   6:off

[root@sshupdate ~]# 

方法二:

mount -o loop /soft/rhel-server-6.9-x86_64-dvd.iso /mnt/

yum remove telnet* -y

[root@sshupdate ~]# 

[root@sshupdate ~]# ssh -V

OpenSSH_8.0p1, OpenSSL 1.0.2s  28 May 2019

[root@sshupdate ~]# 

[root@sshupdate ~]# 

[root@sshupdate ~]# reboot    --重启正常登录即可

[root@sshupdate ~]#    

看完上述内容,你们对怎样进行RHEL6_CentOS6_Openssh8.0p1升级有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注创新互联行业资讯频道,感谢大家的支持。


分享题目:怎样进行RHEL6_CentOS6_Openssh8.0p1升级
网页链接:http://jkwzsj.com/article/psjois.html

其他资讯