1.检查是否安装yum包
查看RHEL是否安装了yum,若是安装了,那么又有哪些yum包:rpm -qa |grep yum
2 删除redhat自带的yum包
rpm -qa|grep yum|xargs rpm -e --nodeps(不检查依赖,直接删除rpm包)
rpm -qa |grep yum (检查是否有残存yum包)
3.下载新的yum包
使用Centos6.5的yum包
- wget http://mirrors.163.com/centos/6/os/i386/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
- wget http://mirrors.163.com/centos/6/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.i686.rpm
- wget http://mirrors.163.com/centos/6/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
- wget http://mirrors.163.com/centos/6/os/i386/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
- wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.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-60.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm (互相依赖,必须同时安装)
如果出现错误
rpm -qa|grep python (查找python-urlgrabber包版本)
rpm -e **.rpm(卸载包)
rpm –ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm 或者rpm –Uvh python-urlgrabber-3.9.1-11.el6.noarch.rpm(升级包)
5.更换yum阿里云
wget -O /etc/yum.repos.d/CentOS-Base.repo
http://mirrors.aliyun.com/repo/Centos-6.repo
cd /etc/yum.repos.d/
vi CentOS-Base.Repo
编辑文件,把文件里面的$releasever全部替换为版本号,即6.5
6重建缓存
yum clean all
yum makecache
7 pid锁定错误处理
在此阶段,可能会出现下图的错误
直接在终端运行 rm -f /var/run/yum.pid 将该文件删除,然后再次运行yum
8 mysql错误提示
将yum.repos.d下面的其它*.repo文件都备份放到一个子目录,然后yum makecache
参考资料
- u redhat6.5 配置使用centos的yum源:http://blog.51cto.com/qingwang/1551228
- RHEL6配置yum源为网易镜像https://www.jianshu.com/p/446e3fe7d710
- yum占用处理:https://blog.csdn.net/weiyuanzhuo/article/details/52168910
- 修改为阿里云:https://www.cnblogs.com/kaishirenshi/p/8967121.html