以Root用户上传升级包至/home/dou/system
openssh-7.5p1.tar.gz
openssl-1.0.2l.tar.gz
zlib-1.2.11.tar.gz
l 安装所需包
挂载镜像
#mount -t iso9660 /home/dou/system/rhel-server-7.2-x86_64-dvd.iso /mnt/system/ -o loop
l 安装包
#yum -y install gcc pam-devel zlib-devel
l 解压包
#cd /home/dou/system/
#tar -zxvf zlib-1.2.11.tar.gz
#cd zlib-1.2.11/
l 编译
#./configure --prefix=/usr
#make (不可忘记)
l 卸载当前zlib
#rpm -e --nodeps zlib
l 安装之前编译的
#make install
l 共享库注册
#echo '/usr/lib' >> /etc/ld.so.conf
#ldconfig
l 备份当前openssl
#mv /etc/pki/ca-trust/extracted/openssl /etc/pki/ca-trust/extracted/openssl.old
# mv /usr/bin/openssl /usr/bin/openssl.old
#mv /usr/lib64/openssl /usr/lib64/openssl.old
备份库文件
# cp /usr/lib64/libcrypto.so.10 /usr/lib64/libcrypto.so.10.old
# cp /usr/lib64/libssl.so.10 /usr/lib64/libssl.so.10.old
l 卸载当前openssl
#rpm -qa |grep openssl|xargs -i rpm -e --nodeps {}
(报错信息可忽略,因为目录我们已经改名字了)
l 解压openssl-1.0.2l.tar.gz
#cd ../
#tar -zxvf openssl-1.0.2l.tar.gz
#cd openssl-1.0.2l/
# ./config --prefix=/usr --openssldir=/etc/ssl --shared zlib
#make
#make test
#make install
#openssl version -a (查看版本)
l 恢复共享库
# mv /usr/lib64/libcrypto.so.10.old /usr/lib64/libcrypto.so.10
# mv /usr/lib64/libssl.so.10.old /usr/lib64/libssl.so.10
l 备份当前openssh
mv /etc/ssh /etc/ssh.old
l 卸载当前openssh
#rpm -qa |grep openssh|xargs -i rpm -e --nodeps {}
l 安装前环境配置
# install -v -m700 -d /var/lib/sshd
# chown -v root:sys /var/lib/sshd
l 解压openssh_7.5p1源码并编译安装
#cd ../
#tar -zxvf openssh-7.5p1.tar.gz
#cd openssh-7.5p1/
#./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
l openssh安装后环境配置
# 在openssh编译目录执行如下命令
# 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-7.5p1
# install -v -m644 INSTALL LICENCE OVERVIEW README* /usr/share/doc/openssh-7.5p1
# ssh -V #验证是否升级成功
l 启用OpenSSH服务
#echo 'X11Forwarding yes' >> /etc/ssh/sshd_config
#echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
#cp -p contrib/redhat/sshd.init /etc/init.d/sshd
#chmod +x /etc/init.d/sshd
#/sbin/chkconfig --add sshd
#/sbin/chkconfig sshd on
#service sshd restart