将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

 

 

 

相关文章
|
5天前
|
缓存 Ubuntu Linux
Linux中yum、rpm、apt-get、wget的区别,yum、rpm、apt-get常用命令,CentOS、Ubuntu中安装wget
通过本文,我们详细了解了 `yum`、`rpm`、`apt-get`和 `wget`的区别、常用命令以及在CentOS和Ubuntu中安装 `wget`的方法。`yum`和 `apt-get`是高层次的包管理器,分别用于RPM系和Debian系发行版,能够自动解决依赖问题;而 `rpm`是低层次的包管理工具,适合处理单个包;`wget`则是一个功能强大的下载工具,适用于各种下载任务。在实际使用中,根据系统类型和任务需求选择合适的工具,可以大大提高工作效率和系统管理的便利性。
54 25
|
1月前
|
缓存 Linux
CentOS-6的iso下载地址镜像yum源
通过上述步骤,您可以成功下载CentOS 6的ISO镜像文件,并配置适用于CentOS 6的YUM源。尽管CentOS 6已经停止更新,但使用这些镜像和YUM源配置,可以继续在需要的环境中使用和维护CentOS 6系统。
391 20
|
1月前
|
Linux
CentOs9 yum源出现404问题
CentOs9-stream yum源出现404问题
|
2月前
|
缓存 Linux
解决CentOS 7停止更新后yum源失效问题【图文教程】
以上步骤完成后,你的 CentOS 7 系统就会使用阿里云的 yum 源,更换yum以后就可以正常使用啦。
2131 2
|
4月前
|
Linux 虚拟化 开发者
一键将CentOs的yum源更换为国内阿里yum源
一键将CentOs的yum源更换为国内阿里yum源
7184 8
|
5月前
|
Linux
centos使用阿里的yum源
centos使用阿里的yum源
|
6月前
|
缓存 Linux 网络安全
解决 CentOS 7 官方 yum 仓库无法使用的最佳实践
【8月更文挑战第18天】若 CentOS 7 的官方 YUM 仓库无法使用,可按以下步骤解决: 1. **检查网络连接**: - 确认服务器能正常上网,可通过访问外部网站或网络诊断测试。 - 检查防火墙设置,避免其阻挡 YUM 的网络访问。 2. **检查 YUM 配置**: - 核实 `/etc/yum.repos.d/` 下的 `CentOS-Base.repo` 文件中仓库地址正确无误。 - 确认配置文件内的 `enabled` 选项设为 `1` 以启用仓库。
2674 0
|
存储 关系型数据库 MySQL
Red Hat 安装MySQL 8.0与 Navicat
Red Hat 安装 MySQL 8.0 1、更新软件包列表 在添加 MySQL 存储库后,运行以下命令以更新软件包列表: sudo yum update 2、安装MySQL服务器和客户端 执行以下命令安装MySQL 8.0服务器和客户端软件包: sudo yum install -y mysql-server 3、启动MySQL服务 安装完成后,MySQL 服务器应该已经自动启动。如果没有启动,您可以运行以下命令手动启动服务: sudo systemctl start mysqld 启用 MySQL 服务的开机启动,可以运行以下命令: sudo systemctl enable mysqld
321 1
|
9月前
|
安全 Linux 网络安全
如何在 VM 虚拟机中安装 Red Hat Enterprise Linux 9.3 操作系统保姆级教程(附链接)
如何在 VM 虚拟机中安装 Red Hat Enterprise Linux 9.3 操作系统保姆级教程(附链接)
|
3月前
|
消息中间件 Linux RocketMQ
在Red Hat Enterprise Linux 9上使用Docker快速安装并部署
通过以上步骤,你可以在Red Hat Enterprise Linux 9上使用Docker快速安装并部署RocketMQ。这种方法不仅简化了安装过程,还提供了一个灵活的环境来管理和扩展消息队列系统。RocketMQ作为一款高性能的分布式消息系统,通过Docker可以实现快速部署和高效管理。
181 3

热门文章

最新文章