Skip to content

Instantly share code, notes, and snippets.

@hongmengwang
Created January 22, 2018 09:38
Show Gist options
  • Save hongmengwang/55833a6d0d8c28369286fa24b52aede9 to your computer and use it in GitHub Desktop.
Save hongmengwang/55833a6d0d8c28369286fa24b52aede9 to your computer and use it in GitHub Desktop.
replace yum repository on redhat6

1. delete yum repo on redhat6

rpm -aq | grep yum|xargs rpm -e --nodeps

2. download centos's rpm packages

wget http://mirror.centos.org/centos/6.0/os/i386/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget http://mirror.centos.org/centos/6.0/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirror.centos.org/centos/6.0/os/i386/Packages/yum-3.2.29-69.el6.centos.noarch.rpm
wget http://mirror.centos.org/centos/6.0/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm

3. install rmp packages, the last two must be installed at the same time

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-69.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm

4. modify yum repo, add mirror of netease

cd /etc/yum.repos.d/ && wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

5. replace all $releasever to 6 in CentOS6-Base-163.repo

6. clean/cache

yum clean all && yum makecache

p.s. if got key error when installed, please import rmp keyp.s. if got key error when installed, please import rmp key

rpm --import http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment