你的位置:首页 > 开源世界

CentOS 5的yum源更换为阿里云可用源

2014-08-08 浏览:(5539) 开源世界 评论(0)

最近在老的机器(CentOS 5)上使用yum的时候发现不能正常使用,打开相关源的地址之后发现很多源都已经抛弃了CentOS 5了,大家常用的如:

1、网易:http://mirrors.163.com/centos/

2、搜狐:http://mirrors.sohu.com/centos/

3、科技大学:http://mirrors.ustc.edu.cn/centos/

无一例外,全都不可使用了,于是前往阿里云的镜像源看看,发现阿里云的源还保留着,阿里云Linux安装镜像源地址:http://mirrors.aliyun.com/,这样就简单了,只需将系统的更新源替换为阿里云的即可。

CentOS系统更换软件安装源:

1、备份

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
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
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3、之后运行yum makecache生成缓存

yum clean all
yum makecache

如果你使用的是阿里云的服务器,将源的域名从mirrors.aliyun.com改为mirrors.aliyuncs.com,不占用公网流量。

#批量替换:
sed -i 's#mirrors.aliyun.com#mirrors.aliyuncs.com#' /etc/yum.repos.d/CentOS-Base.repo

  • 发表评论
  • 查看评论
【暂无评论!】

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。