找到文件夹:
cd /etc/sysconfig/network-scripts/
然后找ifcfg 开头的文件,挨个打开
里面有下面那些代码前三行的就是,添加后面DNS两行,保持并退出,然后继续执行两个ifdown and ifup 命令,然后ping www.baodu.com正常的话就没问题可以更新yum了。
ONBOOT=noNM_CONTROLLED=noBOOTPROTO=dhcpDNS1=8.8.8.8DNS2=4.2.2.2
重启网络
service network restart
超简单将Centos的yum源更换为国内的阿里云源
1、备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/
CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3、之后运行yum makecache生成缓存
CentOS7 cannot find a valid baseurl for repo base
原文地址:https://www.cnblogs.com/freebird92/p/9920676.html