【Centos6.x 停更后如何替换YUM源】

YUM源更新脚本内容如下:

说明:脚本中的"官方Vault源"和"阿里云Vault镜像"二选一即可
#!/bin/bash
export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"
sed -i '/enabled/{s/1/0/}' /etc/yum/pluginconf.d/fastestmirror.conf
mv  /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak20201207
#替换为官方Vault源
#wget -O /etc/yum.repos.d/CentOS-Base.repo https://static.lty.fun/%E5%85%B6%E4%BB%96%E8%B5%84%E6%BA%90/SourcesList/Centos-6-Vault-Official.repo
#替换为阿里云Vault镜像
wget -O /etc/yum.repos.d/CentOS-Base.repo https://static.lty.fun/%E5%85%B6%E4%BB%96%E8%B5%84%E6%BA%90/SourcesList/Centos-6-Vault-Aliyun.repo
if [ "$?" -eq 0 ];then
    echo "更新成功!!!"
    exit 0
else
    echo "更新失败!!!"
    exit 1
fi

你可能感兴趣的:(shell,yum,centos,linux,运维)