Ubuntu20.04升级openssh9.9版本
基本环境
//操作系统
root@qa-socksd:~# more /etc/os-release
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
ubuntu 22.04
//openssh版本
root@qa-socksd:~# ssh -V
OpenSSH_8.2p1 Ubuntu-4ubuntu0.11, OpenSSL 1.1.1f 31 Mar 2020
备份原文件
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.old
cp /etc/ssh/ssh_config /etc/ssh/ssh_config.old
安装依赖
sudo apt install -y build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libncurses5-dev libsqlite3-dev libgdbm-dev libdb-dev libexpat-dev libpcap-dev openssl
源码下载
root@qa-socksd:~# wget https://mirrors.aliyun.com/openssh/portable/openssh-9.9p1.tar.gz
--2025-02-10 06:49:17-- https://mirrors.aliyun.com/openssh/portable/openssh-9.9p1.tar.gz
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 182.40.124.112, 150.139.142.231, 150.139.142.232, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|182.40.124.112|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1964864 (1.9M) [application/octet-stream]
Saving to: ‘openssh-9.9p1.tar.gz’
openssh-9.9p1.tar.gz 100%[===================================================================================================================================>] 1.87M 4.17MB/s in 0.4s
2025-02-10 06:49:18 (4.17 MB/s) - ‘openssh-9.9p1.tar.gz’ saved [1964864/1964864]
解压源码
root@qa-socksd:~# tar -xzvf openssh-9.9p1.tar.gz
root@qa-socksd:~# cd openssh-9.9p1
配置编译选项
root@qa-socksd:~# ./configure --prefix=/usr/local/openssh-9.9p1 --sysconfdir=/etc/ssh
编译与安装
make && make install
替换文件
cp -arpf /usr/local/openssh-9.9p1/bin/* /usr/bin/
cp -arpf /usr/local/openssh-9.9p1/sbin/* /usr/sbin/
更新ssh配置文件
root@qa-socksd:~/openssh-9.9p1# vim /etc/ssh/sshd_config
#允许root远程访问
PermitRootLogin yes
重启
systemctl daemon-reload
systemctl restart ssh
验证版本
root@qa-socksd:~/openssh-9.9p1# ssh -V
OpenSSH_9.9p1, OpenSSL 1.1.1f 31 Mar 2020
THE END