替换linux系统yum源

  • 来源:网络
  • 更新日期:2022-01-24

摘要:在下载yum文件慢的情况下,可以更换DNS或更换yum源1、备份系统旧配置文件mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup2、获取对应版本的

在下载yum文件慢的情况下,可以更换DNS或更换yum源

1、备份系统旧配置文件

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2、获取对应版本的CentOS-Base.repo 到/etc/yum.repos.d/目录替换之前先备份旧配置

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

centos各版本的源配置列表centos5

wget -O /etc/yum.repos.d/CentOS-Base.repohttp://mirrors.cloud.tencent.com/repo/centos5_base.repo

centos6

wget -O /etc/yum.repos.d/CentOS-Base.repohttp://mirrors.cloud.tencent.com/repo/centos6_base.repo

centos7(腾讯yum源)

wget -O /etc/yum.repos.d/CentOS-Base.repohttp://mirrors.cloud.tencent.com/repo/centos7_base.repo(阿里云yum源)wget -O /etc/yum.repos.d/CentOS-Base.repohttp://mirrors.aliyun.com/repo/Centos-7.repo

更新缓存

yum clean allyum makecache