Centos更改镜像源

时间:2023-12-18 11:41:20

阿里云Linux安装镜像源:

1.备份原镜像文件以便于恢复。

[root@localhost ~]#mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2.下载新的CentOS-Base.repo 到/etc/yum.repos.d/

CentOS 5

[root@localhost ~]#wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

CentOS 6

[root@localhost ~]#wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

3.运行yum makecache生成缓存

[root@localhost ~]#yum makecache

163安装软件镜像源:

1.备份你的原镜像文件,以免出错后可以恢复。

[root@localhost ~]#mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2.下载新的CentOS-Base.repo 到/etc/yum.repos.d/

CentOS 5

[root@localhost ~]#wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS5-Base-163.repo

CentOS 6

[root@localhost ~]#wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo

3.运行以下命令生成缓存

[root@localhost ~]#yum clean all

[root@localhost ~]#yum makecache