本文带领大家升级最新版本的openssh6.1哦。
首先,安装zlib
下载地址:http://www.jbxue.com/down/56.html
复制代码代码如下:
tar zxvf zlib-1.2.5.tar.gz
cd zlib-1.2.5
./configure --prefix=/usr/local/zlib
make && make install
安装openssl
下载最新包:http://www.openssl.org/source/openssl-1.0.1c.tar.gz
复制代码代码如下:
tar zxvf openssl-1.0.1c.tar.gz
cd openssl-1.01c
./config shared zlib --prefix=/usr/local/openssl
make && make install
whereis openssl
cd /usr/bin/
mv openssl openssl.bak
ln -s /usr/local/openssl/bin/openssl .
cd /usr/include/
mv openssl openssl.bak
ln -s /usr/local/openssl/include/openssl .
验证:
复制代码代码如下:
openssl version
OpenSSL 1.0.1c 10 May 2012
echo "/usr/local/openssl/lib/" >> /etc/ld.so.conf
ldconfig
安装openssh
下载最新安装包:http://openbsd.org.ar/pub/OpenBSD/OpenSSH/portable/openssh-6.1p1.tar.gz
复制代码代码如下:
tar zxvf openssh-6.1p1.tar.gz
cd openssl-6.1p1
./configure --prefix=/usr//local/openssh --sysconfdir=/usr/local/openssh/etc/ssh --with-pam --with-zlib=/usr/local/zlib/ --with-ssl-dir=/usr/local/openssl/ --with-md5-passwords-mandir=/usr/share/man/
make && make install
若提示:configure: error: PAM headers not found
安装 pam* pam-devel 是关键
yum -y install pam*
查看sshd运行状态:
netstat -anptul | grep :22
停掉服务,取消开机启动:
service sshd stop
chkconfig sshd off
设置环境变量:
echo "export
PATH=/usr/local/openssh/bin:$JAVA_HOME/bin:$PATH " >>/etc/profile
使其生效:
source /etc/profile
设置sshd开机启动:
复制代码代码如下:
echo " /usr/local/openssh/sbin/sshd " >> /etc/rc.d/rc.local
启动sshd
/usr/local/opoenssh/sbin/sshd
没有错误提示
查看进程监听状态
[root@localhost ~]# lsof -i:22
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
sshd 2686 root 3u IPv6 11222 TCP *:ssh(LISTEN)
sshd 2686 root 4u IPv4 11230 TCP *:ssh(LISTEN)
说明服务已经正常启动。
查看ssh版本:
[root@localhost ~]# ssh -v
OpenSSH_6.1p1, OpenSSL 1.0.1c 10 May 2012
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address]
[-c cipher_spec]
[-D [bind_address:]port] [-e escape_char] [-F configfile]
[-I pkcs11] [-i identity_file]
[-L [bind_address:]port:host:hostport]
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o
option] [-p port]
[-R [bind_address:]port:host:hostport] [-S ctl_path]
[-W host:port] [-w local_tun[:remote_tun]]
[user@]hostname [command]
或者:
[root@localhost ~]# telnet localhost 22
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
SSH-2.0-OpenSSH_6.1
升级完成。
(责任编辑:IT) |