redhad 7.0更换yum源
1、 卸载红帽yum源
rpm –e $(rpm –qa|grep yum) --nodeps
2、删除所有repo相关文件
rm –rf /etc/yum.conf
rm –rf /etc/yum.repos.d/
rm –rf /var/cache/yum
3、下载centos相关组件
网易源:http://mirrors.163.com/centos/6/os/x86_64/Packages/
阿里云源:http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/ rpm-4.8.0-59.el6.x86_64.rpm
4、安装组件
rpm -ivh rpm-4.8.0-59.el6.x86_64.rpm yum-metadata-parser-1.1.2-16.el6.x86_64.rpm python-urlgrabber-3.9.1-11.el6.noarch.rpm yum-3.2.29-81.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
无法安装原因是依赖包冲突:加上--force参数,强制安装
5、下载base和epel仓库
wget –O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
sed –i ‘s#\$releasever#7#g’ /etc/yum.repos.d/CentOS-Base.repo
sed -i "s;\$releasever;7;g" /etc/yum.repos.d/CentOS-Base.repo
wget –O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo
6、清空缓存和生成缓存
yum clean all #清空 yum 缓存,使其设置生效
yum makecache #加载服务器软件包缓存信息,提高搜索安装软件的速度