升级ssh脚本如下:

 
  
  1. #!/bin/bash 
  2. #for  update  nginx and update openssh  
  3.  
  4. # for install telnet 
  5. yum install -y telnet-server telnet 
  6. chkconfig telnet on  
  7. /etc/init.d/xinetd restart 
  8. netstat -tnlp  
  9. useradd sshinstall 
  10. echo "123456@sshinstall" | passwd --stdin sshinstall 
  11. echo "sshinstall ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers 
  12.  
  13. # for install openssl 
  14. tar -xzf openssl-1.0.1c.tar.gz  
  15. cd openssl-1.0.1c 
  16. ./config enable-tl***t  --prefix=/usr/local/openssl-1.0.0c 
  17. make && make test && make install 
  18. echo /usr/local/openssl-1.0.0c/lib/ >> /etc/ld.so.conf  
  19. ln -s /usr/local/openssl-1.0.0c/ /usr/local/openssl 
  20. echo 'PATH=/usr/local/openssl/bin:$PATH 
  21. export PATH'  >>   /etc/profile 
  22.  
  23. source /etc/profile  
  24. openssl version -a 
  25.  
  26. # delete old openssh 
  27. rpm -e openssh-server-4.3p2-41.el5 --nodeps 
  28. rpm -e openssh-4.3p2-41.el5 --nodeps 
  29. rpm -e openssh-askpass-4.3p2-41.el5 --nodeps 
  30. rpm -e openssh-clients-4.3p2-41.el5 --nodeps 
  31. rm -rf /etc/ssh/ 
  32.  
  33. # intall openssh 
  34. yum install pam-devel 
  35. cd .. 
  36. tar -xzf openssh-6.1p1.tar.gz 
  37. cd openssh-6.1p1  
  38. ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-ssl-dir=/usr/local/openssl-1.0.0c --with-md5-passwords --mandir=/usr/share/man 
  39.  make && make install 
  40. cp ./contrib/redhat/sshd.init /etc/init.d/sshd 
  41. chmod u+x /etc/init.d/sshd 
  42. chkconfig --add sshd 
  43. chkconfig sshd on 
  44. service sshd start 
  45. ssh -v 
  46. chkconfig telnet off 
  47. /etc/init.d/xinetd restart 
  48. userdel -r sshinstall 

升级nginx脚本如下:

 
  
  1. #!/bin/bash 
  2. #for  update  nginx and update openssh  
  3.  
  4. yum install -y zlib-devel zlib gcc gcc-c++ 
  5. yum install pam-devel 
  6.  
  7. # update nginx 
  8. tar zxvf libunwind-0.99.tar.gz 
  9. cd libunwind-0.99/ 
  10. CFLAGS=-fPIC ./configure && make CFLAGS=-fPIC 
  11. make CFLAGS=-fPIC install 
  12.  
  13. cd .. 
  14. tar xzf google-perftools-1.6.tar.gz 
  15. cd google-perftools-1.6 
  16. ./configure  
  17. make && make install  
  18.  
  19. cd .. 
  20. tar -xzf pcre-8.12.tar.gz  
  21. cd pcre-8.12 
  22. ./configure && make && make install  
  23.  
  24. # for install geoip 
  25. cd .. 
  26. tar -xzf GeoIP.tar.gz  
  27.  cd GeoIP-1.4.8/ 
  28. ./configure && make && make install 
  29.  
  30. cd .. 
  31. gunzip GeoIP.dat.gz  
  32. echo '/usr/local/lib' > /etc/ld.so.conf.d/geoip.conf 
  33. ldconfig 
  34.  
  35. unzip nginx_upstream_jvm_route.zip 
  36. unzip master.zip   
  37.  
  38. tar -xzf nginx-sticky-module-1.1.tar.gz 
  39. tar -xzf nginx-1.2.6.tar.gz  
  40. cd nginx-1.2.6 
  41. patch -p0 < /root/upgrade/nginx-upstream-jvm-route/nginx_upstream_jvm_route/jvm_route.patch  
  42. patch -p1 < /root/upgrade/nginx_upstream_check_module-master/check_1.2.6+.patch  
  43.  
  44. ./configure --prefix=/usr/local/nginx  --user=nobody --group=nobody  --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module --with-http_sub_module --with-http_geoip_module  --with-http_ssl_module  --with-http_ssl_module --with-openssl=/root/upgrade/openssl-1.0.1c --with-pcre=/root/upgrade/pcre-8.12 --add-module=/root/upgrade/nginx-upstream-jvm-route/nginx_upstream_jvm_route/  --add-module=/root/upgrade/nginx_upstream_check_module-master/ --add-module=/root/upgrade/nginx-sticky-module-1.1/ --with-google_perftools_module 
  45.  
  46. make && make install  
  47. /usr/local/nginx/sbin/nginx -v