CentOS 6.6 yum源完全配置

一  yum 简介
    yum,是"Yellow dog Updater,Modified"的简称,是杜克大学为了提高RPM软件包安装性而开发的一种软件包管理器. 起初是由yellow dog这一发行版的开发者Terra Soft研发,用Python写成,那时还叫做yup(yellow dog updater),后经杜克大学的Linux@Duke开发团队进行改进,遂有此名. yum的宗旨是自动化地升级,安装/移除rpm包,收集rpm包的相关信息,检查依赖性并自动提示用户解决. yum的关键之处是要有可靠的repository,顾名思义,这是软件的仓库,它可以是http或ftp站点,也可以是本地软件池,但必须包含rpm的header,header包括了rpm包的各种信息,包括描述,功能,提供的文件,依赖性等. 正是收集了这些header并加以分析,才能自动化地完成余下的任务. 
    yum 的理念是使用一个中心仓库(repository)管理一部分甚至一个distribution的应用程序相互关系,根据计算出来的软件依赖关系进行相关的升级,安装, 删除等操作,减少了Linux用户一直头痛的dependencies的问题. 这一点上,yum和apt相同. apt原为debian的deb类型软件管理所使用,但是现在也能用到RedHat 门下的rpm了.
    yum主要功能是更方便的添加/删除/更新RPM包,自动解决包的依赖性问题,便于管理大量系统的更新问题. 
    yum可以同时配置多个资源库(Repository),简洁的配置文件(/etc/yum.conf),自动解决增加或删除rpm包时遇到的依赖性问题,保持与RPM数据库的一致性.

+--------------------------+
使用Yum下载RPM包而不安装 |
+--------------------------+

 

方法一:通过yum自带一个工具:yumdownloader
# yum -y install yum-utils*
# rpm -ql yum-utils
/usr/bin/debuginfo-install
/usr/bin/package-cleanup
/usr/bin/repo-graph
/usr/bin/repo-rss
/usr/bin/repoclosure
/usr/bin/repodiff
/usr/bin/repomanage
/usr/bin/repoquery
/usr/bin/reposync
/usr/bin/repotrack
/usr/bin/verifytree
/usr/bin/yum-builddep
/usr/bin/yum-debug-dump
/usr/bin/yum-groups-manager
/usr/bin/yumdownloader       #可以看到yumdownloade这个工具是由yum-utils这个软件安装生成的!

安装好后就可以直接使用了,使用非常简单,如下:

# yumdownloader vlock
vlock-1.3-23.i386.rpm                                          |  11 kB     00:00    
# ls
vlock-1.3-23.i386.rpm

方法二:使用yum的一个插件:yum-downloadonly

安装插件
# yum install yum-downloadonly
会自动下载安装yum-plugin-downloadonly
# ls /etc/yum/pluginconf.d/downloadonly.conf
/etc/yum/pluginconf.d/downloadonly.conf

安装yum支持的所有插件

yum install axel
yum install yum-presto
yum install yum-fastestmirror
yum install yum-metadata-parser
yum install yum-downloadonly
yum install yum-priorities
yum install yum-*

下载文件:
# yum install --downloadonly tftp
下载后文件在/var/cache下
# ls /var/cache/yum/i386/6/base/packages/tftp-0.49-7.el6.i686.rpm
# yum install --downloadonly tftp --downloaddir=~/ #指定文件下载路径

二  yum安装
    CentOS默认已经安装了yum,不需要另外安装,这里为了实验目的,先将yum卸载再重新安装. 
1  查看系统默认安装的yum
    # rpm -qa|grep yum
2  卸载yum
    # rpm -e yum-fastestmirror-1.1.16-14.el5.centos.1 yum-metadata-parser-1.1.2-3.el5.centos yum-3.2.22-33.el5.centos
3  重新安装yum
    这里可以通过wget 从网上下载相关包安装,也可以挂载系统安装光盘进行安装,这里选择挂载系统安装光盘进行安装. 
    # mount /dev/cdrom /mnt/cdrom/
    # rpm -ivh yum-3.2.22-33.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
    # yum -v

yum 的基础安装包包括:
    yum  //RPM installer/updater
    yum-fastestmirror  //Yum plugin which chooses fastest repository from a mirrorlist
    yum-metadata-parser  //A fast metadata parser for yum


三  yum配置
    yum的配置文件分为两部分main和repository
    main部分定义了全局配置选项,整个yum 配置文件应该只有一个main. 常位于/etc/yum.conf中. 
    repository部分定义了每个源/服务器的具体配置,可以有一到多个. 常位于/etc/yum.repo.d/目录下的各文件. 
    yum.conf文件一般位于/etc目录下,一般其中只包含main部分的配置选项. 
# cat /etc/yum.conf
############################################
[main]
cachedir=/var/cache/yum
  ##yum缓存的目录,yum在此存储下载的rpm包和数据库,默认设置为/var/cache/yum
keepcache=0
  ##安装完成后是否保留软件包,0为不保留(默认为0),1为保留
debuglevel=2
  ##Debug信息输出等级,范围为0-10,缺省为2
logfile=/var/log/yum.log
  ##yum日志文件位置. 用户可以到/var/log/yum.log文件去查询过去所做的更新. 
pkgpolicy=newest
  ##包的策略. 一共有两个选项,newest和last,这个作用是如果你设置了多个repository,而同一软件在不同的repository中同时存在,yum应该安装哪一个,如果是newest,则yum会安装最新的那个版本. 如果是last,则yum会将服务器id以字母表排序,并选择最后的那个服务器上的软件安装. 一般都是选newest.
distroverpkg=redhat-release
  ##指定一个软件包,yum会根据这个包判断你的发行版本,默认是redhat-release,也可以是安装的任何针对自己发行版的rpm包. 
tolerant=1
  ##有1和0两个选项,表示yum是否容忍命令行发生与软件包有关的错误,比如你要安装1,2,3三个包,而其中3此前已经安装了,如果你设为1,则yum不会出现错误信息. 默认是0.
exactarch=1
  ##有1和0两个选项,设置为1,则yum只会安装和系统架构匹配的软件包,例如,yum不会将i686的软件包安装在适合i386的系统中. 默认为1. 
retries=6
  ##网络连接发生错误后的重试次数,如果设为0,则会无限重试. 默认值为6.
obsoletes=1
  ##这是一个update的参数,具体请参阅yum(8),简单的说就是相当于upgrade,允许更新陈旧的RPM包. 
plugins=1
  ##是否启用插件,默认1为允许,0表示不允许. 我们一般会用yum-fastestmirror这个插件. 
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum

# Note: yum-RHN-plugin doesn't honor this.
metadata_expire=1h

installonly_limit=5

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
############################################
除了上述之外,还有一些可以添加的选项,如:
exclude=selinux*  ## 排除某些软件在升级名单之外,可以用通配符,列表中各个项目要用空格隔开,这个对于安装了诸如美化包,中文补丁的朋友特别有用.
gpgcheck=1        ## 有1和0两个选择,分别代表是否是否进行gpg(GNU Private Guard) 校验,以确定rpm包的来源是有效和安全的. 这个选项如果设置在[main]部分,则对每个repository都有效. 默认值为0.


四  配置本地yum源

1  挂载系统安装光盘
    # mount /dev/cdrom /mnt/cdrom/
   或者挂在系统镜像
    # mount -o loop -t iso9660 CentOS-6.6-x86_64-bin-DVD1.iso /media/_local_repo_DVD1
    # mount -o loop -t iso9660 CentOS-6.6-x86_64-bin-DVD2.iso /media/_local_repo_DVD2
2  配置本地yum源
    # cd /etc/yum.repos.d/
    # ls
    会看到四个repo 文件
    CentOS-Base.repo 是yum网络源的配置文件
    CentOS-Media.repo 是yum本地源的配置文件
    创建_local_DVD.repo
    # vim _local_DVD.repo
#########################################
[_local_DVD]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
        file:///mnt/cdrom/
        file:///media/cdrecorder/
        file:///media/_local_repo_DVD1
        file:///media/_local_repo_DVD2
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#########################################
    在baseurl中修改第2个路径为/mnt/cdrom(即为光盘挂载点)
    将enabled=0改为1
3  禁用默认的yum 网络源
    将yum 网络源配置文件改名为CentOS-Base.repo.backup,否则会先在网络源中寻找适合的包,改名之后直接从本地源读取. 
4  执行yum 命令
    # yum install vim

关于repo 文件的格式
    所有repository 服务器设置都应该遵循如下格式:
[serverid]
name=Some name for this server
baseurl=url://path/to/repository/
    #serverid 是用于区别各个不同的repository,必须有一个独一无二的名称;
    #name 是对repository 的描述,支持像$releasever $basearch这样的变量;
    #baseurl 是服务器设置中最重要的部分,只有设置正确,才能从上面获取软件. 它的格式是:
baseurl=url://server1/path/to/repository/
    url://server2/path/to/repository/
    url://server3/path/to/repository/

    其中url 支持的协议有 http://, ftp://, file:// 三种. baseurl后可以跟多个url,你可以自己改为速度比较快的镜像站,但baseurl只能有一个,也就是说不能像如下格式:
baseurl=url://server1/path/to/repository/
baseurl=url://server2/path/to/repository/
baseurl=url://server3/path/to/repository/
    其中url 指向的目录必须是这个repository header 目录的上一级,它也支持$releasever $basearch 这样的变量. 
    url 之后可以加上多个选项,如gpgcheck, exclude, failovermethod 等,比如:
##########################################################
[updates-released]
name=Fedora Core $releasever - $basearch - Released Updates
baseurl=http://download.atrpms.net/mirrors/fedoracore/updates/$releasever/$basearch
        http://redhat.linux.ee/pub/fedora/linux/core/updates/$releasever/$basearch
        http://fr2.rpmfind.net/linux/fedora/core/updates/$releasever/$basearch
enable=1
gpgcheck=1
exclude=gaim
failovermethod=priority
##########################################################
    #其中gpgcheck,exclude 的含义和[main] 部分相同,但只对此服务器起作用,failovermethode 有两个选项roundrobin和priority,意思分别是有多个url可供选择时,yum 选择的次序,roundrobin是随机选择,如果连接失败则使用下一个,依次循环,priority则根据url的次序从第一个开始. 如果不指明,默认是roundrobin.


五  配置国内yum源
    系统默认的yum 源速度往往不尽人意,为了达到快速安装的目的,在这里修改yum源为国内源. 

上海交通大学yum源
a. 备份/etc/yum.repos.d/的CentOS-Base.repo文件为CentOS-Base.repo.backup;并复制一份改名为CenOS-sjtu.repo,内容为:
----------------------------------------------
# CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/os/$basearch/
enable=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#released updates 
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/updates/$basearch/
enable=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/extras/$basearch/
enable=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/centosplus/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/contrib/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
----------------------------------------------
关于变量
    $releasever:代表发行版的版本,从[main]部分的distroverpkg获取,如果没有,则根据redhat-release包进行判断. 
    $arch:cpu体系,如i686,athlon等
    $basearch:cpu的基本体系组,如i686和athlon同属i386,alpha和alphaev6同属alpha. 

b. 导入GPG KEY
    yum 可以使用gpg 对包进行校验,确保下载包的完整性,所以我们先要到各个repository 站点找到gpg key,一般都会放在首页的醒目位置,一些名字诸如RPM-GPG-KEY-CentOS-6 之类的纯文本文件,把它们下载下来,然后用rpm --import RPM-GPG-KEY-CentOS-6 命令将key导入.

c. 执行yum 命令

其他国内yum源列表如下:
1. 企业贡献:
搜狐开源镜像站:http://mirrors.sohu.com/
网易开源镜像站:http://mirrors.163.com/
2. 大学教学:
北京理工大学:
    http://mirror.bit.edu.cn (IPv4 only)
    http://mirror.bit6.edu.cn (IPv6 only)
北京交通大学:
    http://mirror.bjtu.edu.cn (IPv4 only)
    http://mirror6.bjtu.edu.cn (IPv6 only)
    http://debian.bjtu.edu.cn (IPv4+IPv6)
兰州大学:http://mirror.lzu.edu.cn/
厦门大学:http://mirrors.xmu.edu.cn/
清华大学:
    http://mirrors.tuna.tsinghua.edu.cn/ (IPv4+IPv6)
    http://mirrors.6.tuna.tsinghua.edu.cn/ (IPv6 only)
    http://mirrors.4.tuna.tsinghua.edu.cn/ (IPv4 only)
天津大学:http://mirror.tju.edu.cn/
中国科学技术大学:
    http://mirrors.ustc.edu.cn/ (IPv4+IPv6)
    http://mirrors4.ustc.edu.cn/
    http://mirrors6.ustc.edu.cn/
东北大学:
    http://mirror.neu.edu.cn/ (IPv4 only)
    http://mirror.neu6.edu.cn/ (IPv6 only)
电子科技大学:http://ubuntu.uestc.edu.cn/



六  使用第三方软件库
    CentOS/RHEL默认的yum软件仓库非常有限,仅仅限于发行版本那几张盘里面的常规包和一些软件包的更新,利用RpmForge,可以增加非常多的第三方rpm软件包. RpmForge库现在已经拥有超过10000种CentOS的软件包,被CentOS社区认为是最安全也是最稳定的一个第三方软件库.

1  安装yum-priorities插件
    这个插件是用来设置yum在调用软件源时的顺序的. 因为官方提供的软件源,都是比较稳定和被推荐使用的. 因此,官方源的顺序要高于第三方源的顺序. 如何保证这个顺序,就需要安装yum-priorities这插件了.
    # yum -y install yum-priorities
2  安装完yum-priorities插件后需要设置/etc/yum.repos.d/ 目录下的.repo相关文件(如CentOS-Base.repo),在这些文件中插入顺序指令:priority=N (N为1到99的正整数,数值越小越优先)
    一般配置[base],[addons],[updates],[extras]的priority=1,[CentOSplus],[contrib]的priority=2,其他第三的软件源为:priority=N (推荐N>10)
    以CentOS-Base.repo 为例:
##############################################################
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=1
##############################################################

+---------------------------+
| 添加adobe软件仓并导入密钥 |
+---------------------------+
32位

# wget http://linuxdownload.adobe.com/linux/i386/adobe-release-i386-1.0-1.noarch.rpm

# rpm -ivh adobe-release-i386-1.0-1.noarch.rpm 
64位

# wget http://linuxdownload.adobe.com/linux/x86_64/adobe-release-x86_64-1.0-1.noarch.rpm

# rpm -ivh adobe-release-x86_64-1.0-1.noarch.rpm
# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
设置/etc/yum.repos.d/中的adobe-linux-x86_64.repo中的priority=10
现在可以安装adobe的flashplayer插件了
# yum install flash-plugin

+------------------+
安装atomic yum源 |
+------------------+
    # wget http://www.atomicorp.com/installers/atomic  #下载
    # sh ./atomic   #安装
    # vi  /etc/yum.repos.d/atomic.repo  #修改atomic yum源优先级,priority=11
##############################################################
[atomic]
name=CentOS / Red Hat Enterprise Linux $releasever - atomicrocketturtle.com
mirrorlist=http://www.atomicorp.com/mirrorlist/atomic/centos-6-$basearch
#mirrorlist=http://www.atomicorp.com/channels/atomic/centos/6/mirrors-atomic
enabled=1
protect=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY.art.txt
priority=11
##############################################################

+----------------+
安装epel yum源 |
+----------------+
rpmfusion主要为桌面发行版提供大量rpm包,而EPEL则为服务器版本提供大量的rpm包,而且大多数rpm包在官方repository中是找不到的;

CentOS 5.*
32位系统

# wget http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

# rpm -ivh epel-release-5-4.noarch.rpm
64位系统:

# wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

# rpm -ivh epel-release-5-4.noarch.rpm
导入key:

# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5

CentOS 6.*
32位系统:

# wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

# ipm -ivh epel-release-6-8.noarch.rpm
64位系统:

# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

# rpm -ivh epel-release-6-8.noarch.rpm
导入key:

# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

如果用比较新的软件,用epel-test.repo这个文件就行了
别忘了安装# yum install yum-priorities

    # vi /etc/yum.repos.d/epel.repo   #修改epel yum源优先级,priority=12
###############################################################
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
priority=12
#################################################################

+--------------------+
安装rpmforge软件源 |
+--------------------+
1  下载与安装相应rpmforge的rpm文件包,到http://pkgs.repoforge.org/rpmforge-release/ 查找对应版本的软件下载
32位# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
64位# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
2  安装DAG的PGP Key
    # rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
    或者导入本地的key
    # rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-*
3  验证rpmforge的rpm文件包
    # rpm -K rpmforge-release-0.5.3-1.el6.rf.*.rpm
4  安装rpmforge的rpm文件包
    # rpm -i rpmforge-release-0.5.3-1.el6.rf.*.rpm
5  设置/etc/yum.repos.d/rpmforge.repo文件中源的级别
    # cat rpmforge.repo 
########################################################
### Name: RPMforge RPM Repository for RHEL 6 - dag
### URL: http://rpmforge.net/
[rpmforge]
name=RHEL $releasever - RPMforge.net - dag
baseurl=http://apt.sw.be/redhat/el6/en/$basearch/rpmforge
mirrorlist=http://apt.sw.be/redhat/el6/en/mirrors-rpmforge
#mirrorlist=file:///etc/yum.repos.d/mirrors-rpmforge
enabled=1
protect=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck=1
priority=13
########################################################

+---------------------+
安装rpmfusion yum源 |
+---------------------+
含有各种音视频软件,但稳定性不如rpmforge
32位
    # rpm -ivh http://download1.rpmfusion.org/free/el/updates/6/i386/rpmfusion-free-release-6-1.noarch.rpm
    # rpm -ivh http://download1.rpmfusion.org/nonfree/el/updates/6/i386/rpmfusion-nonfree-release-6-1.noarch.rpm
64位
    # rpm -ivh http://download1.rpmfusion.org/free/el/updates/6/x86_64/rpmfusion-free-release-6-1.noarch.rpm
    # rpm -ivh http://download1.rpmfusion.org/nonfree/el/updates/6/x86_64/rpmfusion-nonfree-release-6-1.noarch.rpm

    # vi /etc/yum.repos.d/rpmfusion-free-updates.repo   #修改rpmfusion yum源优先级,priority=13
#################################################################
[rpmfusion-free-updates-testing]
name=RPM Fusion for EL 6 - Free - Test Updates
#baseurl=http://download1.rpmfusion.org/free/el/updates/testing/6/$basearch/
mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=free-el-updates-testing-6&arch=$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-el-6
priority=14
#################################################################

安装完毕执行
yum clean all
yum makecache
然后就可以使用新的yum源管理软件

//////////////////////下面是一个yum配置的脚本程序,可以运行于centos6.x////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 

[plain]  view plain  copy
 
  1. #! /bin/bash  
  2. # created by longbin <[email protected]>  
  3. # 2015-08-06  
  4. ## yum and yum plugins installation scripts  
  5.   
  6. PLAT_ARCH=$(uname -i | tr 'A-Z' 'a-z')  
  7.   
  8. ## check whether system is centos or not  
  9. function check_system_distributor() {  
  10. ## get system distributor ID: centos ?  
  11. LINUX_DISTRIBUTOR=$(cat /etc/issue |tr 'A-Z' 'a-z'|awk ' /release/ {print $1}' | sed -n "1p")  
  12. LINUX_DISTRIBUTOR=${LINUX_DISTRIBUTOR:=$(lsb_release -i |tr 'A-Z' 'a-z'|awk '/distributor/ {print $3}')}  
  13. LINUX_DISTRIBUTOR=${LINUX_DISTRIBUTOR:=$(cat /etc/*release |tr 'A-Z' 'a-z'|awk '/\<release\>/ {print $1}'|sed -n '1p')}  
  14. LINUX_DISTRIBUTOR=${LINUX_DISTRIBUTOR:=$(cat /etc/*release |tr 'A-Z' 'a-z'|awk '/distrib_id=/ {print $1}'|sed 's/distrib_id=//'|sed -n '1p')}  
  15.   
  16.     echo "checking system distributor and release ID ..."  
  17.     if [[ "${LINUX_DISTRIBUTOR}" == "centos" ]] ;then  
  18.         echo -e "\tCurrent OS Distributor: ${LINUX_DISTRIBUTOR}"  
  19.     else  
  20.         echo -e "\tCurrent OS is not centos"  
  21.         echo -e "\tCurrent OS Distributor: ${LINUX_DISTRIBUTOR}"  
  22.         exit 1  
  23.     fi  
  24. }  
  25.   
  26. ## check whether system is centos 6.5 or 6.6  
  27. function check_system_release_version() {  
  28. ## get system release version: 6.5/6.6 ?  
  29. LINUX_RELEASE_VERSION=$(cat /etc/issue | awk '/release/ {print $3}'| sed -n '1p')  
  30. LINUX_RELEASE_VERSION=${LINUX_RELEASE_VERSION:=$(lsb_release -r | tr 'A-Z' 'a-z' | awk '/release/ {print $2}')}  
  31. LINUX_RELEASE_VERSION=${LINUX_RELEASE_VERSION:=$(cat /etc/*release |tr 'A-Z' 'a-z'|awk '/\<release\>/ {print $3}'|sed -n '1p')}  
  32. LINUX_RELEASE_VERSION=${LINUX_RELEASE_VERSION:=$(cat /etc/*release |tr 'A-Z' 'a-z'|awk '/distrib_release=/ {print $1}'|sed 's/distrib_release=//'|sed -n '1p')}  
  33.     case ${LINUX_RELEASE_VERSION:0:5} in  
  34.         6.*)  
  35.             echo -e "\tCurrent OS Version: ${LINUX_RELEASE_VERSION}"  
  36.             ;;  
  37.         *)  
  38.             echo "Only support centos version, eg: 6.5/6.6 ..."  
  39.             exit 1  
  40.             ;;  
  41.     esac  
  42.     echo "checked OK, preparing to setup softwares ..."  
  43. }  
  44.   
  45. function check_user_UID() {  
  46.     sudo ls > /dev/null  
  47.     if [ "x$?" == "x1" ] ;then  
  48.         echo -e "\tThere is a configuration/permission problem."  
  49.         echo -e "\tPlease ensure that you have the permission"  
  50.         exit 1  
  51.     fi  
  52.     if [ "x${UID}" == "x0" ] ;then  
  53.         SUDO=''  
  54.     else  
  55.         SUDO=sudo  
  56.     fi  
  57. }  
  58.   
  59. function check_yum_install_env() {  
  60.     check_system_distributor  
  61.     check_system_release_version  
  62.     check_user_UID  
  63.     trap 'echo -e "\nAborted by user, exit";exit' INT  
  64.     if [ "x$(which yum 2>/dev/null)" == "x" ] ;then  
  65.         echo "yum not exists, please install yum manully"  
  66.         exit 1  
  67.     fi  
  68. }  
  69.   
  70. function yum_plugins_installation() {  
  71.     echo "Preparing to install yum plugins ..."  
  72.     # ${SUDO} yum install yum-*  
  73.     # ${SUDO} yum install axel  
  74.     ${SUDO} yum install yum-presto  
  75.     ${SUDO} yum install yum-fastestmirror  
  76.     ${SUDO} yum install yum-metadata-parser  
  77.     ${SUDO} yum install yum-downloadonly  
  78.     ${SUDO} yum install yum-priorities  
  79. }  
  80.   
  81. function yum_axel_plugin_install() {  
  82.     ${SUDO} yum install axel  
  83. #   if [ "x${PLAT_ARCH}" == "xx86_64" ] ;then  
  84. #       ${SUDO} rpm -ivh http://pkgs.repoforge.org/axel/axel-2.4-1.el6.rf.x86_64.rpm  
  85. #   else  
  86. #       ${SUDO} rpm -ivh http://pkgs.repoforge.org/axel/axel-2.4-1.el6.rf.i686.rpm  
  87. #   fi  
  88.     # pushd /etc/yum/pluginconf.d/  
  89.     # ${SUDO} wget http://cnfreesoft.googlecode.com/svn/trunk/axelget/axelget.conf  
  90.     ${SUDO} wget http://www.ha97.com/code/axelget.conf -P /etc/pluginconf.d/  
  91.     if [ "$?" != 0 ] ;then  
  92.         local tmp_file=$(mktemp)  
  93.         ${SUDO} cat > ${tmp_file} << EOF  
  94. [main]  
  95. enabled=1  
  96. onlyhttp=1  
  97. enablesize=54000  
  98. cleanOnException=1  
  99. EOF  
  100.         ${SUDO} mv ${tmp_file} /etc/yum/pluginconf.d/axelget.conf  
  101.     fi  
  102.     # popd  
  103.     # pushd /usr/lib/yum-plugins/  
  104.     # ${SUDO} wget http://cnfreesoft.googlecode.com/svn/trunk/axelget/axelget.py  
  105.     ${SUDO} wget http://www.ha97.com/code/axelget.py -P /usr/lib/yum-plugins/  
  106.     if [ "$?" != 0 ] ;then  
  107.         local tmp_file=$(mktemp)  
  108.         ${SUDO} cat > ${tmp_file} << EOF  
  109. from yum.plugins import PluginYumExit, TYPE_CORE, TYPE_INTERACTIVE  
  110. from urlparse import urljoin  
  111. import os,time  
  112.   
  113. requires_api_version = '2.3'  
  114. plugin_type = (TYPE_CORE, TYPE_INTERACTIVE)  
  115.   
  116. enablesize=300000  
  117. trymirrornum=-1  
  118. maxconn=10  
  119. httpdownloadonly=False  
  120. cleanOnException=0  
  121.   
  122. def init_hook(conduit):  
  123.     global enablesize,trymirrornum,maxconn,cleanOnException,httpdownloadonly  
  124.     enablesize = conduit.confInt('main','enablesize',default=30000)  
  125.     trymirrornum = conduit.confInt('main','trymirrornum',default=-1)  
  126.     maxconn = conduit.confInt('main','maxconn',default=10)  
  127.     httpdownloadonly=conduit.confBool('main','onlyhttp',default=False)  
  128.     cleanOnException=conduit.confInt('main','cleanOnException',default=0)  
  129.     return  
  130.   
  131. def predownload_hook(conduit):  
  132.     global enablesize,cleanOnException,httpdownloadonly  
  133.     preffermirror=""  
  134.     PkgIdx=0  
  135.     TotalPkg=len(conduit.getDownloadPackages())  
  136.     for po in (conduit.getDownloadPackages()):  
  137.         PkgIdx+=1  
  138.         if hasattr(po, 'pkgtype') and po.pkgtype == 'local':  
  139.             continue  
  140.         totsize = long(po.size)  
  141.         ret = False  
  142.         if totsize <= enablesize:  
  143.             conduit.info(2, "Package %s download size %d less than %d,Skip plugin!"  % (po.repo.id,totsize,enablesize))  
  144.             continue  
  145.         else:  
  146.             conduit.info(2, "[%d/%d]Ok,we will try to use axel to download this big file:%d" % (PkgIdx,TotalPkg,totsize))  
  147.         local = po.localPkg()  
  148.         if os.path.exists(local):  
  149.             if not os.path.exists(local+".st"):  
  150.                 fstate=os.stat(local)  
  151.                 if totsize == fstate.st_size:  
  152.                     conduit.info(2,"Target already exists,skip to next file!")  
  153.                     continue  
  154.         localall = "%s %s" % (local,local+".st")  
  155.         rmcmd = "rm -f %s" % (localall)  
  156.         curmirroridx = 0  
  157.         conduit.info(2,"Before we start,clean all the key files")  
  158.         os.system(rmcmd)  
  159.         connnum = totsize / enablesize  
  160.         if connnum*enablesize<totsize:  
  161.             connnum+=1  
  162.         if connnum > maxconn:  
  163.             connnum = maxconn  
  164.         mirrors=[]  
  165.         mirrors[:0]=po.repo.urls  
  166.         if preffermirror != "":  
  167.             mirrors[:0] = [preffermirror]  
  168.         for url in mirrors:  
  169.             if url.startswith("ftp://") and httpdownloadonly:  
  170.                 print "Skip Ftp Site:",url  
  171.                 continue  
  172.             if url.startswith("file://"):  
  173.                 print "Skip Local Site:",url  
  174.                 continue  
  175.             curmirroridx += 1  
  176.             if (curmirroridx > trymirrornum) and (trymirrornum != -1):  
  177.                 conduit.info(2, "Package %s has tried %d mirrors,Skip plugin!" % (po.repo.id,trymirrornum))  
  178.                 break  
  179.             remoteurl =  "%s/%s" % (url,po.remote_path)  
  180.             syscmd = "axel -a -n %s %s -o %s" % (connnum,remoteurl,local)  
  181.             conduit.info(2, "Execute axel cmd:\n%s"  % syscmd)  
  182.             os.system(syscmd)  
  183.             time.sleep(2)  
  184.             if os.path.exists(local+".st"):  
  185.                 conduit.info(2,"axel exit by exception,let's try another mirror")  
  186.                 if cleanOnException:  
  187.                     conduit.info(2,"because cleanOnException is set to 1,we do remove key file first")  
  188.                     os.system(rmcmd)  
  189.                 continue  
  190.             elif not os.path.exists(local):#this mirror may not update yet  
  191.                 continue  
  192.             else:  
  193.                 ret = True  
  194.                 preffermirror=url  
  195.                 break  
  196.         if not ret:  
  197.             conduit.info (2,"try to run rm cmd:%s"  % rmcmd)  
  198.             os.system(rmcmd)  
  199. EOF  
  200.         ${SUDO} mv ${tmp_file} /usr/lib/yum-plugins/axelget.py  
  201.     fi  
  202.     # popd  
  203. }  
  204.   
  205. # modify varible value of file callback function  
  206. function modify_varible_value_of_file_cb() {  
  207.     if [ "$#" -lt 3 ] ;then  
  208.         echo "too less arguments"  
  209.         exit 1  
  210.     fi  
  211.     # echo $*  
  212.     local filename=$1  
  213.     local variable=$2  
  214.     local value=$3  
  215.     local res=$(cat ${filename}| sed -n "/^${variable}/p")  
  216.     if [ "x${res}" == "x" ] ;then  
  217.         #append variable and value to file  
  218.         ${SUDO} sed -i "/^enable[d]\?[ ]\?=[ ]\?1/ a ${variable}=${value}" ${filename}  
  219.     else  
  220.         #modify variable and value to file  
  221.         ${SUDO} sed -i "/^${variable}[ ]\?=/ s;${variable}.*$;${variable}=${value};" ${filename}  
  222.     fi  
  223. }  
  224.   
  225. function check_yum_conf_enable_plugins() {  
  226.     local yum_conf=$(cat /etc/yum.conf| sed -n '/^plugins[ ]\?=[ ]\?1/p')  
  227.     if [ "x${yum_conf}" != "x" ] ;then  
  228.         return  
  229.     else  
  230.         # yum_conf_enable_plugins /etc/yum.conf  
  231.         modify_varible_value_of_file_cb /etc/yum.conf plugins 1  
  232.     fi  
  233. }  
  234.   
  235. function backup_yum_repos_d_files() {  
  236.     local backup_dir=/etc/yum.repos.d/repos.old.$(date +%Y%m%d%H%M%S)  
  237.     ${SUDO} mkdir -p ${backup_dir}  
  238.     if [ "x$?" != "x0" ] ;then  
  239.         return  
  240.     fi  
  241.     # pushd /etc/yum.repos.d  
  242.     for file in $(ls /etc/yum.repos.d/ | sed -n '/repo$/p') ;  
  243.     do  
  244.         if [ -f "/etc/yum.repos.d/${file}" ] ;then  
  245.             ${SUDO} cp /etc/yum.repos.d/${file} ${backup_dir}  
  246.         fi  
  247.     done  
  248.     # popd  
  249. }  
  250.   
  251. function create_local_repo_DVD() {  
  252.     if [ -f CentOS-6.6-x86_64-bin-DVD1.iso ] ;then  
  253.         ${SUDO} mkdir /media/_local_repo_DVD1  
  254.         ${SUDO} mount -o loop -t iso9660 CentOS-6.6-x86_64-bin-DVD1.iso /media/_local_repo_DVD1  
  255.     fi  
  256.     if [ -f CentOS-6.6-x86_64-bin-DVD2.iso ] ;then  
  257.         ${SUDO} mkdir /media/_local_repo_DVD2  
  258.         ${SUDO} mount -o loop -t iso9660 CentOS-6.6-x86_64-bin-DVD2.iso /media/_local_repo_DVD2  
  259.     fi  
  260.     local tmp_file=$(mktemp)  
  261.     ${SUDO} cat > ${tmp_file} << EOF  
  262. [_local_repo_DVD]  
  263. name=CentOS-\$releasever - Media  
  264. baseurl=file:/var/lib/yum/plugins/local  
  265.         file:///media/CentOS/  
  266.         file:///mnt/cdrom/  
  267.         file:///media/cdrecorder/  
  268.         file:///media/_local_repo_DVD1  
  269.         file:///media/_local_repo_DVD2  
  270. enabled=0  
  271. priority=9  
  272. gpgcheck=1  
  273. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6  
  274. EOF  
  275.     ${SUDO} mv ${tmp_file} /etc/yum.repos.d/_local_repo_DVD.repo  
  276. }  
  277.   
  278. function create_maintain_script() {  
  279.     return #no need to create the script  
  280.     local tmp_file=$(mktemp)  
  281.     ${SUDO} cat > ${tmp_file} << EOF  
  282. #! /bin/bash  
  283. read -p "backup or restore <bk/rs>? " select  
  284. if [[ "x\${select}" == "xbk" ]] ;then  
  285.     for file in \$(ls /etc/yum.repos.d/ | sed -n '/repo$/p')  
  286.     do  
  287.         sudo mv \${file} \${file}.backup  
  288.     done  
  289. elif [[ "x\${select}" == "xrs" ]] ;then  
  290.     for file in \$(ls /etc/yum.repos.d/ | sed -n '/backup$/p')  
  291.     do  
  292.         sudo mv \${file} \${file%.backup*}  
  293.     done  
  294. else  
  295.     echo "Invalid option "  
  296. fi  
  297. EOF  
  298.     ${SUDO} mv ${tmp_file} /etc/yum.repos.d/_backup_restore.sh  
  299. }  
  300.   
  301. # add adobe repo  
  302. function yum_add_adobe_repo() {  
  303.     if [ "x${PLAT_ARCH}" == "xx86_64" ] ;then  
  304.         #64bit#  
  305.         ${SUDO} rpm -ivh http://linuxdownload.adobe.com/linux/x86_64/adobe-release-x86_64-1.0-1.noarch.rpm  
  306.     else  
  307.         #32bit#  
  308.         ${SUDO} rpm -ivh http://linuxdownload.adobe.com/linux/i386/adobe-release-i386-1.0-1.noarch.rpm  
  309.     fi  
  310.     ${SUDO} rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux  
  311.     # set adobe-linux-x86_64.repo priority=10  
  312.     local repo_file=/etc/yum.repos.d/adobe-linux-${PLAT_ARCH}.repo  
  313.     modify_varible_value_of_file_cb ${repo_file} priority 10  
  314.     ${SUDO} yum install flash-plugin  
  315. }  
  316.   
  317. # add atomic repo  
  318. function yum_add_atomic_repo() {  
  319.     ${SUDO} wget http://www.atomicorp.com/installers/atomic  #download  
  320.     ${SUDO} chmod a+x ./atomic  
  321.     yes " " | sudo sh ./atomic   #install  
  322.     ${SUDO} rm -f ./atomic  
  323. }  
  324.   
  325. # add epel repo  
  326. function yum_add_epel_repo() {  
  327. #   if [ "${PLAT_ARCH}" == "xx86_64" ] ;then  
  328. #       #64bit:#  
  329. #       ${SUDO} rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm  
  330. #   else  
  331. #       #32bit#  
  332. #       ${SUDO} rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm  
  333. #   fi  
  334.     ${SUDO} yum install epel-release  
  335.     ${SUDO} rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6  
  336. }  
  337.   
  338. # add rpmforge repo  
  339. function yum_add_rpmforge_repo() {  
  340.     # download from http://pkgs.repoforge.org/rpmforge-release/  
  341.     if [ "x${PLAT_ARCH}" == "xx86_64" ] ;then  
  342.         #64bit#  
  343.         ${SUDO} wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm  
  344.     else  
  345.         #32bit#  
  346.         ${SUDO} wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm  
  347.     fi  
  348.     ${SUDO} rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt  
  349.     ${SUDO} rpm -ivh rpmforge-release-0.5.3-1.el6.rf.*.rpm  
  350.     ${SUDO} rm -f rpmforge-release-0.5.3-1.el6.rf*.rpm  
  351. }  
  352.   
  353. # add rpmfusion repo which includes many multimedia libs  
  354. function yum_add_rpmfusion_repo() {  
  355.     if [ "x${PLAT_ARCH}" == "xx86_64" ] ;then  
  356.         #64bit  
  357.         ${SUDO} rpm -ivh http://download1.rpmfusion.org/free/el/updates/6/x86_64/rpmfusion-free-release-6-1.noarch.rpm  
  358.         ${SUDO} rpm -ivh http://download1.rpmfusion.org/nonfree/el/updates/6/x86_64/rpmfusion-nonfree-release-6-1.noarch.rpm  
  359.     else  
  360.         #32bit  
  361.         ${SUDO} rpm -ivh http://download1.rpmfusion.org/free/el/updates/6/i386/rpmfusion-free-release-6-1.noarch.rpm  
  362.         ${SUDO} rpm -ivh http://download1.rpmfusion.org/nonfree/el/updates/6/i386/rpmfusion-nonfree-release-6-1.noarch.rpm  
  363.     fi  
  364. }  
  365.   
  366. function yum_add_nux_dextop_repo() {  
  367.     if [ "x${PLAT_ARCH}" == "xx86_64" ] ;then  
  368.         #64bit  
  369.         ${SUDO} rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm  
  370.     else  
  371.         #32bit  
  372.         ${SUDO} rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/i386/nux-dextop-release-0-2.el6.nux.noarch.rpm  
  373.     fi  
  374.     # ${SUDO} rm -f nux-dextop-release*.rpm  
  375.     modify_varible_value_of_file_cb nux-dextop.repo enable 1  
  376. }  
  377.   
  378. function setup_yum_repos_priority() {  
  379.     # pushd /etc/yum.repos.d/  
  380.     REPO_FILE_LIST=" CentOS-Base.repo atomic.repo epel.repo epel-testing.repo nux-dextop.repo rpmforge.repo rpmfusion-free-updates.repo "  
  381.     repo_priority_num=1  
  382.     for file in ${REPO_FILE_LIST}  
  383.     do  
  384.         file=/etc/yum.repos.d/${file}  
  385.         if [ -f "${file}" ] ;then  
  386.             echo "updating ${file} ..."  
  387.             modify_varible_value_of_file_cb ${file} priority XXX  
  388.         else  
  389.             continue  
  390.         fi  
  391.         for ((i=0; i<5; i++)) ;  
  392.         do  
  393.             let prn=${repo_priority_num}+${i}  
  394.             # echo ${repo_priority_num} ${prn}  
  395.             ${SUDO} sed "1, /^priority=XXX/ {/^priority=XXX/ s/priority=.*$/priority=${prn}/}" -i ${file}  
  396.         done  
  397.         let repo_priority_num+=5  
  398.     done  
  399.     # popd  
  400. }  
  401.   
  402. function rebuild_yum_cache() {  
  403.     ${SUDO} yum clean all  
  404.     ${SUDO} yum makecache  
  405. }  
  406.   
  407. function install_and_setup_yum_plugins() {  
  408.     yum_plugins_installation  
  409.     # yum_axel_plugin_install  
  410. }  
  411.   
  412. function enable_and_backup_repos() {  
  413.     check_yum_conf_enable_plugins  
  414.     backup_yum_repos_d_files  
  415. }  
  416.   
  417. function add_extra_repos() {  
  418.     create_local_repo_DVD  
  419.     # create_maintain_script  
  420.     yum_add_adobe_repo  
  421.     # yum_add_atomic_repo  
  422.     yum_add_epel_repo  
  423.     yum_add_nux_dextop_repo  
  424.     yum_add_rpmforge_repo  
  425.     yum_add_rpmfusion_repo  
  426.     yum_axel_plugin_install  
  427. }  
  428.   
  429. function setup_priority_and_rebuild_cache() {  
  430.     setup_yum_repos_priority  
  431.     rebuild_yum_cache  
  432. }  
  433.   
  434. check_yum_install_env  
  435. install_and_setup_yum_plugins  
  436. enable_and_backup_repos  
  437. add_extra_repos  
  438. setup_priority_and_rebuild_cache  



 

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
=========================================================================
YUM错误conflicts with file from package的解决办法

YUM一堆错误,是64位的包和32位的包冲突. 
YUM错误conflicts with file from package的解决办法,先卸载有冲突的软件包,如下是 yum -y remove subversion 然后再重新YUM就OK了.
--------------------------------------------------------------------------
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test

Transaction Check Error:
  file /usr/share/emacs/site-lisp/psvn.el from install of subversion-1.4.6-jason.1.i386 conflicts with file from package subversion-1.4.2-4.el5_3.1.x86_64
  file /usr/share/locale/es/LC_MESSAGES/subversion.mo from install of subversion-1.4.6-jason.1.i386 conflicts with file from package subversion-1.4.2-4.el5_3.1.x86_64
  file /usr/share/locale/it/LC_MESSAGES/subversion.mo from install of subversion-1.4.6-jason.1.i386 conflicts with file from package subversion-1.4.2-4.el5_3.1.x86_64
  file /usr/share/locale/ja/LC_MESSAGES/subversion.mo from install of subversion-1.4.6-jason.1.i386 conflicts with file from package subversion-1.4.2-4.el5_3.1.x86_64
  file /usr/share/locale/ko/LC_MESSAGES/subversion.mo from install of subversion-1.4.6-jason.1.i386 conflicts with file from package subversion-1.4.2-4.el5_3.1.x86_64
  file /usr/share/locale/nb/LC_MESSAGES/subversion.mo from install of subversion-1.4.6-jason.1.i386 conflicts with file from package subversion-1.4.2-4.el5_3.1.x86_64
  file /usr/share/locale/zh_CN/LC_MESSAGES/subversion.mo from install of subversion-1.4.6-jason.1.i386 conflicts with file from package subversion-1.4.2-4.el5_3.1.x86_64
  file /usr/share/xemacs/site-packages/lisp/psvn.el from install of subversion-1.4.6-jason.1.i386 conflicts with file from package subversion-1.4.2-4.el5_3.1.x86_64

Error Summary
-------------
-------------------------------------------------------------------------
正当高兴的时候,发现yum安装webmin的时候还是有错误:
-------------------------------------------------------------------------
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
FATAL - 2010-11-28 15:51:02 - Fatal Error Occurred: Something went wrong during installation: 0
FATAL - 2010-11-28 15:51:03 - Cannot continue installation.
FATAL - 2010-11-28 15:51:03 - Attempting to remove virtualmin repository configuration,so the installation can be
FATAL - 2010-11-28 15:51:03 - re-attempted after any problems have been resolved.
FATAL - 2010-11-28 15:51:03 - Removing temporary directory and files.
FATAL - 2010-11-28 15:51:03 - If you are unsure of what went wrong,you may wish to review the log
FATAL - 2010-11-28 15:51:03 - in /root/virtualmin-install.log
------------------------------------------------------------------------
看日志发现,yum更新的时候有重复的32位和64位的包:

Dependencies Resolved
================================================================================
 Package            Arch       Version                 Repository          Size
================================================================================
Installing:
 dovecot            x86_64     1.0.7-7.el5             base               1.7 M
 httpd              i386       2.2.16-jason.1          utterramblings     3.0 M
 httpd              x86_64     1:2.2.3-43.3.vm         virtualmin         1.2 M
 mailman            x86_64     3:2.1.9-4.el5           base               9.8 M
 mod_dav_svn        x86_64     1.4.2-4.el5_3.1         base                70 k
 mod_dav_svn        i386       1.4.6-jason.1           utterramblings     201 k
 mod_perl           x86_64     2.0.4-6.el5             base               4.0 M
 mod_perl           i386       2.0.4-7.jason.2         utterramblings     5.4 M

系统是64位的,所以很明显utterramblings  的yum源32位是有问题的. 我们需要删除这个utterramblings源. 

# cd /etc/yum.repos.d/
# mv utterrambling.repo utterrambling.repo.del

然后我们yum重新安装virtualmin,终于一切正常了

yum-3.2.29-40.el6.centos.noarch.rpm
yum-metadata-parser-1.1.2-16.el6.i686.rpm
yum-plugin-aliases-1.1.30-14.el6.noarch.rpm
yum-plugin-changelog-1.1.30-14.el6.noarch.rpm
yum-plugin-downloadonly-1.1.30-14.el6.noarch.rpm
yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
yum-plugin-security-1.1.30-14.el6.noarch.rpm
yum-plugin-tmprepo-1.1.30-14.el6.noarch.rpm
yum-plugin-verify-1.1.30-14.el6.noarch.rpm
yum-plugin-versionlock-1.1.30-14.el6.noarch.rpm
yum-presto-0.6.2-1.el6.noarch.rpm
yum-utils-1.1.30-14.el6.noarch.rpm

猜你喜欢

转载自shiguanghui.iteye.com/blog/2293724