RedHat脚本改用CentOS源更新安装Nginx、PHP 5.3、Varnish

RedHat改用CentOS的yum组件,步骤有点麻烦,为了方便大家,写了个脚本的自动配置。。。。

yum源用的是epel和科技大学的。

  1. #/bin/bash  
  2. #by rfyiamcool  
  3. #echo "nameserver 8.8.8.8" >>/etc/resolv.conf  
  4. mkdir /root/yum  
  5. cd /root/yum  
  6. rpm -qa|grep yum|xargs rpm -e --nodeps  
  7. if ! rpm -qa|grep yum ;then  
  8. echo uninstall yum ok  
  9. else  
  10. rpm -qa |grep yum  
  11. exit  
  12. fi  
  13. wget  http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm  
  14. wget  http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm  
  15. wget  http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-3.2.22-39.el5.centos.noarch.rpm  
  16. echo dowoload cetnos-yum ok  
  17. rpm -ivh yum-*.rpm  
  18. echo install cetnos-yum ok  
  19. cd /etc/yum.repos.d  
  20. wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo  
  21. rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5  
  22. cat >> epel.repo <<EOF 
  23. [epel]  
  24. name=Extra Packages for Enterprise Linux 5 - \$basearch  
  25. #baseurl=http://download.Fedoraproject.org/pub/epel/5/\$basearch  
  26. mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=\$basearch  
  27. failovermethod=priority 
  28. enabled=1 
  29. gpgcheck=1 
  30. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL  
  31.  
  32. [epel-debuginfo]  
  33. name=Extra Packages for Enterprise Linux 5 - \$basearch - Debug  
  34. baseurl=http://download.fedoraproject.org/pub/epel/5/\$basearch/debug  
  35. #mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-5&arch=\$basearch  
  36. failovermethod=priority 
  37. enabled=1 
  38. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL  
  39. gpgcheck=1 
  40.  
  41. [epel-source]  
  42. name=Extra Packages for Enterprise Linux 5 - \$basearch - Source  
  43. #baseurl=http://download.fedoraproject.org/pub/epel/5/SRPMS  
  44. mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-5&arch=\$basearch  
  45. failovermethod=priority 
  46. enabled=1 
  47. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL  
  48. gpgcheck=1 
  49. EOF  
  50. yum makecache  
  51. yum list httpd* 

相关推荐