CentOS7 yum安装报错“Could not resolve host: mirrorlist.centos.org; Name or service not known“之解决办法(换源)
CentOS7 yum安装报错“Could not resolve host: mirrorlist.centos.org; Name or service not known“之解决办法(换源)
一、键更换脚本
一、国内源
1
bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh)
推荐使用一
国内
1
bash <(curl -sSL https://linuxmirrors.cn/main.sh)
国内教育网
1
bash <(curl -sSL https://linuxmirrors.cn/main.sh) --edu
海外地区
1
bash <(curl -sSL https://linuxmirrors.cn/main.sh) --abroad
二、手动更换
CentOS7更换镜像源
1、先安装wget
1
yum install -y wget
2、打开阿里镜像
3、下载CentOS 7的对应的repo文件
1
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
或者
1
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
4、更新镜像源
1
yum clean all
1
yum makecache
1
yum -y update
执行完上面三行命令就好了
本文由作者按照 CC BY 4.0 进行授权