本文為轉(zhuǎn)帖,原創(chuàng):singular港
1式曲、安裝wget下載工具
yum install wget -y
2拌喉、進(jìn)入yum源配置文件
//進(jìn)入yum配置文件夾
cd /etc/yum.repos.d
//備份之前的配置文件
mv CentOS-Base.repo CentOS-Base.repo.bak
3场钉、下載國(guó)內(nèi)鏡像源
//網(wǎng)易163源
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
//阿里源
wget http://mirrors.aliyun.com/repo/Centos-7.repo
4来吩、設(shè)置需要的鏡像源為默認(rèn)源
//修改指定的yum源為默認(rèn)yum源
mv /etc/yum.repos.d/Centos-7.repo /etc/yum.repos.d/CentOS-Base.repo
5敢辩、清空之前緩存生成新的緩存
//清空緩存
yum clean all
//生成新的緩存
yum makecache
6、手動(dòng)添加配置文件
6.1弟疆、阿里云服務(wù)器配置文件
[base]
name=CentOS-$releasever
enabled=1
failovermethod=priority
baseurl=http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.cloud.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-7
[updates]
name=CentOS-$releasever
enabled=1
failovermethod=priority
baseurl=http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.cloud.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-7
[extras]
name=CentOS-$releasever
enabled=1
failovermethod=priority
baseurl=http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.cloud.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-7
6.2戚长、騰訊云服務(wù)器配置文件
[extras]
gpgcheck=1
gpgkey=http://mirrors.tencentyun.com/centos/RPM-GPG-KEY-CentOS-7
enabled=1
baseurl=http://mirrors.tencentyun.com/centos/$releasever/extras/$basearch/
name=Qcloud centos extras - $basearch
[os]
gpgcheck=1
gpgkey=http://mirrors.tencentyun.com/centos/RPM-GPG-KEY-CentOS-7
enabled=1
baseurl=http://mirrors.tencentyun.com/centos/$releasever/os/$basearch/
name=Qcloud centos os - $basearch
[updates]
gpgcheck=1
gpgkey=http://mirrors.tencentyun.com/centos/RPM-GPG-KEY-CentOS-7
enabled=1
baseurl=http://mirrors.tencentyun.com/centos/$releasever/updates/$basearch/
name=Qcloud centos updates - $basearch
————————————————
版權(quán)聲明:本文為CSDN博主「singular港」的原創(chuàng)文章,遵循 CC 4.0 BY-SA 版權(quán)協(xié)議怠苔,轉(zhuǎn)載請(qǐng)附上原文出處鏈接及本聲明同廉。
原文鏈接:https://blog.csdn.net/qq_38264999/article/details/102418686