> CentOS > CentOS入门 >

RHEL6.6搭建CentOS6.6 yum源

现需要在RHEL6.6上安装zabbix2.4,通过虚拟机桥接互联网yum方式安装,但yum –y installnet-snmp zabbix zabbix-server的时候报如下错误,导致安装不上:

这个错误是由于没有注册引起的,怎么办呢?网上也查了一些资料,按照网上的资料,现将为自己的环境整理搭建了一下CentOS6.6 yum源!

 

  1. 把原来的yum源卸载掉

# rpm -qa | grep yum | xargs rpm -e –nodeps

 

  1. 添加并安装下载的yum的rpm包

# rpm -ivhpython-iniparse-0.3.1-2.1.el6.noarch.rpm

# rpm -ivhyum-metadata-parser-1.1.2-16.el6.x86_64.rpm

# rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpmyum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

[注]:最后这两个包必须同时安装,因两个是相互依赖关系。

 

  1. 添加163的yum源

# cd/etc/yum.repos.d/

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

 

 

  1. 修改CentOS6-Base-163.repo

#CentOS-Base.repo

#

# The mirrorsystem uses the connecting IP address of the client and the

# update statusof each mirror to pick mirrors that are updated to and

# geographicallyclose to the client.  You should use thisfor CentOS updates

# unless you aremanually picking other mirrors.

#

# If the mirrorlist=does not work for you, as a fall back you can try the

# remarked outbaseurl= line instead.

#

#

 

[base]

name=CentOS-6 - Base- 163.com

baseurl=http://mirrors.163.com/centos/6/os/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

 

#releasedupdates

[updates]

name=CentOS-6 -Updates - 163.com

baseurl=http://mirrors.163.com/centos/6/updates/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

 

#additionalpackages that may be useful

[extras]

name=CentOS-6 -Extras - 163.com

baseurl=http://mirrors.163.com/centos/6/extras/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

 

#additionalpackages that extend functionality of existing packages

[centosplus]

name=CentOS-6 - Plus- 163.com

baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/

#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/$basearch/

#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

~

~

~

~

~

~

~

~

~

~

~

  1. # yum clean all    //清理yum缓存

  2. # yum makecache    //将服务器上的软件包信息缓存到本地,以提高搜索安装软件的速度

  3. # yum install vim*  //测试yum是否可用

 

    至此,搭建CentOS6.6的yum源已成功。

(责任编辑:IT)