1.安装OpenSSh依赖包

[root@nginx02 ~]# yum -y install gcc pam pam-devel zlib zlib-devel openssl-devel


2.下载安装OpenSSh

[root@nginx02 ~]# wget ftp://mirror.internode.on.net/pub/OpenBSD/OpenSSH/portable/openssh-8.0p1.tar.gz

[root@nginx02 ~]# tar xvf openssh-8.0p1.tar.gz

[root@nginx02 openssh]# cd openssh-8.0p1
[root@nginx02 openssh-8.0p1]# ./configure --prefix=/usr/local/newssh --sysconfdir=/usr/local/newssh/ssh  --with-privsep-path=/var/myempty  --with-privsep-user=sshd --with-zlib --with-ssl-engine --with-md5-passwords --disable-etc-default-login

[root@nginx02 openssh-8.0p1]# make && make install

[root@nginx02 openssh-8.0p1]# cp -a contrib/redhat/sshd.init /etc/init.d/sshd
[root@nginx02 openssh-8.0p1]# cp -a contrib/redhat/sshd.pam /etc/pam.d/sshd.pam

[root@nginx02 openssh-8.0p1]# cp -a /usr/local/newssh/sbin/sshd  /usr/sbin/
[root@nginx02 openssh-8.0p1]# cp -a /usr/local/newssh/bin/ssh   /usr/bin/
[root@nginx02 openssh-8.0p1]# chmod +x /etc/init.d/sshd


3.启动服务

[root@nginx02 openssh-8.0p1]# mv /usr/lib/systemd/system/sshd.service  /tmp/

[root@nginx02 openssh-8.0p1]# chkconfig  sshd on
Note: Forwarding request to 'systemctl enable sshd.socket'.
Created symlink from /etc/systemd/system/sockets.target.wants/sshd.socket to /usr/lib/systemd/system/sshd.socket.
[root@k8s02 openssh]# /etc/init.d/sshd restart
Restarting sshd (via systemctl):                           [  OK  ]
[root@nginx02 openssh-8.0p1]#