链接: https://pan.baidu.com/s/13k6Tg8EUy2O9QBu-QhWiUA?pwd=1111 提取码: 1111
–来自百度网盘超级会员v5的分享
上面是所有rpm依赖包 + openssl3.3.1+openssh9.8p1源码
解压
tar -xzvf gcc.tar.gz
tar -xzvf perl.tar.gz
安装gcc依赖包
cd gcc
rpm -Uvh *.rpm --nodeps --force
安装perl 相关包
cd Perl
rpm -Uvh *.rpm --nodeps --force
包里有zlib 直接编译安装openssl
卸载原有的openssl
# 会输出例如:openssl-1.0.2k-12.el7.x86_64
rpm -qa | grep openssl | grep -v lib
# openssl-1.0.2k-8.el7.x86_64 为上面命令的输出
yum -y remove openssl-1.0.2k-12.el7.x86_64
安装
tar -xzvf openssl-3.3.1.tar.gz
cd openssl-3.3.1
#生成makefile文件
./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl -Wl,-rpath,/usr/local/openssl/lib64 shared
make && make insall
#make报错执行不了cc1 用rpm命令覆盖安装ccp rpm包 (rpm -pql查到的)
生成文件在 /usr/libexec/gcc/x86_64-redhat-linux/自己版本号下/cc1
ln -s /usr/local/openssl/bin/openssl /usr/bin/open
ln -s /usr/local/openssl/include/openssl /usr/include/openssl
#注意/usr/local/openssl目录下是lib还是lib64
echo "/usr/local/openssl/lib64" >> /etc/ld.so.conf
ldconfig
安装openssh
#解压
tar -xzvf openssh-9.8p1.tar.gz
cd openssh-9.8p1
#删除原有版本
rpm -qa | grep openssh
yum -y remove openssh-server-7.4p1-21.el7.x86_64
yum -y remove openssh-clients-7.4p1-21.el7.x86_64
yum -y remove openssh-7.4p1-21.el7.x86_64
#备份Open SSH配置文件
cp -r /etc/ssh /etc/ssh.bak
rm -rf /etc/ssh
#安装
./configure --prefix=/usr/local/openssh --sysconfdir=/etc/ssh --with-openssl-includes=/usr/local/openssl/include --with-ssl-dir=/usr/local/openssl --with-zlib --with-md5-passwords --with-pam --with-ssl-engine
make && make install
#创建软链接
ln -s /usr/local/openssh/sbin/sshd /usr/sbin/sshd
ln -s /usr/local/openssh/bin/ssh /usr/bin/ssh
ln -s /usr/local/openssh/bin/ssh-add /usr/bin/ssh-add
ln -s /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen
ln -s /usr/local/openssh/bin/ssh-keyscan /usr/bin/ssh-keyscan
#将openssh的服务脚本复制到/etc/init.d目录下 增加执行权限
cp contrib/redhat/sshd.init /etc/init.d/sshd
chmod u+x /etc/init.d/sshd
#添加sshd服务
chkconfig --add sshd
#检查openssh版本
ssh -V
vi /etc/ssh/sshd_config
systemctl restart sshd
#找到 PermitRootLogin 改为 yes
#默认不允许root账号登录
参考
https://blog.csdn.net/qq_40507015/article/details/140288895