修改CentOS默認yum源
有時候CentOS默認的yum源不一定是國內鏡像,導致yum在線安裝及更新速度不是很理想。需要將yum源設置為國內鏡像站點。
騰訊源
1.備份系統舊配置文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2、進入yum源配置文件所在的文件夾
[root@linux ~]# cd /etc/yum.repos.d/
3、下載mirrors.cloud.tencent.com的yum源配置文件到上面那個文件夾內
CentOS5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos5_base.repo
CentOS6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos6_base.repo
CentOS7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo
CentOS8
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos8_base.repo
更新緩存
yum clean all
yum makecache
yum -y update
阿里源
1.備份系統舊配置文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2、進入yum源配置文件所在的文件夾
[root@linux ~]# cd /etc/yum.repos.d/
3、下載mirrors.aliyun.com的yum源配置文件到上面那個文件夾內
CentOS5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
CentOS8
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
更新緩存
yum clean all
yum makecache
yum -y update