文档首页> 帮助中心> centos更换yum源

centos更换yum源

发布时间:2024-08-16 21:16       

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

扫一扫访问手机版
30+ 高防云产品
1000+企业的共同选择