centos7 yum 配置
- 重置yum
- 更新 centos 镜像源
- http://mirrors.aliyun.com/centos/7Server/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
重置yum
# 备份
sudo cp /etc/yum.repos.d/* /etc/yum.repos.d.bak/
# 删除
rm -rf /etc/yum.repos.d/*
# 查看版本
lsb_release -d
cat /etc/redhat-release
根据版本寻找 http://mirror.centos.org/centos-7/7/os/x86_64/Packages/
rpm -Uvh --force http://mirror.centos.org/centos-7/7/os/x86_64/Packages/centos-release-7-4.1708.el7.centos.x86_64.rpm
更新 centos 镜像源
# 备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache
yum -y update
http://mirrors.aliyun.com/centos/7Server/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
在 https://mirrors.aliyun.com/centos/7/os/x86_64/repodata
也能看见 repomd.xml
查看镜像内容
vim /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
修改也无效
手动修改, 才解决
sed -i 's/\$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo