手动安装openssl,openssh

背景

linux上的openssl,openssh可能是比较旧的版本。且没办法通过包管理工具进行更新,例如apt。这种情况就需要手动安装。以下操作在ubuntu18.04下通过。

卸载旧版openssh

systemctl stop sshd
systemctl disable sshd
sudo apt remove openssh-client openssh-server

安装openssl

export openssl_ver=openssl-1.1.1k
版本可按需修改
wget https://www.openssl.org/source/${openssl_ver}.tar.gz --no-check-certificate
tar zxvf ${openssl_ver}.tar.gz
cd ${openssl_ver}
./config && make && make install
完成后通过以下命令查看版本
openssl version

安装openssh

export openssh_ver=openssh-8.7p1
版本可按需修改
wget ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/${openssh_ver}.tar.gz --no-check-certificate
tar zxvf ${openssh_ver}.tar.gz
cd ${openssh_ver}
./configure && make && make install
默认安装路径为/usr/local/
vi /etc/profile
将openssh加入环境变量
export PATH=$PATH:/usr/local/sbin:/usr/local/bin
. /etc/profile
ssh -V

增加开机自启动

方法有很多,这里采用最简单的方法
chmod a+x /etc/rc.local
vi /etc/rc.local
增加/usr/local/sbin/sshd

posted @ 2021-09-14 11:44  bert_qin  阅读(296)  评论(0编辑  收藏  举报