配置网络yum源
1.备份当前的YUM仓库配置文件,以防需要恢复:
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2.配置网易yum源:
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo -O /etc/yum.repos.d/CentOS-Base.repo
3.清除YUM缓存并使新的配置生效:
yum clean all yum makecache yum update
openssh rpm包制作
1.准备CentOS7编译环境
yum groupinstall -y "Development Tools" yum install -y imake rpm-build pam-devel krb5-devel zlib-devel libXt-devel libX11-devel gtk2-devel
2.下载编译打包的shell脚本包并解压
GitHub地址:https://github.com/boypt/openssh-rpms
wget https://github.com/boypt/openssh-rpms/archive/refs/heads/main.zip
解压
unzip main.zip -d /opt cd /opt/openssh-rpms-main/
3.修改pullsrc.sh脚本参数
脚本23行修改为:source ./version.env
检查脚本中wget 是否有忽略 SSL 证书验证,选项为:--no-check-certificate (示例:wget --no-check-certificate $OPENSSLMIR/$OPENSSLSRC)
新版本一般不用修改,默认已添加
检查openssh源码中有没有ssh-copy-id
vim /opt/openssh-rpms-main/el7/SPECS/openssh.spec
搜索相关ssh-copy-id 参数,能搜到即有,新版本默认都有
4.修改version.env,将变量中的包修改为要升级的版本包
下载升级的版本包放到downloads目录下
5.编译打包
./compile.sh
执行结果如下:
6.升级测试
# cd /opt/openssh-rpms-main/el7/RPMS/x86_64/ # yum localinstall ./* # ssh -V OpenSSH_9.6p1, OpenSSL 1.1.1w 11 Sep 2023
7.升级后重启sshd服务问题处理
1)服务重启失败
# systemctl restart sshd Job for sshd.service failed because the control process exited with error code. See "systemctl status sshd.service" and "journalctl -xe" for details.
提示权限不正确,私钥文件权限太开放,解决方法:
chmod 600 /etc/ssh/ssh_host_ecdsa_key chmod 600 /etc/ssh/ssh_host_ed25519_key
2)root登录被拒绝
日志内容:
升级后原先得/etc/ssh/sshd_config 文件被覆盖,不允许root登录,解决方法:
vim /etc/ssh/sshd_config
PermitRootLogin yes ## 打开这行注释,保存退出重启sshd服务即可
标签:sshd,p1,openssh,devel,etc,yum,ssh,OpenSSH9.6,安装包 From: https://www.cnblogs.com/goujinyang/p/18241776