DNS配置

  1. 通过 ifconfig 或 nmcli connection show 命令确定当前使用的网卡名称(如:eth0、eno1 等,以下均以 eno1 为例进行设置)
  2. 通过命令 nmcli con mod eno1 ipv4.dns “114.114.114.114 8.8.8.8” 修改对应网卡的 dns 设置
  3. systemctl restart NetworkManager.service
  4. cat /etc/resolv.conf 查看dns

修改hosts

  1. vim /etc/hosts
  2. 8.132.50.96 mirrors.aliyun.com
  3. nmcli c reload

更换yum源

1
2
3
4
5
6
7
8
# 备份
cp -rv /etc/yum.repos.d /etc/yum.repos.d_bak

# 下载国内yum源文件
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

# 生成缓存
yum clean all && yum makecache

防火墙

1
2
systemctl status firewalld
systemctl start firewalld