Centos7 换华为源

Talk is cheap, show me the code:

cd /etc/yum.repos.d
[ -f CentOS-Base.repo.bak ] || cp CentOS-Base.repo CentOS-Base.repo.bak
export MIRROR="http://repo.huaweicloud.com"
curl -o CentOS-Base.repo $MIRROR/repository/conf/CentOS-7-reg.repo
yum update -y
yum install -y epel-release
mv epel-testing.repo epel-testing.repo.bak
[ -f epel.repo.bak ] || cp epel.repo epel.repo.bak
sed -i "s/#baseurl/baseurl/g" /etc/yum.repos.d/epel.repo
sed -i "s/metalink/#metalink/g" /etc/yum.repos.d/epel.repo
sed -i "s@https\?://download.[a-z]*\.\?[a-z]*/pub@$MIRROR@g" /etc/yum.repos.d/epel.repo

See more at:
https://mirrors.huaweicloud.com/home

posted @ 2023-08-16 15:41  waketzheng  阅读(337)  评论(0编辑  收藏  举报