1、清理现有源
(1)方式一、删除现有源
rm -rf /etc/yum.repos.d/*.repo
(2)方式二、备份现有源
for file in *.repo; do
if [ "$file" != "local.repo" ]; then
mv "$file" "$file.bak"
fi
done
2、替换为归档源
cat > /etc/yum.repos.d/CentOS-Base.repo << EOF
[base]
name=CentOS-7 – Base – Archive
baseurl=http://archive.kernel.org/centos-vault/7.9.2009/os/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1
[updates]
name=CentOS-7 – Updates – Archive
baseurl=http://archive.kernel.org/centos-vault/7.9.2009/updates/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1
[extras]
name=CentOS-7 – Extras – Archive
baseurl=http://archive.kernel.org/centos-vault/7.9.2009/extras/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1
EOF
3、重建缓存
yum clean all
yum makecache
网硕互联帮助中心




评论前必须登录!
注册