在使用CentOS 5.X过程中,虽然自身源仓库里的软件包比起Redhat已经全了很多,但还是有很多常用的包没有,这时候就要用到第三方的源仓库,我这里使用的是rpmfusion这个源,相对来说速度很快,软件包也很齐全。

1、查看系统已经开启的YUM

[root@server ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.btte.net
 * extras: mirrors.btte.net
 * updates: mirrors.btte.net
repo id                    repo name                              status
addons                     CentOS-5 - Addons                      enabled:     0
base                       CentOS-5 - Base                        enabled: 2,725
extras                     CentOS-5 - Extras                      enabled:   282
updates                    CentOS-5 - Updates                     enabled:   858 
# 发现并没有启用rpmfusion源
2、安装rpmfusion仓库包(在这之前先安装 epel-release的包)
32位:
[root@server ~]# rpm -ivh http://mirrors.ustc.edu.cn/fedora/epel/5/i386/epel-release-5-4.noarch.rpm
Retrieving
http://mirrors.ustc.edu.cn/fedora/epel/5/i386/epel-release-5-4.noarch.rpm
warning: /var/tmp/rpm-xfer.AJYJu6: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing...                ########################################### [100%]
   1:epel-release           ########################################### [100%]

[root@server ~]# rpm -ivh http://mirrors.163.com/rpmfusion/free/el/updates/5/i386/rpmfusion-free-release-5-1.noarch.rpm http://mirrors.163.com/rpmfusion/nonfree/el/updates/5/i386/rpmfusion-nonfree-release-5-1.noarch.rpm
Retrieving http://mirrors.163.com/rpmfusion/free/el/updates/5/i386/rpmfusion-free-release-5-1.noarch.rpm
Retrieving http://mirrors.163.com/rpmfusion/nonfree/el/updates/5/i386/rpmfusion-nonfree-release-5-1.noarch.rpm
warning: /var/tmp/rpm-xfer.XlgX0E: Header V3 DSA signature: NOKEY, key ID e74f0522
warning: /var/tmp/rpm-xfer.ErMur0: Header V3 DSA signature: NOKEY, key ID ab194290
Preparing...                ########################################### [100%]
   1:rpmfusion-free-release ########################################### [ 50%]
   2:rpmfusion-nonfree-relea########################################### [100%] 
64位:
[root@server ~]# rpm -ivh http://mirrors.ustc.edu.cn/fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm

[root@server ~]# rpm -ivh http://mirrors.163.com/rpmfusion/nonfree/el/updates/5/x86_64/rpmfusion-nonfree-release-5-1.noarch.rpm http://mirrors.163.com/rpmfusion/nonfree/el/updates/5/x86_64/rpmfusion-nonfree-release-5-1.noarch.rpm 
3、重新创建YUM缓存
[root@server ~]# yum clean all && yum makecache
Loaded plugins: fastestmirror
Cleaning up Everything
Cleaning up list of fastest mirrors
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: centos.ustc.edu.cn
 * epel: mirrors.ustc.edu.cn
 * extras: centos.ustc.edu.cn
 * rpmfusion-free-updates: mirrors.ustc.edu.cn
 * rpmfusion-nonfree-updates: mirrors.ustc.edu.cn
 * updates: centos.ustc.edu.cn
addons                                                   | 1.9 kB     00:00    
addons/filelists_db                                      |  564 B     00:00    
addons/other_db                                          |  552 B     00:00    
addons/primary_db                                        | 1.1 kB     00:00    
base                                                     | 1.1 kB     00:00    
base/filelists                                           | 3.0 MB     01:04    
base/other                                               |  10 MB     03:48    
base/group                                               | 1.1 MB     00:23    
base/primary                                             | 967 kB     00:20    
epel                                                     | 3.7 kB     00:00    
epel/filelists_db                                        | 4.8 MB     01:44    
epel/updateinfo                                          | 465 kB     00:09    
epel/other_db                                            | 1.9 MB     00:40    
epel/group_gz                                            | 168 kB     00:03    
epel/primary_db                                          | 3.1 MB     01:07    
extras                                                   | 2.1 kB     00:00    
extras/filelists_db                                      | 214 kB     00:07    
extras/other_db                                          | 426 kB     00:09    
extras/group                                             | 9.7 kB     00:00    
extras/primary_db                                        | 171 kB     00:03    
rpmfusion-free-updates                                   | 2.8 kB     00:00    
rpmfusion-free-updates/filelists_db                      |  37 kB     00:00    
rpmfusion-free-updates/other_db                          |  28 kB     00:00    
rpmfusion-free-updates/group_gz                          | 1.4 kB     00:00    
rpmfusion-free-updates/primary_db                        |  63 kB     00:01    
rpmfusion-nonfree-updates                                | 2.8 kB     00:00    
rpmfusion-nonfree-updates/filelists_db                   | 8.6 kB     00:00    
rpmfusion-nonfree-updates/other_db                       | 7.9 kB     00:00    
rpmfusion-nonfree-updates/group_gz                       | 1.4 kB     00:00    
rpmfusion-nonfree-updates/primary_db                     |  18 kB     00:00    
updates                                                  | 1.9 kB     00:00    
updates/filelists_db                                     | 3.2 MB     01:10    
updates/other_db                                         |  15 MB     05:26    
updates/primary_db                                       | 757 kB     00:18    
base                                                                  2725/2725
base                                                                  2725/2725
base                                                                  2725/2725
Metadata Cache Created 
4、验证已经开启的YUM

[root@server ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.ustc.edu.cn
 * epel: mirrors.ustc.edu.cn
 * extras: centos.ustc.edu.cn
 * rpmfusion-free-updates: mirrors.ustc.edu.cn
 * rpmfusion-nonfree-updates: mirrors.ustc.edu.cn
 * updates: centos.ustc.edu.cn
repo id                   repo name                               status
addons                    CentOS-5 - Addons                       enabled:     0
base                      CentOS-5 - Base                         enabled: 2,725
epel                      Extra Packages for Enterprise Linux 5 - enabled: 5,814
extras                    CentOS-5 - Extras                       enabled:   282
rpmfusion-free-updates    RPM Fusion for EL 5 - Free - Updates    enabled:    95
rpmfusion-nonfree-updates RPM Fusion for EL 5 - Nonfree - Updates enabled:    26

updates                   CentOS-5 - Updates                      enabled:   858
repolist: 9,800
# 发现已经启用了rpmfusion源