CentOS7 修改DNS,CentOS-Base.repo原生源

前些日子买了企鹅的香港云服务,作为此博客的架设和SS之用,但是蛋疼的TX为了GFW设置了内地的DNS地址,导致Google等域名无法解析。

于是修改先修改DNS

995FF0F3-AD4A-4C86-80BC-AD63D243EE01

1
2
3
nmcli connection show System\ eth0
nmcli connection modify System\ eth0 ipv4.dns "8.8.4.4 8.8.8.8"
nmcli connection up System\ eth0

修改完,yum update一下,咦?

7455F9B7-A409-49D8-B17C-451780CD0659

大意就是无法解析mirrors.tencentyun.com,经查证是个内网源。 8-O

那么,就要修改yum源为CentOS自带的,163也可以但是由于在HK并且个人特殊的JP,所以用原生的。

这里提供个原生的CentOS-Base.repo吧,每次找也麻烦。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# 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-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

编辑/etc/yum.repos.d/CentOS-Base.repo,写入,完工