当你高高兴兴的安装了centos后执行yum update -y 这时候发现出现这一大串 mirrors.tuna.tsinghua.edu.cn/epel/7/x86_…: [Errno 14] HTTPS Error 404 - Not Found Trying other mirror. 人傻了。 这时候只需要执行换源的操作即可
-
备份当前的 repo 文件:
sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak sudo cp /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.bak -
下载阿里云的 CentOS 7 和 EPEL 镜像源:
- 阿里云 CentOS 7 镜像配置文件:
sudo curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
- 阿里云 EPEL 镜像配置文件:
sudo curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
- 清除
yum缓存:
有时旧的缓存会导致问题。你可以尝试清除缓存并重新生成缓存。
```
sudo yum clean all
sudo yum makecache
```
4. 确认镜像源是否正常:
重新尝试 yum 命令,检查是否能够正常访问阿里云的镜像源:
sudo yum update -y
如果此时不再出现错误,说明源配置已经正常。