centos7停止维护后更换CentOS Vault源


bash -c "$(curl -fsSL https://mirror.moack.co.kr/.resource/centos7-change-vault.sh)"

 

#!/bin/bash

NEW_REPO_URL="https://mirror.moack.co.kr/.resource/CentOS-Base-7-Vault.repo"
ORIGINAL_REPO_PATH="/etc/yum.repos.d/CentOS-Base.repo"

if [ "$(id -u)" != "0" ]; then
   echo "此脚本必须以root用户身份运行" 1>&2
   exit 1
fi

echo "正在备份原有的 CentOS-Base.repo 文件..."
cp $ORIGINAL_REPO_PATH "${ORIGINAL_REPO_PATH}.bak"

echo "正在下载新的 CentOS-Base-7-Vault.repo 文件..."
curl -o $ORIGINAL_REPO_PATH $NEW_REPO_URL

echo "清除yum缓存并重新生成..."
yum clean all
yum makecache
echo "已成功替换为 CentOS Vault 仓库源。"



最新回复 (0)
    • 记录·WiKi
      2
        立即登录 立即注册 
返回
文章系网友原创或转载,目的在于传递更多信息,并不代表本站赞同其观点和对其真实性负责。如有侵权行为,请联系我们admin(a)jilu.wiki,我们会及时删除。