RHEL7 configure 163yum source

Posted by mistjulia on Sat, 04 Jan 2020 21:08:17 +0100

1. Enter / etc/yum/repos.d / directory (where the configuration files of yum software warehouse are stored)

[root@localhost ~]# cd /etc/yum.repos.d/

2. Delete the original yum source

[root@localhost yum.repos.d]# rm -f *

3. Use vim editor to create a new configuration file (the file name is optional, but the suffix must be. repo)

[root@localhost yum.repos.d]# vim mirrors.163.com.repo

configuration parameter

[mirrors.163.com]
name=mirrors.163.com
baseurl=http://mirrors.163.com/centos/7/os/x86_64/
enabled=1
gpgcheck=0

4. Check whether the configuration is correct

[root@localhost yum.repos.d]# yum repolist

Correct effect:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
mirrors.163.com.repo                                          | 3.6 kB  00:00:00     
(1/2): mirrors.163.com.repo/group_gz                          | 166 kB  00:00:05     
(2/2): mirrors.163.com.repo/primary_db                        | 5.9 MB  00:00:09     
repo id                                repo name                               status
mirrors.163.com.repo                   mirrors.163.com.repo                    9,911
repolist: 9,911

5. Update Yum cache

[root@localhost yum.repos.d]#  yum list

================================================================

ps: DNS resolution needs to be configured if the following error occurs

Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
http://mirrors.163.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.163.com; Unknown error"
Trying other mirror.
http://mirrors.163.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.163.com; Unknown error"
Trying other mirror.
repo id                              repo name                            status
mirrors.163.com                      mirrors.163.com                      0
repolist: 0

resolvent:

1. Check whether there is DNS configuration

[root@localhost Desktop]# cat /etc/resolv.conf

2. Add DNS configuration

[root@localhost Desktop]# vim /etc/resolv.conf

Configuration content:

nameserver 114.114.114.114
nameserver 8.8.8.8

3. Restart network service

[root@localhost Desktop]# systemctl restart network

 

Topics: yum vim CentOS DNS