Redhat's modified mirror source

Be sure to connect your redhat to the network before starting

1.su enter the password to enter the administrator

2. View your own yum source

rpm -qa | grep yum

3. Delete the official yum source that comes with the system all at once

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

4. Create a folder

mkdir YHW   (YHW是我的文件名)

5.ls to check, cd YHW to enter the folder

6. Download the domestic Yum source

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm 
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-54.el7_8.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-10.el7.noarch.rpm

7. Install Yum source

rpm -ivh yum-3.4.3-168.el7.centos.noarch.rpm --force --nodeps
rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm --force --nodeps
rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm --force --nodeps
rpm -ivh yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm --force --nodeps
rpm -ivh yum-utils-1.1.31-54.el7_8.noarch.rpm --force --nodeps
rpm -ivh python-urlgrabber-3.10-10.el7.noarch.rpm --force --nodeps

8. Check if the Yum source is installed

rpm -qa | grep yum

9. After installation, enter the following:

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

10. The file CentOs-Base.repo will appear under the /etc/yum.repos.d directory. Double-click to enter and click Search and Replace Versions

 Input: $releasever Click to find

 These are to be replaced in the replacement to enter 7, and then replace all

 It cannot be saved directly after replacement, so enter in the terminal

gedit /etc/yum.repos.d/CentOs-Base.repo

 

 will jump out

 Copy all the content of Yum that you just replaced into the text that jumped out above, and then you can save it. At this time, two files will appear under the yum.repos.d folder

 Since the permission of the file is read-only, it cannot be deleted directly

 So you need to delete the file in the terminal

cd /etc # enter the folder

cd yum.repos.d

rm -f CentOS-Base.repo #delete file

At this point there was only one left. Open to view is modified successfully

 10. Test

 yum makecache

 

 yum update

 Although the prompt will still pop up, the update operation will be performed immediately afterwards, which means that we have successfully bypassed the official mirror to download things!

Guess you like

Origin blog.csdn.net/qq_68890680/article/details/130757288