Redhat6.5 configures the yum source using centos

Newly installed redhat6.5. After installation, log in to the system and use yum update to update the system. Tip:
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Unable to update.
The yum source that comes with redhat by default needs to be registered before it can be updated. We want to update without spending money, we need to replace the yum source of redhat.
1. Check whether
the yum package is installed to see if yum is installed on RHEL, and if so, what yum packages are there:
[root@localhost ~]# rpm -qa |grep yum
yum-metadata-parser-1.0-8.fc6
yum -3.0.1-5.el5
yum-rhn-plugin-0.4.3-1.el5
yum-updatesd-3.0.1-5.el5
2 Delete the yum package that comes with redhat
Uninstall all the yum packages shown above:
[root @localhost ~]# rpm -qa|grep yum|xargs rpm -e --nodeps (do not check dependencies, delete the rpm package directly) and
then use
[root@localhost ~]# rpm -qa |grep yum
[root@localhost ~] #
[root@localhost ~]# rpm -qa|grep python-urlgrabber|xargs rpm -e --nodeps (do not check dependencies, delete the rpm package directly) to
view, no information is displayed, indicating that the uninstallation has been completed
3. Download the new yum package. Use the yum package of Centos6.8
wget http://mirrors.163.com/centos/6.8/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm
wget http://mirrors.163.com/centos/6.8/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.163.com/centos/6.8/os/x86_64/Packages/yum-3.2.29-73.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6.8/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm

Install yum packages
Note : A single package may depend on other packages (e.g. yum and yum-fastestmirror depend on each other), so we can put all these packages together and install them at the same time with one command:
rpm - ivh yum-metadata-parser-1.1.2-16.el6.i686.rpm
rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm
rpm -ivh yum-plugin-fastestmirror-1.1.30-37 .el6.noarch.rpm yum-3.2.29-73.el6.centos.noarch.rpm
4. Replace the yum source. Use a source of 163

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


Edit the file and replace all $releasever in the file with the version number, that is, 6.8 Finally save it! Or copy the following memory directly to the CentOS6-Base-163.repo file (already modified)

# 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.5 - Base - 163.com
baseurl=http://mirrors.163.com/centos/6.5/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.5&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
 
#released updates
[updates]
name=CentOS-6.5 - Updates - 163.com
baseurl=http://mirrors.163.com/centos/6.5/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.5&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
 
#additional packages that may be useful
[extras]
name=CentOS-6.5 - Extras - 163.com
baseurl=http://mirrors.163.com/centos/6.5/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.5&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.5 - Plus - 163.com
baseurl = http: //mirrors.163.com/centos/6.5/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.5&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-6.5 - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/6.5/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.5&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6


5. Clear the original cache

# yum clean all
rebuild the cache to improve the speed of searching and installing software

# yum makecache
6. Update the system

# yum update

163 Address
http://mirrors.163.com/centos/6.8/os/x86_64/ Packages/

Guess you like

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