CentOS 修改yum源为国内源(阿里)

如下Centos 6.8修改到阿里云:
阿里云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
http://mirrors.163.com/.help/centos.html

你可能感兴趣的:(Linux笔记)