自动配置RHEL5(CentOS5)中科大epel和rpmforge YUM仓库支持(32|64)
2010-04-02 13:00
549 查看
集合了rpmforge,epel,ustc三方yum仓库,其中rpmforge和epel都是针对光盘以外的yum,ustc是中科院的,主要是正对光盘上的软件包,这样就不会出现可以安装nagios,cacti却不可以安装mysql这种系统基础包的情况,正对32-64位的系统做了限制,这样就不会出现32位的系统装到64位的包,虽然这样并无影响,但是会浪费空间,大约11000左右个包,有问题欢迎拍砖。
#!/bin/bash #create epel ustc rpmforge YUM repository #chenjian 2011-04-12 host www.google.com >& /dev/null WGET=$(/usr/bin/which wget) ECHO_OK=$(echo -e "\E[32;40m""\033[4m------------------------------------------------------------------------------\033[0m\n") ECHO_ERR=$(echo -e "\E[33;40m""\033[4m------------------------------------------------------------------------------\033[0m\n") if [ $? -ne 0 ] then echo $ECHO_ERR echo Connection network faild. echo $ECHO_ERR exit 1 else EPEL_I386="http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm" EPEL_X86_64="http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm" RPMFORGE_I386="http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm" RPMFORGE_X86_64="http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm" create_yum () { if $WGET -q -P /tmp/ $2 then rpm -q $1 >& /dev/null if [ $? -ne 0 ] then rpm -ivh --quiet /tmp/$1\* if [ $? -eq 0 ] then echo $1 repository create success. echo $ECHO_OK else echo $1 repository create faild echo $ECHO_ERR exit 2 fi else echo Upgrading ... rpm -Uvh --quiet /tmp/$1\* echo $ECHO_OK fi else echo get $1 package fail.please check your url. echo $ECHO_ERR exit 1 fi rm -rf /tmp/$1\* } config_yum () { if ! grep 'exclude' /etc/yum.conf >& /dev/null then echo $1 >> /etc/yum.conf fi } echo installing ,please wait... uname -i|grep -q 64 if [ $? -eq 1 ] then create_yum rpmforge-release $RPMFORGE_I386 create_yum epel-release $EPEL_I386 #the following command is no influence,only for reduce disk usage. config_yum 'exclude=*.x86_64' else create_yum rpmforge-release $RPMFORGE_X86_64 create_yum epel-release $EPEL_X86_64 config_yum 'exclude=*.i?86' fi fi if [ $? -ne 0 ] then exit 2 else cd /etc/yum.repos.d/ cat > CentOS-Base.repo <<EOF # CentOS-Base.repo [base] name=CentOS - Base baseurl=http://centos.ustc.edu.cn/centos/5/os/\$basearch/ http://centos.candishosting.com.cn/5/os/\$basearch/ gpgcheck=1 gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5 #released updates [update] name=CentOS - Updates baseurl=http://centos.ustc.edu.cn/centos/5/updates/\$basearch/ http://centos.candishosting.com.cn/5/updates/\$basearch/ gpgcheck=1 gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5 #packages used/produced in the build but not released [addons] name=CentOS - Addons baseurl=http://centos.ustc.edu.cn/centos/5/addons/\$basearch/ http://centos.candishosting.com.cn/5/addons/\$basearch/ gpgcheck=1 gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5 #additional packages that may be useful [extras] name=CentOS - Extras baseurl=http://centos.ustc.edu.cn/centos/5/extras/\$basearch/ http://centos.candishosting.com.cn/5/extras/\$basearch/ gpgcheck=1 gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5 #additional packages that extend functionality of existing packages [centosplus] name=CentOS - Plus baseurl=http://centos.ustc.edu.cn/centos/5/centosplus/\$basearch/ http://centos.candishosting.com.cn/5/centosplus/\$basearch/ gpgcheck=1 enabled=0 gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5 #contrib - packages by Centos Users [contrib] name=CentOS - Contrib baseurl=http://centos.ustc.edu.cn/centos/5/contrib/\$basearch/ http://centos.candishosting.com.cn/5/contrib/\$basearch/ gpgcheck=1 enabled=0 gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5 EOF rpm --import http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5 if [ $? -eq 0 ] then echo USTC repository create success. echo $ECHO_OK fi echo "All yum repository create cuccessful ^ _ ^." echo $ECHO_OK fi [root@localhost ~]# yum list |wc -l This system is not registered with RHN. RHN support will be disabled. 11715
相关文章推荐
- RHEL/CentOS/Fedora常用的 CentOS 5/6/7 yum 源(EPEL、Remi、RPMForge、RPMFusion, ius,163,sohu,阿里云)配置
- RHEL/CentOS/Fedora各种源(EPEL、Remi、RPMForge、RPMFusion)配置 、YUM 源优先级插件:Yum Priorities
- RHEL/CentOS/Fedora常用的 CentOS 5/6/7 yum 源(EPEL、Remi、RPMForge、RPMFusion, ius,163,sohu,阿里云)配置
- RHEL/CentOS/Fedora各种源(EPEL、Remi、RPMForge、RPMFusion)配置
- RHEL/CentOS 6.0使用第三方软件库(EPEL与RPMForge、RPMFusion软件库)
- 使用脚本配置yum(支持rhel5、6)
- RHEL/CentOS 5.x使用第三方软件库(EPEL与RPMForge、RPMFusion软件库)
- RHEL/CentOS/Fedora各种源(EPEL、Remi、RPMForge、RPMFusion)配置
- RHEL/CentOS 5.x使用第三方软件库(EPEL与RPMForge、RPMFusion软件库)
- RHEL|Centos|Fedora第三方软件库(pbone|EPEL|RPMForge|RPMFusion)使用配置
- VMware中RHEL7配置本地Yum仓库
- Rhel5利用centos5 yum 源及第三方软件仓库
- RHEL6 学习配置 YUM 仓库
- (总结)RHEL/CentOS 5.5使用第三方软件库(EPEL与RPMForge、RPMFusion软件库)
- (总结)RHEL/CentOS 5.x使用第三方软件库(EPEL与RPMForge、RPMFusion软件库)
- (转载)RHEL/CentOS 5.5使用第三方软件库(EPEL与RPMForge、RPMFusion软件库)
- 让CentOS6 yum源支持更多rpm包的升级(使用第三方软件库EPEL、RPMForge与RPMFusion)
- rpm、yum工具用法 & 配置本地yum仓库
- Linux学习笔记-----day4(3.15)------软件包/仓库管理与配置(rpm,yum,和源码安装)
- 让CentOS6 yum源支持更多rpm包的升级(使用第三方软件库EPEL、RPMForge与RPMFusion)