环境:
centos 6.9
1、不说啥
[root@master ~]#yum -y install pam-devel rpm-build rpmdevtools \ zlib-devel krb5-devel tcp_wrappers tcp_wrappers-devel \ tcp_wrappers-libs libX11-devel xmkmf libXt-devel wget
2、也不说啥
[root@master ~]#cd ~ [root@master ~]#mkdir -pv rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} mkdir: created directory `rpmbuild' mkdir: created directory `rpmbuild/BUILD' mkdir: created directory `rpmbuild/BUILDROOT' mkdir: created directory `rpmbuild/RPMS' mkdir: created directory `rpmbuild/SOURCES' mkdir: created directory `rpmbuild/SPECS' mkdir: created directory `rpmbuild/SRPMS'` [root@master ~/rpmbuild/SOURCES]#wget http://openbsd.hk/pub/OpenBSD/OpenSSH/portable/openssh-7.6p1.tar.gz [root@master ~/rpmbuild/SOURCES]#cd ../SPECS/ [root@master ~/rpmbuild/SPECS]#tar xf ../SOURCES/openssh-7.6p1.tar.gz [root@master ~/rpmbuild/SPECS]#ls openssh-7.6p1 [root@master ~/rpmbuild/SPECS]#cp openssh-7.6p1/contrib/redhat/openssh.spec . [root@master ~/rpmbuild/SPECS]#sed -i -e "s/%define no_gnome_askpass 0/%define no_gnome_askpass 1/g" openssh.spec [root@master ~/rpmbuild/SPECS]#sed -i -e "s/%define no_x11_askpass 0/%define no_x11_askpass 1/g" openssh.spec [root@master ~/rpmbuild/SPECS]#sed -i -e "s/BuildPreReq/BuildRequires/g" openssh.spec [root@master ~/rpmbuild/SPECS]#mv openssh.spec openssh-7.6p1.spec [root@master ~/rpmbuild/SPECS]#ll total 44 drwxr-xr-x 5 1000 1000 12288 Oct 4 00:06 openssh-7.6p1 -rw-r--r-- 1 root root 28679 Feb 8 18:48 openssh-7.6p1.spec [root@master ~/rpmbuild/SPECS]#rm openssh-7.6p1 moved to /data/trash/20180208-184902 ok [root@master ~/rpmbuild/SPECS]#rpmbuild -bb openssh-7.6p1.spec [root@master ~/rpmbuild/RPMS/x86_64]#ll total 1416 -rw-r--r-- 1 root root 458540 Feb 8 18:58 openssh-7.6p1-1.x86_64.rpm -rw-r--r-- 1 root root 578252 Feb 8 18:58 openssh-clients-7.6p1-1.x86_64.rpm -rw-r--r-- 1 root root 16960 Feb 8 18:58 openssh-debuginfo-7.6p1-1.x86_64.rpm -rw-r--r-- 1 root root 388048 Feb 8 18:58 openssh-server-7.6p1-1.x86_64.rpm
3、升级
[root@master ~/rpmbuild/RPMS/x86_64]#ssh -V OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013 [root@master ~/rpmbuild/RPMS/x86_64]#yum install -y * [root@master ~/rpmbuild/RPMS/x86_64]#ssh -V OpenSSH_7.6p1, OpenSSL 1.0.1e-fips 11 Feb 2013 配置文件不同,需使用新配置文件。使用旧配置文件,重启服务,不能登录 [root@master /etc/ssh]#cp sshd_config.rpmnew sshd_config cp: overwrite `sshd_config'? y 修改Port 修改PermitRootLogin prohibit-password修改为PermitRootLogin yes [root@master /etc/ssh]#service sshd restart
重要!退出之前打开一个新的SSH会话连接到你的服务器,以确保一切正常!如果你有问题,可用以下命令降级到之前版本
要是感觉还是不可靠,可使用telnet来作为备用连接,具体看相应博文
yum downgrade openssh-server openssh-clients openssh cp /etc/ssh/sshd_config.rpmnew /etc/ssh/sshd_config /etc/init.d/sshd restart
问题处理
在制作的时候你可能会发现有些依赖包没有,你可以使用yum工具自带的搜索功能,比如,当提示你libxml.h找不到时,你可以使用命令:
yum provides */libxml.h 找到对应的包名后,即可以使用以下命令进行安装: yum install -y rpm-package-name
参考文档:https://www.hi-linux.com/posts/12788.html
–
–
–
评论前必须登录!
注册