测试镜像
Kylin-Server-V10-SP3-2403-Release-20240426-x86_64.iso
# 安装必备和常用软件包
yum -y install gcc make vim wget telnet net-tools tcpdump tar perl nc
# 安装zlib
./configure --prefix=/usr/local/zlib make && make install
# 安装openssl
./config --prefix=/usr/local/openssl make && echo $? #输出0则代表没有错误 make -j 4 install
# 覆盖创建软链接
ln -sf /usr/local/openssl/include/openssl /usr/include/openssl ln -sf /usr/local/openssl/bin/openssl /usr/bin/openssl ln -sf /usr/local/openssl/lib64/libssl.so.3 /usr/lib64/libssl.so.3 ln -sf /usr/local/openssl/lib64/libcrypto.so.3 /usr/lib64/libcrypto.so.3
# 验证版本
openssl version -a
# 安装openssh
./configure --prefix=/usr/local/openssh/ --sysconfdir=/etc/ssh/ --with-ssl-dir=/usr/local/openssl/ --with-zlib=/usr/local/zlib/ --without-openssl-header-check make -j 4 && make install
# 从安装目录创建软连接到系统目录
ln -sf /usr/local/openssh/sbin/sshd /sbin/sshd ln -sf /usr/local/openssh/bin/ssh /usr/bin/ssh ln -sf /usr/local/openssh/bin/scp /usr/bin/scp ln -sf /usr/local/openssh/bin/sftp /usr/bin/sftp ln -sf /usr/local/openssh/bin/ssh-add /usr/bin/ssh-add ln -sf /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen ln -sf /usr/local/openssh/bin/ssh-keyscan /usr/bin/ssh-keyscan
# 从安装包复制脚本文件到系统,脚本包含启动,停止,重启
cp -rf /root/soft/openssh-9.8p1/contrib/redhat/sshd.init /etc/init.d/sshd
# 从安装包复制认证模块规则的配置文件到系统。
cp -rf /root/soft/openssh-9.8p1/contrib/redhat/sshd.pam /etc/pam.d/sshd
# 将 sshd 服务添加到 chkconfig 的管理列表中。这意味着 chkconfig 现在可以管理 sshd 服务的启动、停止和重启。
chkconfig --add sshd
# 设置 sshd 服务在系统启动时自动启动
chkconfig sshd on
# 检查错误
sshd -T
# 当出现下面的提示,我们直接注销掉配置文件中无效的行
/etc/ssh/sshd_config line 80: Unsupported option GSSAPIAuthentication
/etc/ssh/sshd_config line 81: Unsupported option GSSAPICleanupCredentials
/etc/ssh/sshd_config line 97: Unsupported option UsePAM
/etc/ssh/sshd_config line 147: Deprecated option RSAAuthentication
/etc/ssh/sshd_config line 149: Deprecated option RhostsRSAAuthentication
/etc/ssh/sshd_config: line 170: Bad configuration option: GSSAPIKexAlgorithms
sed -i '80s/^/#/' /etc/ssh/sshd_config sed -i '81s/^/#/' /etc/ssh/sshd_config sed -i '97s/^/#/' /etc/ssh/sshd_config sed -i '147s/^/#/' /etc/ssh/sshd_config sed -i '149s/^/#/' /etc/ssh/sshd_config sed -i '170s/^/#/' /etc/ssh/sshd_config
# 查看sshd服务
systemctl status sshd
标签:bin,sshd,p1,OpenSSH,V10,etc,ssh,local,usr From: https://www.cnblogs.com/jianxiaoxiu/p/18409709