|
|
|
1. 备份mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backupCopy2. 下载阿里云的 CentOS-Base.repo 到 /etc/yum.repos.d/阿里开源镜像站:https://developer.aliyun.com/mirror/wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repoCopy3. 调整配置文件#替换版本,$releasever替换6.8, 6.8是我用的版本sed -i 's/$releasever/6.8/g' /etc/yum.repos.d/CentOS-Base.repo#替换centos为centos-vaultsed -i 's/centos/centos-vault/g' /etc/yum.repos.d/CentOS-Base.repoCopy4. 非阿里云服务器配置sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.reposed -i 's/http/https/g' /etc/yum.repos.d/CentOS-Base.repoCopy5. 生成缓存yum makecache |
|