1.为了方便起见,先切换到root用户
rpm -aq|grep yum|xargs rpm -e --nodeps
3.下载yum安装文件
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-22.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-10.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
4.进行安装yum,要按照顺序哦.
rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
rpm -ivh yum-3.2.29-22.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-10.el6.noarch.rpm
5.将CentOS 6的repository的作为yum源
[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
enable=1
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
enable=1
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#packages used/produced in the build but not released
#[addons]
#name=CentOS-$releasever - Addons
#baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/
#gpgcheck=1
#gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
enable=1
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/
gpgcheck=1
enabled=0
Loaded plugins: fastestmirror, product-id, subscription-manager
Updating Red Hat repositories.
Determining fastest mirrors
base | 3.7 kB 00:00
base/filelists_db | 5.8 MB 01:08
base/primary_db | 4.5 MB 00:50
base/other_db | 2.6 MB 00:27
base/group_gz | 199 kB 00:02
extras | 3.5 kB 00:00
extras/filelists_db | 2.7 kB 00:00
extras/prestodelta | 124 B 00:00
extras/primary_db | 6.3 kB 00:00
extras/other_db | 3.2 kB 00:00
updates | 3.5 kB 00:00
updates/filelists_db | 1.7 MB 00:19
updates/prestodelta | 212 kB 00:02
updates/primary_db | 2.3 MB 00:25
updates/other_db | 239 kB 00:03
Metadata Cache Created
另外,还有几个常用的源
epel源:
[root@CACTI yum.repos.d]# cat epel.repo
[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=http://ftp.cuhk.edu.hk/pub/linux/fedora-epel/RPM-GPG-KEY-EPEL-6
[root@CACTI yum.repos.d]#
Rpmforge源:
[RPMFORGE]
name=redhat - $releasver - rpmforge
baseurl=http://apt.sw.be/redhat/el6/en/x86_64/rpmforge
enable=1
gpgcheck=0
本地源:
[root@CACTI yum.repos.d]# cat local.repo
[rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=file:///mnt/rhel
enabled=1
gpgcheck=1
gpgkey=file:///mnt/rhel/RPM-GPG-KEY-redhat-release