標籤:style blog http os ar for 檔案 sp 2014
最近有空複習了一下Linux,在虛擬機器上安裝了個CentOS6.5,順便升級一下系統內建的openssh,任何系統操作都有風險,正式環境請做好備份工作。廢話少說,直接貼代碼。
1、準備工作,相應的包自己到官方下載,另外需要下載依賴包openssl以及zlib包。
openssh:http://www.openssh.com/portable.html#http
openssl:http://www.openssl.org/source/
zlib:http://zlib.net/zlib-1.2.8.tar.gz
2、卸載系統內建的openssh,卸載之前先停止sshd服務,再用rpm刪除,同時清除系統/etc/ssh目錄
[[email protected] tmp]# service sshd stopStopping sshd: [ OK ] [[email protected] tmp]# rpm -qa opensshopenssh-5.3p1-94.el6.x86_64[[email protected] tmp]# rpm -e openssh-server[[email protected] tmp]# rpm -e openssh-clients[[email protected] tmp]# rpm -e openssh-askpass[[email protected] tmp]# rpm -e openssh[[email protected] tmp]# rm -rf /etc/ssh
3、安裝zlib
[[email protected] tmp]# tar -xvf zlib-1.2.8.tar.gz [[email protected] tmp]# cd zlib-1.2.8[[email protected] zlib-1.2.8]# ./configure --prefix=/usr/local/zlib && make && make install
4、安裝openssl
[[email protected] tmp]# tar -xvf openssl-1.0.1i.tar.gz [[email protected] tmp]# cd openssl-1.0.1i[[email protected] openssl-1.0.1i]# ./config --prefix=/usr/local/openssl && make && make install
5、安裝openssh
[[email protected] tmp]# tar -xvf openssh-6.6p1.tar.gz[[email protected] tmp]# cd openssh-6.6p1[[email protected] openssh-6.6p1]# ./configure --prefix=/usr/local/openssh --sysconfdir=/etc/ssh --with-ssl-dir=/usr/local/openssl --with-zlib=/usr/local/zlib --with-md5-passwords --without-hardening && make && make install
6、修改設定檔
[[email protected] openssh-6.6p1]# cp contrib/redhat/sshd.init /etc/init.d/sshd[[email protected] openssh-6.6p1]# chmod +x /etc/init.d/sshd [[email protected] openssh-6.6p1]# vi /etc/init.d/sshd
修改對應指令的安裝目錄=============================25行 SSHD=/usr/sbin/sshd 為 SSHD=/usr/local/openssh/sbin/sshd41行 /usr/bin/ssh-keygen -A 為 /usr/local/openssh/bin/ssh-keygen -A=============================儲存退出
7、加入到系統服務
[[email protected] openssh-6.6p1]# chkconfig --add sshd[[email protected] openssh-6.6p1]# service sshd start
8、編譯中遇到的錯誤,參考博文http://zjwsk.blog.163.com/blog/static/598306132014313112351/,感謝博主的分享
configure: error: *** Can‘t find recent OpenSSL libcrypto (see config.log for details) ***
CentOS 6.5 升級 openssh