1. Backup

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2. Download Alibaba Cloud's CentOS-Base.repo to /etc/yum.repos.d/

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo

3. Adjust the configuration file

#Replacement version, $releasever replaces 6.8, 6.8 is the version I use
sed -i's/$releasever/6.8/g' /etc/yum.repos.d/CentOS-Base.repo
#Replace centos with centos-vault
sed -i's/centos/centos-vault/g' /etc/yum.repos.d/CentOS-Base.repo

4. Non-Alibaba Cloud server configuration

sed -i -e'/mirrors.cloud.aliyuncs.com/d' -e'/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
sed -i's/http/https/g' /etc/yum.repos.d/CentOS-Base.repo

5. Generate cache

yum makecache
Likes(2)

Comment list count 0 Comments

No Comments

WeChat Self-Service

WeChat Consult

TaoBao

support@elephdev.com

发表
评论
Go
Top