Method of replacing software update source for RHEL system

Time:2020-10-18

RHEL5. X replace update source

Copy code

The code is as follows:

cd /etc/yum.repos.d
wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo
mv CentOS-Base.repo rhel-debuginfo.repo
rpm –import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

Rhel6.1 replacement update source
1. Remove yum

Copy code

The code is as follows:

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

2. Download yum

Copy code

The code is as follows:

wget http://mirrors.163.com/centos/6.2/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget http://mirrors.163.com/centos/6.2/os/x86_64/Packages/yum-3.2.29-22.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6.2/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.163.com/centos/6.2/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-10.el6.noarch.rpm

3. Install yum

Copy code

The code is as follows:

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

4. Update repo file and use Netease file
Switch the directory to / etc/ yum.repos . D / directory

Copy code

The code is as follows:

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

Edit the file, replace all the $releaser in the file with the version number, that is 6, and save it finally! Or directly copy the following memory to centos6-base-163.repo file.

Copy code

The code is as follows:

# 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.
#
#
Copy code

The code is as follows:

[base]
name=CentOS-6 – Base – 163.com
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
Copy code

The code is as follows:

#released updates
[updates]
name=CentOS-6 – Updates – 163.com
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
Copy code

The code is as follows:

#additional packages that may be useful
[extras]
name=CentOS-6 – Extras – 163.com
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
Copy code

The code is as follows:

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6 – Plus – 163.com
baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
Copy code

The code is as follows:

#contrib – packages by Centos Users
[contrib]
name=CentOS-6 – Contrib – 163.com
baseurl=http://mirrors.163.com/centos/6/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

5. The last step

Copy code

The code is as follows:

Yum clean all ා clean Yum cache
Yum makecache ා caches the software package information on the server locally to improve the speed of searching and installing software.
Yum list Yum ා test whether the configured Yum source is in effect.