检查系统是否安装ssh

#rpm –qa |grep ssl     

#rpm –qa |grep ssh

#sshd -v

源码升级安装sshzlib-1.2.5.tar.gz,openssl-1.0.0a.tar.gz,openssh-5.5p1.tar.gz

cd /usr/local/src

lftp -e 'mget * ; bye' username:password@192.168.1.4/%2Fhome/sys/script  #tar包来源

dos2unix install_ssh.sh

chmod +x install_ssh.sh

./install_ssh.sh

 

#!/bin/bash

cd /usr/local/src
tar xzvf zlib-1.2.5.tar.gz
cd zlib-1.2.5

./configure --prefix=/usr/local/zlib-1.2.5 -share
make install

#echo '/usr/local/zlib-1.2.5/lib' >> /etc/ld.so.conf会导致图形界面问题

ldconfig -v
ln -s /usr/local/zlib-1.2.5 /usr/local/zlib

cd ..

cd /usr/local/src
tar -zxvf openssl-1.0.0a.tar.gz
cd openssl-1.0.0a
./config shared zlib-dynamic --prefix=/usr/local --with-zlib-lib=/usr/local/zlib-1.2.5/lib --with-zlib-include=/usr/local/zlib-1.2.5/include
make install

#bit=$(getconf LONG_BIT)
#if [ "$bit" == 64 ]; then
# echo '/usr/local/openssl-1.0.0a/lib64' >> /etc/ld.so.conf
#elif [ "$bit" == 32 ] ; then
# echo '/usr/local/openssl-1.0.0a/lib' >> /etc/ld.so.conf

#fi

ldconfig -v
ln -s /usr/local/openssl-1.0.0a /usr/local/openssl
echo 'PATH=/usr/local/openssl/bin:$PATH' >> /etc/profile
echo 'export PATH' >> /etc/profile
cd ..

service sshd stop


OPENSSH_PKGS=`rpm -qa | grep openssh`

for pkg in $OPENSSH_PKGS
do
 rpm -e "$pkg" --nodeps
done
 
cd ..

cd /usr/local/src
tar -zxvf openssh-5.5p1.tar.gz
cd  openssh-5.5p1
./configure --prefix=/usr --sysconfdir=/etc/ssh --libexecdir=/usr/libexec/openssh --with-tcp-wrappers --without-zlib-version-check

make install
cp ./contrib/redhat/sshd.init /etc/init.d/sshd
chmod +x /etc/init.d/sshd

chkconfig --add sshd
service sshd start

cd /usr/local/src/
rm -rf openssh-5.5p1*
rm -rf openssl-1.0.0a.tar.gz
rm -rf zlib-1.2.5.tar.gz
rm -rf openssl-1.0.0a
rm -rf zlib-1.2.5