将redhat的yum换成centos的yum

1.卸载redhat自带的yum组件

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

2.查看系统版本

[root@localhost ~]# lsb_release -a

显示为:Red Hat Enterprise Linux Server release 6.1 于是找对应的CentOS6.1 但是在http://mirrors.ustc.edu.cn/centos/6.0/readme看到

 

This directory (and version of CentOS) is depreciated. For normal users, you should use /6/ and not /6.0/ in your path. Please see this FAQ concerning the CentOS release scheme: http://www.centos.org/modules/smartfaq/faq.php?faqid=34 If you know what you are doing, and absolutely want to remain at the 6.0 level, go to http://vault.centos.org/ for packages. Please keep in mind that 6.0 no longer gets any updateds

所以选择6版本

3.安装centos的yum包(64位对应于64位安装包)

wgethttp://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

wgethttp://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-3.2.27-14.el6.centos.noarch.rpm

wgethttp://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm


wgethttp://mirrors.ustc.edu.cn/centos/6/os/x86_64/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-14.1.el6.x86_64.rpm
rpm -ivh yum-3.2.27-14.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm
注意最后两个包必需同时安装,否则会相互依赖,我在这里纠结了很久

 

Centos 6 yum配置

vi/etc/yum.repos.d/CentOS-Base.repo

#mv /etc/yum.repos.d/CentOS-Base.repo/etc/yum.repos.d/CentOS-Base.repo.bak

 

然后把/etc/yum.repos.d/CentOS-Base.repo文件改为

 

# CentOS-Base.repo

#

# This file uses a new mirrorlist system developed by Lance Davis for CentOS.

# 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

baseurl=http://mirrors.ustc.edu.cn/centos/6/os/$basearch/

gpgcheck=1

gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6

 

#released updates

[updates]

name=CentOS-$releasever - Updates

baseurl=http://mirrors.ustc.edu.cn/centos/6/updates/$basearch/

gpgcheck=1

gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6

 

#packages used/produced in the build but not released

#[addons]

#name=CentOS-$releasever - Addons

#baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/addons/$basearch/

#gpgcheck=1

#gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful

[extras]

name=CentOS-$releasever - Extras

baseurl=http://mirrors.ustc.edu.cn/centos/6/extras/$basearch/

gpgcheck=1

gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-$releasever - Plus

baseurl=http://mirrors.ustc.edu.cn/centos/6/centosplus/$basearch/

gpgcheck=1

enabled=0

gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6

 

更改一下源的路径就行了。现在可以更新Centos 6了。

下面是搜狐的:

# CentOS-Base.repo

#

# This file uses a new mirrorlist system developed by Lance Davis for CentOS.

# 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

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

gpgcheck=1

gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-6

 

#released updates

[updates]

name=CentOS-$releasever - Updates

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

gpgcheck=1

gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-6

 

#packages used/produced in the build but not released

#[addons]

#name=CentOS-$releasever - Addons

#baseurl=http://mirrors.sohu.com/centos/$releasever/addons/$basearch/

#gpgcheck=1

#gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful

[extras]

name=CentOS-$releasever - Extras

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

gpgcheck=1

gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-$releasever - Plus

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

gpgcheck=1

enabled=0

gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-6

下面是网易163的源:

# CentOS-Base.repo

#

# This file uses a new mirrorlist system developed by Lance Davis for CentOS.

# 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

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

gpgcheck=1

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

 

#released updates

[updates]

name=CentOS-$releasever - Updates

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

gpgcheck=1

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

 

#packages used/produced in the build but not released

#[addons]

#name=CentOS-$releasever - Addons

#baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/

#gpgcheck=1

#gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful

[extras]

name=CentOS-$releasever - Extras

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

gpgcheck=1

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-$releasever - Plus

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

gpgcheck=1

enabled=0

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

经过测试,教育网内用中科大的源很快。外网用网易的源非常快。

 

yum clean all

 

yum makecache

 

下面的测试

 

 

在站glibc.i686遇到很多问题,如下:出现这个问题的原因最后确定是因为我的一个文件搞错了,也就是上面写道CentOS-Base.repo,不过现在全部搞定。

yum install glibc.i686
Loaded plugins: fastestmirror, product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package glibc.i686 0:2.5-81.el5_8.4 will be installed
--> Processing Dependency: glibc-common = 2.5-81.el5_8.4 for package: glibc-2.5-81.el5_8.4.i686
--> Finished Dependency Resolution
Error: Package: glibc-2.5-81.el5_8.4.i686 (update)
Requires: glibc-common = 2.5-81.el5_8.4
Installed: glibc-common-2.12-1.25.el6.x86_64 (@anaconda-RedHatEnterpriseLinux-201105101844.x86_64/6.1)
glibc-common = 2.12-1.25.el6
Available: glibc-common-2.5-81.x86_64 (base)
glibc-common = 2.5-81
Available: glibc-common-2.5-81.el5_8.1.x86_64 (update)
glibc-common = 2.5-81.el5_8.1
Available: glibc-common-2.5-81.el5_8.2.x86_64 (update)
glibc-common = 2.5-81.el5_8.2
Available: glibc-common-2.5-81.el5_8.4.x86_64 (update)
glibc-common = 2.5-81.el5_8.4
You could try using --skip-broken to work around the problem
** Found 2 pre-existing rpmdb problem(s), 'yum check' output follows:
PackageKit-0.5.8-19.el6.x86_64 has missing requires of PackageKit-yum = ('0', '0.5.8', '19.el6')
PackageKit-0.5.8-19.el6.x86_64 has missing requires of PackageKit-yum-plugin = ('0', '0.5.8', '19.el6')

下面就是为了解决这些问题

 

yum remove 'rhn-check-1.0.0-61.el6.noarch'

 

yum instal PackageKit-glib

 

yum install abrt-addon-ccpp

 

文章转载自http://www.cnblogs.com/zuiyirenjian/archive/2012/07/26/2609227.html

你可能感兴趣的:(linux,centos,redhat,yum)