Redhat6.7 switch Centos yum source

RedHat replace Yum source

1. Check the yum package rpm -qa |grep yum
2. Delete the built-in package
rpm -aq | grep yum | xargs rpm -e --nodeps
3. Check again
rpm -qa |grep yum
4. Download the update package
 
5. Execute the installation
rpm -ivh yum-*
if it appears
error: Failed dependencies:
        python-urlgrabber >= 3.9.1-10 is needed by yum-3.2.29-73.el6.centos.noarch
Don't panic, this problem is disgusting and will lead to the failure of subsequent installations, use the following
rpm -Uvh python-urlgrabber-3.9.1-11.el6.noarch.rpm
Update the version of rpm -Uvh python-urlgrabber, if you don't update it, you won't be able to install it
While executing:
rpm -ivh yum-*
 
warning: yum-3.2.29-73.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:yum-metadata-parser    ########################################### [ 20%]
   2:yum-plugin-fastestmirro########################################### [ 40%]
   3:yum                    ########################################### [ 60%]
   4:yum-updateonboot       ########################################### [ 80%]
   5:yum-utils              ########################################### [100%]
Installation was successful
6. Switch the source
cd /etc/yum.repos.d/ 
mv redhat.repo redhat.repo.bak
mv rhel-source.repo rhel-source.repo.bak
vi /etc/yum.repos.d/CentOS-Base.repo
Paste the following information:
 
#CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-6 - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
 
#released updates
[updates]
name=CentOS-6 - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
 
#additional packages that may be useful
[extras]
name=CentOS-6 - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6 - Plus - 163.com
baseurl = http: //mirrors.163.com/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
 
 
8. Clear cache

yum clean all

yum makecache

 

9. Verify

yum install telnet

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326402407&siteId=291194637