您好,欢迎来到思海网络,我们将竭诚为您提供优质的服务! 诚征网络推广 | 网站备案 | 帮助中心 | 软件下载 | 购买流程 | 付款方式 | 联系我们 [ 会员登录/注册 ]
促销推广
客服中心
业务咨询
有事点击这里…  531199185
有事点击这里…  61352289
点击这里给我发消息  81721488
有事点击这里…  376585780
有事点击这里…  872642803
有事点击这里…  459248018
有事点击这里…  61352288
有事点击这里…  380791050
技术支持
有事点击这里…  714236853
有事点击这里…  719304487
有事点击这里…  1208894568
有事点击这里…  61352289
在线客服
有事点击这里…  531199185
有事点击这里…  61352288
有事点击这里…  983054746
有事点击这里…  893984210
当前位置:首页 >> 技术文章 >> 文章浏览
技术文章

Linux ssh 升级安装方法

添加时间:2015-12-25 3:13:49  添加: 思海网络 
Linux ssh 升级安装方法
一、安装 Zlib 
1、下载最新版本 Zlib 
Zlib 官方网站:http://www.zlib.net/ 
# cd /usr/local/src 
# wget -c http://www.zlib.net/zlib-1.2.3.tar.gz 
2、编译安装 Zlib 
# tar xzvf zlib-1.2.3.tar.gz 
# cd zlib-1.2.3 
# ./configure --prefix=/usr/local/zlib 
# make 
# make install 
这样,就把 zlib 编译安装在 
/usr/local/zilib 中了。 
二、安装 OpenSSL 
1、下载最新版本 OpenSSL 
OpenSSL 的官方网站:http://www.openssl.org 
# cd /usr/local/src 
# wget -c http://www.openssl.org/source/openssl-0.9.8d.tar.gz 
2、编译安装 OpenSSL 
# tar xzvf openssl-0.9.8d.tar.gz 
# cd openssl-0.9.8d 
# ./Configure --prefix=/usr/local/openssl 
# make 
# make test(这一步很重要哦!是进行 SSL加密协议的完整测试,如果出现错误就要一定先找出哪里的原因,否则一味继续可能导致最终 SSH 不能使用,后果很严重哦!) 
# make install 
三、安装 OpenSSH 
1、下载最新版本 OpenSSH 
OpenSSH 的官方网站:http://www.openssh.com 
# cd /usr/local/src 
# wget -c ftp://ftp.it.net.au/mirrors/OpenBSD/OpenSSH/portable/openssh-4.5p1.tar.gz 
2、编译安装 OpenSSH 
# tar xzvf openssh-4.5p1.tar.gz 
# cd openssh-4.5p1 
# ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-zlib=/usr/local/zlib --with-ssl-dir=/usr/local/openssl --with-md5-passwords 
(注意,如果 configure 时提示 PAM 有错误,那一般是因为系统中没有安装 pam-devel RPM 包,找到安装光盘,安装 pam-devel 就可以解决啦) 
# make 
# make install 
这样就完成了整个安装 SSH 的工作,在安装完成后,我们还需要修改一下 OpenSSH 的配置文件进一步提升安全性。通过以上步骤完成的安装工作,OpenSSH 的配置文件在 /etc/ssh 下,其中 SSH Server 的配置文件是 sshd_config。 
# vi /etc/ssh/sshd_config 
找到: 
CODE: 
#Protocol 2,1修改为: 
Protocol 2这样就禁用了 ssh v1 协议,只使用更安全的 ssh v2 协议。 
X11Forwarding yes修改为: 
X11Forwarding no禁用 X11 转发。 
修改后保存退出。 
● 生成ssh服务管理脚本 
进入ssh解压目录 
#cd /contrib/redhat 
#cp sshd.init /etc/init.d/sshd 
#chmod +x /etc/init.d/sshd 
#chkconfig --add sshd 
最后,启动 SSH 服务使修改生效: 
# /etc/init.d/sshd restart 
重启后确认一下当前的 OpenSSH 和 OpenSSL是否正确: 
# ssh -v 
如果看到了新的版本号就没问题啦! 

独自等待补充: 
在实践过程中,发现了如下问题: 
1、提示Starting sshd:WARNING: initlog is deprecated and will be removed in a future release 
根据国外的网站上面得到的信息是更改 initlog -c "$SNMPD $OPTIONS" && success || failure 

为"$SNMPD $OPTIONS" && success || failure 也就是去掉前面的initlog -c 结果还是解决不了问题。 
再查资料发现编译安装的ssh在启动服务的时候 需要更改文件路径而且一定注意修改路径,不然报错。 
#[ -f /etc/sysconfig/sshd ] && . /etc/sysconfig/sshd 
KEYGEN=/usr/local/bin/ssh-keygen 
SSHD=/usr/local/sbin/sshd 
RSA1_KEY=/usr/local/etc/ssh_host_key 
RSA_KEY=/usr/local/etc/ssh_host_rsa_key 
DSA_KEY=/usr/local/etc/ssh_host_dsa_key 
请大家根据自己的实际情况更改!

关键字:Linux、ssh、升级安装
分享到:

顶部 】 【 关闭
版权所有:佛山思海电脑网络有限公司 ©1998-2024 All Rights Reserved.
联系电话:(0757)22630313、22633833
中华人民共和国增值电信业务经营许可证: 粤B1.B2-20030321 备案号:粤B2-20030321-1
网站公安备案编号:44060602000007 交互式栏目专项备案编号:200303DD003  
察察 工商 网安 举报有奖  警警  手机打开网站