离线的意思是为Linux无法链接网络,只能通过windows 将文件上传
一、首先准备软件Xshell与Xftp
我们个人使用可以去官网下载https://www.netsarang.com/zh/free-for-home-school/
在这里插入图片描述
选择两者,官方会将下载链接发送邮件到你填写的邮箱
二、首先在官网下载所需要的SSH与SSL
此处为SSL版本下载,文件的上传可以使用Xftp
https://ftp.openssl.org/source/
在这里插入图片描述
此处为SSH版本下载,文件的上传可以使用Xftp
http://us.archive.ubuntu.com/ubuntu/pool/main/o/openssh/
在这里插入图片描述
三、放置文件位置
openssl-1.1.1l.tar.gz 放置在/usr/local/src下
openssh-8.8p1.tar放置在 /opt 目录下
四、确认是否安装gcc编译器
执行命令: gcc -v
如果未安装的话请参考
https://www.imooc.com/article/17780?block_id=tuijian_wz%20yum%20-y%20install%20gcc%20gcc-c++%20kernel-devel%20//
五、升级SSL
执行命令:cd /usr/local/src
执行解压命令:tar xzvf openssl-1.1.1l.tar.gz
执行命令:cd openssl-1.1.1l
执行命令:sudo ./config --prefix=/usr/local/openssl
执行命令:make
执行命令:make install
执行命令:mv /usr/bin/openssl /usr/bin/openssl.bak
(是否覆盖回复y或者Y)
执行命令:ln -sf /usr/local/openssl/bin/openssl /usr/bin/openssl
执行命令:echo “/usr/local/openssl/lib” >> /etc/ld.so.conf
执行命令:ldconfig -v
查看SSL版本:openssl version
六、升级SSH
执行命令:cd /opt
执行解压命令:tar xzvf openssh-8.8p1.tar.gz
删除原有的ssh相关文件:通过xftp将/etc/ssh/* 下的文件删除
(注意!注意!注意!卸载完成服务器ssh服务就会停掉,此时客户端连接的不能断开,在ssh没安装好之前也不可重启ssh服务和服务器,否则断开之后将无法进行远程连接)
执行命令:cd /opt/openssh-8.8p1/
执行命令:

./configure --prefix=/usr/ --sysconfdir=/etc/ssh  --with-openssl-includes=/usr/local/ssl/include --with-ssl-dir=/usr/local/ssl   --with-zlib   --with-md5-passwords   --with-pam && make && make install

执行命令:cp -a contrib/redhat/sshd.init /etc/init.d/sshd
(是否覆盖回复y或者Y)
执行命令:cp -a contrib/redhat/sshd.pam /etc/pam.d/sshd.pam
(是否覆盖回复y或者Y)
执行命令:chmod +x /etc/init.d/sshd
执行命令:chkconfig --add sshd
执行命令:chkconfig sshd on
执行重启命令: service sshd restart
查看SSH版本:ssh -V
七、可能会遇到的问题
(1)、无法使用root用户进行操作
配置允许root使用ssh: vim /etc/ssh/sshd_config 增加内容: PermitRootLogin yes
(不太建议这么做,可以使用普通账号先连接服务器,然后su命令切换到root用户进行操作)
在这里插入图片描述
(2)、进入到目录 /etc/ssh/sshd_config 将 PasswordAuthentication yes 注释打开,启用公钥身份验证;
在这里插入图片描述

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐