记录日常工作关于系统运维,虚拟化云计算,数据库,网络安全等各方面问题。

环境:centos 7.1.1503 最小化安装

依赖包下载:  yum -y install lrzsz zlib-devel perl gcc pam-devel

1、安装openssl ,选用最新发布的版本:openssl-1.1.1g.tar.gz

1)openssl下载地址:https://www.openssl.org/source/openssl-1.1.1g.tar.gz

2)卸载系统预装的openssl ,这一步可以不做

rpm -qa | grep openssl | grep -v lib

yum -y remove openssl-1.0.1e-42.el7.x86_64

 

3)安装步骤:

tar -zxvf openssl-1.1.1g.tar.gz

cd openssl-1.1.1g

./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl -Wl,-rpath,/usr/local/openssl/lib shared

make && make install

4)创建软链接

ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl

ln -s /usr/local/openssl/include/openssl /usr/include/openssl

5)更新系统配置

echo "/usr/local/openssl/lib" >> /etc/ld.so.conf

/sbin/ldconfig

6)检查版本

openssl version

 

2、安装openssh,选用最新发布的版本:openssh-8.3p1.tar.gz

1)openssh下载地址:https://openbsd.hk/pub/OpenBSD/OpenSSH/portable/openssh-8.3p1.tar.gz

2)卸载系统预装的openssh

rpm -qa | grep openssh

yum -y remove openssh-server-6.6.1p1-11.el7.x86_64 openssh-clients-6.6.1p1-11.el7.x86_64 openssh-6.6.1p1-11.el7.x86_64

 

 3)备份openssh配置文件,这一步可以不做

cp -r /etc/ssh /etc/ssh.bak

rm -rf /etc/ssh  #这一步很重要,必须做

4)安装步骤

tar -zxvf openssh-8.3p1.tar.gz

cd openssh-8.3p1

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

make && make install

5)创建软链接

ln -s /usr/local/openssh/sbin/sshd /usr/sbin/sshd

ln -s /usr/local/openssh/bin/ssh /usr/bin/ssh

ln -s /usr/local/openssh/bin/ssh-add /usr/bin/ssh-add

ln -s /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen

ln -s /usr/local/openssh/bin/ssh-keyscan /usr/bin/ssh-keyscan

6)将openssh的服务脚本复制到/etc/init.d目录下

cp /root/openssh-8.3p1/contrib/redhat/sshd.init /etc/init.d/sshd

chmod u+x /etc/init.d/sshd

备注:sshd.init 文件是存放在openssh的压缩包中,需要在解压的文件夹中查找

7)添加sshd服务

chkconfig --add sshd

8)检查openssh版本

ssh -V

 

9)修改openssh的配置文件,允许root登录

vi /etc/ssh/sshd_config

将 #PermitRootLogin prohibit-password 修改为 PermitRootLogin yes

 

10)将sshd服务设为开机启动

chkconfig sshd on

11)重启sshd服务

systemctl daemon-reexec

systemctl restart sshd

12)查看sshd服务状态

 

 

 

 至此openssh服务安装完成,不放心的话可以reboot重启机器



转载请标明出处【centos 6/RHEL7 源码安装openssh 8.3】。

《www.micoder.cc》 虚拟化云计算,系统运维,安全技术服务.

网站已经关闭评论