日期:2014-05-16  浏览次数:20730 次

linux安装yum

使用redhat6.0 系统在线安装时提示This system is not registered with RHN.如下:

[root@localhost ~]# yum install gcc
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
No package httpd available.
Nothing to do
解决方案:

1.卸载redhat自带的yum组件

[root@localhost ~]# rpm -qa|grep yum|xargs rpm -e --nodeps

2.安装centos的yum包

# wget http://mirror.centos.org/centos/6/os/i386/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

# wget http://mirror.centos.org/centos/6/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.i686.rpm

# wget http://mirror.centos.org/centos/6/os/i386/Packages/yum-3.2.29-30.el6.centos.noarch.rpm

# wget http://mirror.centos.org/centos/6/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

?

#rpm -ivh?python-iniparse-0.3.1-2.1.el6.noarch.rpm
#rpm -ivh?yum-metadata-parser-1.1.2-16.el6.i686.rpm
#rpm -ivh?yum-3.2.29-30.el6.centos.noarch.rpm?yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm??
注意最后两个包必需同时安装,否则会相互依赖?

?

3. 下载更新源,并存放在系统目录中
[root@localhost ~]# wget?http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo

[root@localhost ~]#mv CentOS_Base.repo /etc/yum.repos.d/CentOS-Base.repo

?

4.生成缓存并进行安装

[root@localhost ~]# yum makecache
至此可以使用yum了。

?

补充更改yum源方法:

?#我们使用网易的CentOS镜像源

# cd /etc/yum.repos.d/

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

# vi CentOS6-Base-163.repo

  编辑文件,把文件里面的$releasever全部替换为版本号,即6 最后保存!或者直接把下面的内存拷贝到CentOS6-Base-163.repo文件中即可(已经修改好)

#########################################################################