您的当前位置:首页 --> CentOS入门
centos修改yum源
浏览次数:1818 关键词 ( centos  yum  )

学习linux的时候,没有光盘,想安装软件,只能更改网上的yum源来安装了。

这里提供一个网易的yum源。

1、到http://mirrors.163.com的 centos帮助文档中下载CentOS6-Base-163.repo文件,存放到/etc/yum.repo.d中。

Centos 6 : wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

Centos 5 : wget http://mirrors.163.com/.help/CentOS5-Base-163.repo

将下载的文件复制到/etc/yum.repos.d目录下。

2、首先备份/etc/yum.repos.d/CentOS-Base-163.repo

 cp CentOS6-Base-163.repo CentOS6-Base-163.repo.bak 

3、编辑CentOS6-Base-163.repo文件,将其中的$releasever更改为centos的版本号,这里以redhat6.0 32位版本为例。

[root@Node2 yum.repos.d]# vi CentOS6-Base-163.repo
# 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-6 - Base - 163.com
baseurl=http://mirrors.163.com/centos/6/os/i386/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-6 - Updates - 163.com
baseurl=http://mirrors.163.com/centos/6/updates/i386/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-6 - Extras - 163.com
baseurl=http://mirrors.163.com/centos/6/extras/i386/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/6/centosplus/i386/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-6 - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/6/contrib/i386/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

4、编辑完后保存,检验是否更新成功:

yum clean all 清除原有缓存
yum makecache 获取yum列表
yum install vim*
下载次数:7
下载地址:点击下载
本资源为程序自动采集,如有侵权请联系我们移除 admin#80vps.com 来信请将#替换为@
下一条 centos系统中网络配置相关
上一条 CentOS设置程序开机自启动的方法

拥有超过10年的业务管理经验。我们是IDC服务和解决方案方面的专家

有任何疑问请不要犹豫,立即点击联系我们