安装OpenSsh8.1+LibreSSL 3.0.2(ssh升级)
1 2 3 | zlib下载地址: http: //www .zlib.net/ LibreSSL下载地址: https: //ftp .openbsd.org /pub/OpenBSD/LibreSSL/ OpenSSH下载地址: http: //mirror .aarnet.edu.au /pub/OpenBSD/OpenSSH/portable/ |
1 2 3 | rpm -ivh mpfr-2.4.1-6.el6.x86_64.rpm rpm -ivh gmp-devel-4.3.1-7.el6_2.2.x86_64.rpm rpm -ivh mpfr-devel-2.4.1-6.el6.x86_64.rpm |
1、安装zlib
1 2 3 4 | tar -xzvf zlib-1.2.11. tar .gz cd zlib-1.2.11 . /configure --prefix= /usr/local/zlib-1 .2.11 make && make install |
如果需要升级ntp的话,一定要再升级ssl前升级ntp,否则会报如下错误:
1 2 3 4 5 6 7 8 9 10 11 12 13 | libsntp.a(crypto.o): In function `compute_mac': /usr/local/ntp-4 .2.8p13 /sntp/crypto .c:79: undefined reference to `EVP_MD_CTX_new' /usr/local/ntp-4 .2.8p13 /sntp/crypto .c:117: undefined reference to `EVP_MD_CTX_free' collect2: ld returned 1 exit status make [4]: *** [sntp] 错误 1 make [4]: Leaving directory ` /usr/local/ntp-4 .2.8p13 /sntp ' make [3]: *** [all-recursive] 错误 1 make [3]: Leaving directory ` /usr/local/ntp-4 .2.8p13 /sntp ' make [2]: *** [all] 错误 2 make [2]: Leaving directory ` /usr/local/ntp-4 .2.8p13 /sntp ' make [1]: *** [all-recursive] 错误 1 make [1]: Leaving directory ` /usr/local/ntp-4 .2.8p13' make : *** [all] 错误 2 |
2、安装libressl
千万不要删除旧版本的openssl,有可能导致yum无法正常使用。
1 2 3 4 | cd libressl-3.0.2 . /configure --prefix= /usr/local make make install |
libressl代替openssl
1 2 3 4 5 | vim /etc/ld .so.conf.d /local .conf #新建local.conf文件,添加下面一行 /usr/local/lib # 将 /usr/local/lib 目录加入到模块加载目录。 ldconfig - v #重新加载共享模块: openssl version #查看版本 |
安装openssh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #--with-ssl-dir 指定ssl的安装目录 #--with-zlib 指定zlib的安装目录 . /configure --prefix= /usr/local/openssh-8 .1p1 --sysconfdir= /etc/ssh --with-ssl- dir = /usr/local --with-zlib= /usr/local/zlib-1 .2.11 --with-md5-passwords make make install cd /etc/init .d/ mv sshd sshd.bak cd /usr/local/openssh-8 .1p1 /contrib/redhat/ cp -p sshd.init /etc/init .d /sshd vi /etc/init .d /sshd SSHD= /usr/local/openssh-8 .1p1 /sbin/sshd #25行 SSHD=/usr/sbin/sshd /usr/local/openssh-8 .1p1 /bin/ssh-keygen -A #41行 /usr/bin/ssh-keygen -A chkconfig --add sshd chkconfig sshd on chkconfig --list sshd service sshd restart vim /etc/profile export PATH= /usr/local/openssh-8 .1p1 /bin :$PATH |
CentOS7(RedHat7)需要再做以下操作。
将systemctl下的原ssh相关文件移走,将不然升级后的openssh不兼容。
1 | mv /usr/lib/systemd/system/ssh * /opt |
vi /etc/ssh/sshd_config //增加下一行
1 | PermitRootLogin yes |
service sshd restart
vi /etc/profile 或者 ~/.bash_profile 设置PATH变量
1 | export PATH= /usr/local/openssh-8 .1p1 /sbin : /usr/local/openssh-8 .1p1 /bin :$PATH |
source /etc/profile
验证:
1 2 | ssh -V openssl version |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 25岁的心里话
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现