Centos更换YUM源
centos系统更换源
1.备份原始yum源
cd /etc/yum.repos.d
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo
2.下载yum文件,替代原始yum源
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/CentoOS-6.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/CentOS-7.repo
CentOS 8
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/CentOS-8.repo
3.yum clean all 清除缓存
4.yum makecache 生成缓存
其它yum源下载地址:
腾讯源http://mirrors.cloud.tencent.com/repo/centos7_base.repo
网易源http://mirrors.163.com/.help/CentOS7-Base-163.repo
华为源https://repo.huaweicloud.com/repository/conf/CentOS-7-reg.repo
注意:安装时可能出现的错误
-bash: wget: command not found
解决办法:
# 执行如下命令
yum install -y wget