切换Centos的yum源,切换为国内的阿里云源和网易163源

来源:互联网 发布:如何删除淘宝精选 编辑:程序博客网 时间:2024/06/05 00:48

将CentOS的系统的yum更换为网易和阿里云的yum软件安装源

第一步:备份你的原镜像文件,以免出错后可以恢复。

(使用mv命令,mv有两个作用一个是移动,一个是重命名,这里用到的是重命名的作用)

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

第二步:下载新的CentOS-Base.repo 到/etc/yum.repos.d/

要查看自己CentOS版本命令

[root@localhost ~]# lsb_release -a


开始下载   命令 wget -o 文件名 下载地址wget命令用于下载选项-o表示打印日志,可以看到进度文件名要求为绝对路径.阿里云  CentOS 5  wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo  CentOS 6  wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo网易163  CentOS 5  wget -O /etc/yum.repos.d/CentOS-163-Base.repo http://mirrors.163.com/.help/CentOS5-Base-163.repo  CentOS 6  wget -O /etc/yum.repos.d/CentOS-163-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo  CentOS 7wget -O /etc/yum.repos.d/CentOS-163-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo

更改CentOS-Media.repo使其为不生效(0表示不生效,1表示生效.不写这句话表示默认生效):

enabled=0

第三步:运行yum makecache生成缓存
yum clean allyum makecache

阅读全文
0 0