赞
踩
- 由于openssh在CentOS 8系列系统中yum源最新版本是8.0,而opensh漏洞比较多
-
- openssh-server-8.0p1-10.el8.x86_64
- openssh-clients-8.0p1-10.el8.x86_64
- openssh-8.0p1-10.el8.x86_64
-
- cat /etc/os-release
- NAME="CentOS Linux"
- VERSION="8"
- ID="centos"
- ID_LIKE="rhel fedora"
- VERSION_ID="8"
- PLATFORM_ID="platform:el8"
- PRETTY_NAME="CentOS Linux 8"
- ANSI_COLOR="0;31"
- CPE_NAME="cpe:/o:centos:centos:8"
- HOME_URL="https://centos.org/"
- BUG_REPORT_URL="https://bugs.centos.org/"
- CENTOS_MANTISBT_PROJECT="CentOS-8"
- CENTOS_MANTISBT_PROJECT_VERSION="8"
- [root@localhost ~]# cat /etc/redhat-release
- CentOS Linux release 8.5.2111
-
- 这是当前的环境信息
- 1.安装制作的工具
- dnf install rpm-build zlib-devel openssl-devel gcc perl-devel pam-devel libXt-devel gtk2-devel make perl -y
-
- wget http://www.rpmfind.net/linux/centos/8-stream/PowerTools/x86_64/os/Packages/imake-1.0.7-11.el8.x86_64.rpm
-
- rpm -ivh imake-1.0.7-11.el8.x86_64.rpm
-
- 2.下载源码
-
- wget https://src.fedoraproject.org/repo/pkgs/openssh/x11-ssh-askpass-1.2.4.1.tar.gz/8f2e41f3f7eaa8543a2440454637f3c3/x11-ssh-askpass-1.2.4.1.tar.gz
-
- wget https://mirrors.aliyun.com/pub/OpenBSD/OpenSSH/portable/openssh-9.0p1.tar.gz
-
- 3.初始化
- rpmbuild -ba openssh.spec
-
- 4.拷贝源码包到相应目录
- cp openssh-9.0p1.tar.gz x11-ssh-askpass-1.2.4.1.tar.gz /root/rpmbuild/SOURCES
-
- 5.解压源码包,拷贝spec文件
-
- tar -zxf openssh-9.0p1.tar.gz
-
- cp openssh-9.0p1/contrib/redhat/openssh.spec /root/rpmbuild/SPECS/
-
- 6.切换目录,修改openssh.spec文件
- cd rpmbuilld/SPEC
-
- 注释#BuildRequires: openssl-devel < 1.1
-
- 7.制作rpm包
-
- rpmbuild -ba openssh.spec
-
- 制作完成后生成的包:
- tree rpmbuild/RPMS/x86_64/
- rpmbuild/RPMS/x86_64/
- ├── openssh-9.0p1-1.el8.x86_64.rpm
- ├── openssh-askpass-9.0p1-1.el8.x86_64.rpm
- ├── openssh-askpass-debuginfo-9.0p1-1.el8.x86_64.rpm
- ├── openssh-askpass-gnome-9.0p1-1.el8.x86_64.rpm
- ├── openssh-askpass-gnome-debuginfo-9.0p1-1.el8.x86_64.rpm
- ├── openssh-clients-9.0p1-1.el8.x86_64.rpm
- ├── openssh-clients-debuginfo-9.0p1-1.el8.x86_64.rpm
- ├── openssh-debuginfo-9.0p1-1.el8.x86_64.rpm
- ├── openssh-debugsource-9.0p1-1.el8.x86_64.rpm
- ├── openssh-server-9.0p1-1.el8.x86_64.rpm
- └── openssh-server-debuginfo-9.0p1-1.el8.x86_64.rpm
- 利用制作的rpm包对openssh进行升级
-
- 升级只需要三个rpm包:
- openssh-9.0p1-1.el8.x86_64.rpm
- openssh-clients-9.0p1-1.el8.x86_64.rpm
- openssh-server-9.0p1-1.el8.x86_64.rpm
-
- #升级安装
-
- 注意:升级后的ssh会受到selinux影响,建议配置disabled
- setenforce 0
-
- dnf install ./*.rpm
-
- #设置权限
- chmod 600 /etc/ssh/ssh_host*key
-
- echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
- echo 'PasswordAuthentication yes' >> /etc/ssh/sshd_config
-
- #重启sshd服务
- systemctl restart sshd && systemctl enable sshd
-
- #验证版本
- [root@localhost ~]# ssh -V
- OpenSSH_9.0p1, OpenSSL 1.1.1k FIPS 25 Mar 2021
-
打包好的rpm包下载:
openssh-9.0p1-el8.tgz-Linux文档类资源-CSDN下载
可以拿来制作的src包:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。