将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.卸载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位安装包)

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

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

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


wget http://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

 

 

 

相关文章
|
22天前
|
缓存 Linux
解决CentOS 7停止更新后yum源失效问题【图文教程】
以上步骤完成后,你的 CentOS 7 系统就会使用阿里云的 yum 源,更换yum以后就可以正常使用啦。
440 2
|
4月前
|
Linux
家族风云录:Red Hat与它的“调皮弟弟”CentOS,一场IT界的欢乐大戏 🎭
在IT界,Red Hat家族光芒四射,特别是RHEL这位稳重大哥,以卓越的安全性和稳定性守护企业级服务器。而CentOS则是家族里的调皮弟弟,继承RHEL的优点,以更亲民的姿态活跃在技术前沿。两者虽性格不同,却情谊深厚,共同书写着IT江湖的传奇故事。🌈👨‍👩‍👧‍👦🎉
60 0
|
2月前
|
Linux 虚拟化 开发者
一键将CentOs的yum源更换为国内阿里yum源
一键将CentOs的yum源更换为国内阿里yum源
4695 8
|
4月前
|
关系型数据库 MySQL Linux
在CentOS上使用yum安装与使用MySQL
在CentOS操作系统上使用yum包管理器安装和配置MySQL数据库的详细步骤,包括下载MySQL的yum源配置、安装MySQL服务、启动和停止服务、设置开机自启动、获取临时密码、修改root用户密码、授权用户以及处理相关问题。同时,文章还包含了一些操作的截图,帮助用户更直观地理解安装和配置过程。
1277 0
在CentOS上使用yum安装与使用MySQL
|
3月前
|
Linux
centos使用阿里的yum源
centos使用阿里的yum源
|
4月前
|
缓存 Linux 网络安全
解决 CentOS 7 官方 yum 仓库无法使用的最佳实践
【8月更文挑战第18天】若 CentOS 7 的官方 YUM 仓库无法使用,可按以下步骤解决: 1. **检查网络连接**: - 确认服务器能正常上网,可通过访问外部网站或网络诊断测试。 - 检查防火墙设置,避免其阻挡 YUM 的网络访问。 2. **检查 YUM 配置**: - 核实 `/etc/yum.repos.d/` 下的 `CentOS-Base.repo` 文件中仓库地址正确无误。 - 确认配置文件内的 `enabled` 选项设为 `1` 以启用仓库。
2100 0
|
4月前
|
Ubuntu Linux 测试技术
下载ISO镜像的方法 Debian、Red Hat 、CentOS、Ubuntu、Kali Linux🌐
Debian、Red Hat、CentOS、Ubuntu与Kali Linux均为知名Linux发行版。下载Debian须访问官网并按计算机架构选ISO文件。Red Hat下载通常需订阅账户,可从官网登录后获取。CentOS可从官网或镜像站点下载,注意CentOS 8已停更。Ubuntu下载简便,官网直接选取版本及架构即可。Kali Linux专为安全测试设计,官网提供直接下载ISO镜像服务。
920 0
|
4月前
|
Linux Docker 容器
在CentOS操作系统上使用yum安装/使用/卸载Docker容器引擎
在CentOS操作系统上安装、配置、使用和卸载Docker容器引擎的详细步骤,包括配置Docker镜像加速的方法。
511 0
|
4月前
|
安全 Java 应用服务中间件
如何通过 Yum 在 CentOS 7 上安装 Apache Tomcat 7
如何通过 Yum 在 CentOS 7 上安装 Apache Tomcat 7
225 0
|
7月前
|
安全 Linux 网络安全
如何在 VM 虚拟机中安装 Red Hat Enterprise Linux 9.3 操作系统保姆级教程(附链接)
如何在 VM 虚拟机中安装 Red Hat Enterprise Linux 9.3 操作系统保姆级教程(附链接)