Kratos

A responsible theme for WordPress

Linux配置yum源为阿里yum源并设置DNS解析

配置DNS

1.HOST 本地DNS解析

vi /etc/hosts

添规则 例如:

223.231.234.33 www.baidu.com

2.网卡配置文件DNS服务地址 

vi /etc/sysconfig/network-scripts/ifcfg-eth0

添加规则 例如:

DSN1=’114.114.114.114′

3.系统默认DNS配置

vi /etc/resolv.conf

添加规则 例如:

nameserver 114.114.114.114或者8.8.8.8

系统解析的优先级 
1>2>3

配置阿里yum源

阿里云Linux安装镜像源地址:http://mirrors.aliyun.com/
CentOS系统更换软件安装源
第一步:备份你的原镜像文件,以免出错后可以恢复。
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
第二步:下载新的CentOS-Base.repo 到/etc/yum.repos.d/
curl -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
第三步:运行yum makecache生成缓存
yum clean all
yum makecache
点赞

发表评论

电子邮件地址不会被公开。 必填项已用*标注