手动编译安装OpenSSL与OpenSSH

1、安装必要工具

yum install -y tar zlib-devel

2、编译安装 OpenSSL

cd /usr/local/src
wget https://www.openssl.org/source/openssl-1.1.1w.tar.gz
tar -xvzf openssl-1.1.1w.tar.gz
cd openssl-1.1.1w
./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl LDFLAGS="-Wl,-rpath=/usr/local/openssl/lib"
make && make install

/usr/local/openssl/bin/openssl version
ldd /usr/local/openssl/bin/openssl

3、编译安装 OpenSSH

cd /usr/local/src
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.8p1.tar.gz
tar -xvzf openssh-9.8p1.tar.gz
cd openssh-9.8p1
./configure --prefix=/usr/local/openssh --with-ssl-dir=/usr/local/openssl --sysconfdir=/usr/local/openssh/etc LDFLAGS="-Wl,-rpath=/usr/local/openssl/lib"
make && make install

/usr/local/openssh/sbin/sshd -V
ldd /usr/local/openssh/sbin/sshd

5、备份旧的配置文件

cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
cp /etc/ssh/ssh_config /etc/ssh/ssh_config.bak

# 请根据实际情况修改ssh/sshd配置文件及systemd文件,以及处理系统自带的sshd服务
posted @ 2024-07-11 12:34  wanghongwei-dev  阅读(105)  评论(0编辑  收藏  举报