Redhalt配置Centos的yum源 详细步骤

前端之家收集整理的这篇文章主要介绍了Redhalt配置Centos的yum源 详细步骤前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

大家都应该都清楚,redhalt 刚装完系统之后的yum是不好使的,有时我们像安装vsftp 这样的软件时用yum安装很方便。为此我们需要利用centos的yum源进行配置。现在这个源更新速度很快。这是网易的资源总库http://mirror.centos.org/。里面应有尽有。废话不多说:

具体安装步骤:

1、删除redhat原有的yum源

# rpm -aq | grep yum|xargs rpm -e �Cnodeps


2、重新从网上获取yum的安装包

以root登陆到redhalt系统,默认目录已经切换到 /root,通过wget命令下载相应的yum包。

具体命令如下:

#wgethttp://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm


#wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-73.el6.centos.noarch.rpm

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm

这样四个需要安装的包全部就下载下来了,接下来就是需要安装了。

3.安装软件包

# rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm

# rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

# rpm -ivhyum-3.2.29-73.el6.centos.noarch.rpmyum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm

注意:后面两个需要一起安装才行。因为具有软件依赖关系。当时我安装最后两个包时出现了一个错误,如下:

[root@localhost ~]# rpm -ivh yum-3.2.29-73.el6.centos.noarch.rpmyum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm

warning:yum-3.2.29-73.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature,key IDc105b9de: NOKEY

error: Failed dependencies:

python-urlgrabber >= 3.9.1-10 is needed byyum-3.2.29-73.el6.centos.noarch

还是软件依赖的问题,需要安装大于3.9.1-10版本的python-urlgrabber

于是又去下了一个大于3.9.1-10版本的python-urlgrabber的rpm包。

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/ python-urlgrabber-3.9.1-11.el6.noarch.rpm

继续先安装python-urlgrabber-3.9.1-11.el6.noarch.rpm 包;


# rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm

安装完成后继续重复刚才最后一个步骤:

# rpm -ivhyum-3.2.29-73.el6.centos.noarch.rpmyum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm

终于好使了。


4、更改yum源,使用网易的镜像站。

切换目录到 /etc/yum.repos.d/目录下

# cd /etc/yum.repos.d/

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

# vim CentOS6-Base-163.repo

编辑CentOS6-Base-163.repo文件,把文件里面的$releasever全部替换为版本号,这个地方是版本6 ,最后保存退出。如下:

# 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/$basearch/----这里一定要是网易库的路径名

#mirrorlist=http://mirrorlist.centos.org/?release=6&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/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=6&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/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=6&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/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=6&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=6&arch=$basearch&repo=contrib

gpgcheck=1

enabled=0

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

改完之后退出编辑保存退出

5.测试是否安装好

# yum clean all #清理yum缓存

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

你会看到缓存过程,说明已经安装好了。

# yum list yum#测试配置的yum源是否已经生效。

下面就可以用yum安装一系列软件了。

猜你在找的CentOS相关文章