源码仓库
说明
- 原则上
仅安装必要的软件(最小化安装所需软件,对系统影响最小)
CentOS 系列编译安装
- 本示例以
CentOS 7.9.2009、OpenSSH V_9_3_P2 为例
CentOS 7.9.2009 的安装源中,截止 2025-12-10 只能下载到 OpenSSL 1.0.2k-fips
OpenSSH V_9_3_P2 以后的版本(不包含)所需 OpenSSL 最低要求 1.1.1
- 如果要安装
OpenSSH V_9_3_P2 以后的版本(不包含),可根据 openssl.md 安装 OpenSSL 1.1.1w
- 注意:
CentOS 7.9.2009 不支持 OpenSSH V_9_9_P1 及之后的版本
- 注意:
CentOS 8.0.1905 支持 OpenSSH V_9_9_P1
下载源码
解压
# 解压
# yum -y install tar
tar -zxvf openssh-portable-V_9_3_P2.tar.gz
# 进入解压后的目录
cd openssh-portable-V_9_3_P2
可选安装 autoconf
# 执行 autoreconf 时报错
[root@centos7-9 openssh-portable-V_9_3_P2]# autoreconf
-bash: autoreconf: command not found
[root@centos7-9 openssh-portable-V_9_3_P2]#
# 安装 autoreconf 命令所需依赖
yum -y install autoconf
# 安装完成,即可正常执行 autoreconf 命令
可选安装 automake
# 执行 autoreconf 时报错
[root@centos7-9 openssh-portable-V_9_3_P2]# autoreconf
Can't exec "aclocal": No such file or directory at /usr/share/autoconf/Autom4te/FileUtils.pm line 326.
autoreconf: failed to run aclocal: No such file or directory
[root@centos7-9 openssh-portable-V_9_3_P2]#
# 安装 autoreconf 命令所需依赖
yum -y install automake
# 安装完成,即可正常执行 autoreconf 命令
可选安装 gcc
[root@centos7-9 openssh-portable-V_9_3_P2]# ./configure
checking for cc... no
checking for gcc... no
checking for clang... no
configure: error: in `/root/openssh-portable-V_9_3_P2':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
[root@centos7-9 openssh-portable-V_9_3_P2]#
# 安装 ./configure 命令所需依赖
yum -y install gcc
# 安装完成,即可正常执行 ./configure 命令
可选安装 zlib-devel
[root@centos7-9 openssh-portable-V_9_3_P2]# ./configure
......
configure: error: *** zlib.h missing - please install first or check config.log ***
[root@centos7-9 openssh-portable-V_9_3_P2]#
# 安装 ./configure 命令所需依赖
yum -y install zlib-devel
# 安装完成,即可正常执行 ./configure 命令
可选安装 openssl-devel
[root@centos7-9 openssh-portable-V_9_3_P2]# ./configure
......
checking for openssl... /usr/bin/openssl
configure: error: *** working libcrypto not found, check config.log
[root@centos7-9 openssh-portable-V_9_3_P2]#
# 安装 ./configure 命令所需依赖
yum -y install openssl-devel
# 安装完成,即可正常执行 ./configure 命令
可选安装 make
[root@centos7-9 openssh-portable-V_9_3_P2]# make
-bash: make: command not found
[root@centos7-9 openssh-portable-V_9_3_P2]#
# 安装 make 命令所需依赖
yum -y install make
# 安装完成,即可正常执行 make 命令
完整安装命令
# 不包含测试:耗时短
yum -y install autoconf automake gcc zlib-devel openssl-devel make
autoreconf
./configure
make && make install
source /etc/profile
ssh -V
# 包含测试:耗时长
yum -y install autoconf automake gcc zlib-devel openssl-devel make
autoreconf
./configure
make && make tests && make install
source /etc/profile
ssh -V