yum源

为各版本linux添加yum源

这里我就以Centos 6.5 来做演示 首先先百度下对应版本的yun源

国内比较好的yum源主要是阿里云、163以及搜狐的,更新yum的命令如下:

//更新为阿里云的源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

//更新为163的源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo

//更新为搜狐的源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.sohu.com/help/CentOS-Base-sohu.repo

1.进入yum源配置目录

 cd /etc/yum.repos.d

2.做什么改动前最后都做个备份 以防出错 还能恢复

mv CentOS-Base.repo CentOS-Base.repo.bak

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

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

4.运行yum makecache生成缓存

yum clean all
yum makecache
原文地址:https://www.cnblogs.com/renyuanwei/p/10109783.html