共2种方法
第一种
手配:
1. root 下执行
2. 删除rhel6.4自带的yum,命令如下: rpm -aq|grep yum|xargs rpm -e --nodeps
3.
下载CentOS 6.4的yum,命令如下:
wget http://mirrors.163.com/centos/6.4/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget http://mirrors.163.com/centos/6.4/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6.4/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
wget http://mirrors.163.com/centos/6.4/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.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-40.el6.centos.noarch.rpm
rpm -ivh yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
5.配置repo文件
新建CentOS-Base.repo文件,内容为:
[base]
name=CentOS-6 - Base
repo=os
baseurl=http://mirrors.163.com/centos/6.4/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#released updates
[update]
name=CentOS-6 - Updates
baseurl=http://mirrors.163.com/centos/6.4/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#packages used/produced in the build but not released
#[addons]
#name=CentOS-6 - Addons
#baseurl=http://mirrors.163.com/centos/6.4/addons/$basearch/
#gpgcheck=1
#gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-6 - Extras
baseurl=http://mirrors.163.com/centos/6.4/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6 - Plus
baseurl=http://mirrors.163.com/centos/6.4/centosplus/$basearch/
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-6 - Contrib
baseurl=http://mirrors.163.com/centos/6.4/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
保存后将CentOS-Base.repo移到/etc/yum.repos.d/ 里面,
命令如下: mv ./CentOS-Base.repo /etc/yum.repos.d/
6.清除yum缓存
clean yum all
第二种
脚本:
mv /etc/yum.repos.d/rhel-debuginfo.repo /etc/yum.repos.d/rhel-debuginfo.repo.bak
cd /tmp
wget http://mirrors.163.com/centos/6.4/os/i386/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget http://mirrors.163.com/centos/6.4/os/i386/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6.4/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
wget http://mirrors.163.com/centos/6.4/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.i686.rpm
rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpm
rpm -ivh yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-16.el6.i686.rpm
cd /etc/yum.repos.d/
wget http://mirrors.163.com/centos/6.4/os/i386/RPM-GPG-KEY-CentOS-6
rpm --import RPM-GPG-KEY-CentOS-6 &&wget http://mirrors.163.com/.help/CentOS6-Base-163.repo -O /etc/yum.repos.d/CentOS6-Base.repo &&sed -i 's/\$releasever/6.4/g' /etc/yum.repos.d/CentOS6-Base.repo
yum clean all
yum update -y
手配是redhat-6.4-64位的
脚本是32位的所以要用脚本64位的请把上面所有i386改成x86_64.
脚本说明:
备份repo文件
mv /etc/yum.repos.d/rhel-debuginfo.repo /etc/yum.repos.d/rhel-debuginfo.repo.bak
删除原有的yum
rpm -aq|grep yum|xargs rpm -e --nodeps
下载安装yum
wget http://mirrors.163.com/centos/6.4/os/i386/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget http://mirrors.163.com/centos/6.4/os/i386/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6.4/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
wget http://mirrors.163.com/centos/6.4/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.i686.rpm
导入密钥
cd /etc/yum.repos.d/
wget http://mirrors.163.com/centos/6.4/os/i386/RPM-GPG-KEY-CentOS-6
rpm --import RPM-GPG-KEY-CentOS-6 &&
下载编辑repo文件
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo -O /etc/yum.repos.d/CentOS6-Base.repo &&
sed -i 's/\$releasever/6.4/g' /etc/yum.repos.d/CentOS6-Base.repo
清缓存升级
yum clean all
yum update -y