RedHat 7更换Centos yum源
RedHat 7更换Centos yum源,需要准备以下RPM包:
python-iniparse-0.4-9.el7.noarch.rpm
rpm-build-libs-4.11.3-35.el7.x86_64.rpm
yum-3.4.3-161.el7.centos.noarch.rpm
python-urlgrabber-3.10-9.el7.noarch.rpm
rpm-devel-4.11.3-35.el7.x86_64.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
rpm-4.11.3-35.el7.x86_64.rpm
rpm-libs-4.11.3-35.el7.x86_64.rpm
yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm
rpm-build-4.11.3-35.el7.x86_64.rpm
rpm-python-4.11.3-35.el7.x86_64.rpm
可以访问:http://mirrors.163.com/centos/7/os/x86_64/Packages/,查找下载对应包的最新版本,rpm包的版本随时都有可能更新,下载时只需要根据包名查找最新版下载即可。
安装包准备好后,执行下面命令:
rpm -qa|grep yum | xargs rpm -e --nodeps rpm -qa|grep Python-urlgrabber | xargs rpm -e --nodeps rpm -Uvh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm rpm -Uvh python-urlgrabber-3.10-9.el7.noarch.rpm rpm -Uvh python-iniparse-0.4-9.el7.noarch.rpm rpm -Uvh rpm-4.11.3-35.el7.x86_64.rpm rpm-libs-4.11.3-35.el7.x86_64.rpm rpm-python-4.11.3-35.el7.x86_64.rpm rpm-build-libs-4.11.3-35.el7.x86_64.rpm rpm -Uvh yum-3.4.3-161.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm mv /etc/yum.repos.d/redhat.repo /etc/yum.repos.d/redhat.repobak curl -O http://mirrors.163.com/.help/CentOS7-Base-163.repo mv CentOS7-Base-163.repo /etc/yum.repos.d/CentOS7-Base-163.repo sed -i "s@\$releasever@7@g" /etc/yum.repos.d/CentOS7-Base-163.repo yum clean all && yum makecache
如果使用epel yum源install时遇到:Error: compat-qpid-cpp-client conflicts with qpid-cpp-client-1.38.0-2.el7.x86_64
可以尝试下面方法修复或留言:
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm rpm -Uvh epel-release*rpm yum -y install compat-qpid-cpp-client
# http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm地址不可用时,可以尝试访问:http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e 查找epel-release包最新版下载地址替换即可。