Press "Enter" to skip to content

Linux服务器更换镜像源

linux 服务器更换镜像源

背景

新买的centos服务器无法下载软件,提示

Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - Could not resolve host: mirrorlist.centos.org

原因:是因为centos7在024年6月份停止维护,导致默认镜像不能使用,更改镜像即可

步骤如下:

  • step1:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
  • step2:
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
  • step3:
 yum clean all
  • step4:
yum makecache