CentOS can not access foreign mirroring solutions when operating yum

1. For example execution yum update, often error "Cound not resolve host: xxxxx", generally use yum source is mirrored abroad, the domestic access is very bad. Then you can replace the manual source for domestic Tsinghua source, or sources, Ali cloud like.

Detailed usage can refer https://mirrors.tuna.tsinghua.edu.cn/help/centos/ , mirror sites use to help choose their own version.

Posted CentOS 7 under the following version, Tsinghua source configuration

 1 # CentOS-Base.repo
 2 #
 3 # The mirror system uses the connecting IP address of the client and the
 4 # update status of each mirror to pick mirrors that are updated to and
 5 # geographically close to the client.  You should use this for CentOS updates
 6 # unless you are manually picking other mirrors.
 7 #
 8 # If the mirrorlist= does not work for you, as a fall back you can try the
 9 # remarked out baseurl= line instead.
10 #
11 #
12 
13 [base]
14 name=CentOS-$releasever - Base
15 baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
16 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
17 gpgcheck=1
18 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
19 
20 #released updates
21 [updates]
22 name=CentOS-$releasever - Updates
23 baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/
24 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
25 gpgcheck=1
26 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
27 
28 #additional packages that may be useful
29 [extras]
30 name=CentOS-$releasever - Extras
31 baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/
32 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
33 gpgcheck=1
34 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
35 
36 #additional packages that extend functionality of existing packages
37 [centosplus]
38 name=CentOS-$releasever - Plus
39 baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/
40 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
41 gpgcheck=1
42 enabled=0
43 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

 

PS If you feel inconvenient to use the command line, you can directly edit files on even after SFTP.

/Etc/yum.repos.d/elrepo.repo file may be used to upgrade the kernel 2. In addition, it is also possible to modify the source Tsinghua University.

Also posted elrepo.repo source configuration Tsinghua University

### Name: 清华大学开源镜像
### URL: https://mirrors.tuna.tsinghua.edu.cn/elrepo/

[elrepo]
name=ELRepo.org Community Enterprise Linux Repository - el7
baseurl=https://mirrors.tuna.tsinghua.edu.cn/elrepo/elrepo/el7/$basearch/
#mirrorlist=http://mirrors.elrepo.org/mirrors-elrepo.el7
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
protect=0

[elrepo-testing]
name=ELRepo.org Community Enterprise Linux Testing Repository - el7
baseurl=https://mirrors.tuna.tsinghua.edu.cn/elrepo/testing/el7/$basearch/
#mirrorlist=http://mirrors.elrepo.org/mirrors-elrepo-testing.el7
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
protect=0

[elrepo-kernel]
name=ELRepo.org Community Enterprise Linux Kernel Repository - el7
baseurl=https://mirrors.tuna.tsinghua.edu.cn/elrepo/kernel/el7/$basearch/
#mirrorlist=http://mirrors.elrepo.org/mirrors-elrepo-kernel.el7
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
protect=0

[elrepo-extras]
name=ELRepo.org Community Enterprise Linux Extras Repository - el7
baseurl=https://mirrors.tuna.tsinghua.edu.cn/elrepo/extras/el7/$basearch/
#mirrorlist=http://mirrors.elrepo.org/mirrors-elrepo-extras.el7
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
protect=0

 

Guess you like

Origin www.cnblogs.com/zhoushiya/p/12240247.html