CentoOS更换yum源
2016-12-11 21:40
281 查看
由于国内Great FireWall 的原因以及RedHat版本的Yum是收费的等原因,需要将包管理工具Yum的源换成别的镜像
本文用的是阿里云的源
切换到yum目录
把gpgcheck=1改成gpgcheck=0(关闭某种检查)
修改$releasever相对路径为绝对路径(即为版本号)
下面是我已经修改好的
本文用的是阿里云的源
切换到yum目录
[root@cloud ~]# cd /etc/yum.repos.d备份redhat的yum配置文件
[root@cloud yum.repos.d]# cp rhel-source.repo rhel-source.repo.bak下载阿里云的配置文件
[root@cloud yum.repos.d]# wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo改名
[root@cloud yum.repos.d]# mv CentOS-Base.repo rhel-source.repo //使用Vim修改配置文件 [root@cloud yum.repos.d]# vim rhel-source.repo配置文件打开后有两点需要修改
把gpgcheck=1改成gpgcheck=0(关闭某种检查)
修改$releasever相对路径为绝对路径(即为版本号)
下面是我已经修改好的
# CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$releasever - Base - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/6/os/$basearch/ http://mirrors.aliyuncs.com/centos/6/os/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os gpgcheck=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6 #released updates [updates] name=CentOS-$releasever - Updates - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/6/updates/$basearch/ http://mirrors.aliyuncs.com/centos/6/updates/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates gpgcheck=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/6/extras/$basearch/ http://mirrors.aliyuncs.com/centos/6/extras/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras gpgcheck=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus - mirrors.aliyun.com ........//就不全部贴出来了(太长=_=!)改好后清理yum缓存
[root@cloud yum.repos.d]# yum clean all清理完后重新建立缓存
[root@cloud yum.repos.d]# yum makecache更新yum
[root@cloud yum.repos.d]# yum -y update好的,到此更换yum源完成了。
相关文章推荐
- [SSH]如何敲一条线
- 走进阿里,从提高自身开始
- 【工具】让开发更高效-Firefox Developer Edition
- 《Android群英传》---读书笔记5
- 高性能Mysql主从架构的复制原理及配置详解
- 用HTML中的列表标签做一个导航栏吧
- NG《Machine_Learning_Yearning》笔记
- [RegEx]识别路径中是否有本地盘符
- 漫漫考研路之C语言的位运算
- 124. Binary Tree Maximum Path Sum
- Java安装与编程
- 2016年12月9日 课堂笔记
- 互联网服务线上数据迁移的原则和方法
- replace和replaceAll的区别:
- 巧用Snackbar代替Toast
- Graphics中的方法
- 3398 数据结构实验之排序一:一趟快排
- 计算机网络第一章
- Object.assign()方法
- 20145318 《信息安全系统设计基础》第13周学习总结