转载自:http://blog.csdn.net/zhngjan/article/details/20843465

搜狐镜像库:mirrors.sohu.com

163镜像库:mirrors.163.com

 

查看系统信息:

[admin@server1 ~]$ uname -a

Linux server1 2.6.32-358.el6.x86_64 #1 SMP Tue Jan 29 11:47:41 EST 2013 x86_64 x86_64 x86_64 GNU/Linux

在使用redhat linux的yum来安装或者更新软件的时候会提示

  1. [admin@server1 ~]$ sudo yum install gcc
  2. Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
  3. This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
  4. Setting up Install Process
  5. No package gcc available.
  6. Error: Nothing to do

[注]请以root身份操作

由于 redhat的yum在线更新是收费的,如果没有注册的话不能使用,如果要使用,需将redhat的yum卸载后,重启安装,再配置其他源
解决办法:
1、首先到http://mirrors.163.com/centos下载软件包

## x86 地址:http://mirrors.163.com/centos/6/os/i386/Packages/
## x86_64 地址:http://mirrors.163.com/centos/6/os/x86_64/Packages/
## 必要下载的软件包有(以64位系统为例):
python-iniparse-0.3.-2.1.el6.noarch.rpm
yum-3.2.-.el6.centos.noarch.rpm
yum-metadata-parser-1.1.-.el6.x86_64.rpm
yum-plugin-fastestmirror-1.1.-.el6.noarch.rpm

下载命令:

wget http://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-40.el6.centos.noarch.rpm wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

[注] :版本不一定要最新的(http://mirrors.163.com/centos/6/os/x86_64/Packages/ 查找对应版本)

2、卸载RedHat自带的yum

rpm -qa | grep yum | xargs rpm -e --nodeps 

注:1>   xargs是一条Unix和类Unix操作系统的常用命令。它的作用是将参数列表转换成小块分段传递给其他命令,以避免参数列表过长的问题

2>   --nodeps  强制卸载,不管依赖性
 
3、安装下载的centos的yum包:

rpm -ivh python-iniparse-0.3.-2.1.el6.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.-.el6.x86_64.rpm
rpm -ivh yum-3.2.-.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.-.el6.noarch.rpm

[注] :最后2个需要一起安装,否则会出现依赖性错误

4、到http://mirrors.163.com的 centos帮助文档 中下载CentOS6-Base-163.repo文件,存放到/etc/yum.repo.d中

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

5、编辑CentOS6-Base-163.repo文件,将其中的$releasever更改为centos的版本号

下面是修改好的:

# 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- - Base - .com
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
gpgcheck=
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #released updates
[updates]
name=CentOS- - Updates - .com
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates
gpgcheck=
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful
[extras]
name=CentOS- - Extras - .com
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
gpgcheck=
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages
[centosplus]
name=CentOS- - Plus - .com
baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=centosplus
gpgcheck=
enabled=
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #contrib - packages by Centos Users
[contrib]
name=CentOS- - Contrib - .com
baseurl=http://mirrors.163.com/centos/6/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=contrib
gpgcheck=
enabled=
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

6、yum clean all 清除原有缓存

7、yum makecache  获取yum列表
出现下面提示,表示yum更改完成:
Metadata Cache Created

脚本:

#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH # Check if user is root
if [ $(id -u) != "" ]; then
echo "Error: You must be root to run this script"
exit
fi clear
echo "========================================================================="
echo "Replace Redhat Enterprise Yum to CentOS Yum and Repos, Written by Licess"
echo "=========================================================================" # uninstall rhel yum
echo "Uninstall Rhel Yum......"
rpm -qa|grep yum|xargs rpm -e --nodeps
# delete old rpm
echo "Clean old cache......"
rm -rf python-iniparse-0.3.-2.1.el6.noarch.rpm
rm -rf yum-metadata-parser-1.1.-.el6.x86_64.rpm
rm -rf yum-3.2.-.el6.centos.noarch.rpm
rm -rf yum-plugin-fastestmirror-1.1.-.el6.noarch.rpm # download CentOS Yum
echo "Download Python-iniparse......"
wget http://mirrors.163.com/centos/6. ... -2.1.el6.noarch.rpm echo "Download yum-metadata-parse......"
wget http://mirrors.163.com/centos/6. ... 2-16.el6.x86_64.rpm echo "Download yum......"
wget http://mirrors.163.com/centos/6. ... 6.centos.noarch.rpm echo "Download yum fastmirror......"
wget http://mirrors.163.com/centos/6. ... 0-14.el6.noarch.rpm # install CentOS Yum
echo "Installing......"
rpm -ivh python-iniparse-0.3.-2.1.el6.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.-.el6.x86_64.rpm
rpm -ivh yum-3.2.-.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.-.el6.noarch.rpm # replace repos
## 将修改改好的CentOS6-Base-163.repo 拷贝到/etc/yum.repo.d/中
##然后执行下面命令
yum clean all
yum makecache
yum update echo "=========================================================================="
echo "You have successfully replace RedhatEnterprise Yum to CentOS yum and repos"
echo "=========================================================================="
 

redhat ent6.5使用centos yum的更多相关文章

  1. redhat centos yum源的安装

    redhat centos yum源的安装 1.除旧 #cd /etc/yum.repos.d #mv rhel-debuginfo.repo rhel-debuginfo.repo.bak 此处将其 ...

  2. Redhat 6 配置CentOS yum source

    由于最近曝出linux的bash漏洞,想更新下bash,于是 想到了配置CentOS yum source. 测试bash漏洞的命令: env x='() { :;}; echo "Your ...

  3. redhat下yum命令安装(替换为centos yum命令)

    redhat默认自带的yum源需要注册,才能更新,报错:This system is not registered to Red Hat Subscription Management. You ca ...

  4. RedHat 更新CentOS Yum源(转)

    经测试,可用.转自:https://www.cnblogs.com/tangsen/p/5151994.html 一.随笔引言 1.1随笔内容: 1.RedHat 配置Centos yum源 2.yu ...

  5. Redhat6.5使用centos yum源

    新安装了redhat6.5.安装后,登录系统,使用yum update 更新系统.提示:This system is not registered to Red Hat Subscription Ma ...

  6. centos yum源配置 与yum配置文件

    参考博客 http://www.cnblogs.com/mchina/archive/2013/01/04/2842275.html 1.centos . yum配置文件在目录 /etc/yum.re ...

  7. redhat7.4 使用centos yum源

    新安装了redhat7.4安装后,登录系统,使用yum update 更新系统.提示: This system is not registered to Red Hat Subscription Ma ...

  8. CentOS yum源设定使用方法的整理(转)

    CentOS yum更新了很多版本更新,我本人认为CentOS yum很好使的文件系统,在此向大家推荐CentOS应该是做为服务器的linux的佼佼者.CentOS采用的二进制包是rpm,不过包的依赖 ...

  9. 卸载Redhat 7自带的yum,安装并使用网易163源

    由于redhat的yum在线更新是收费的,如果没有注册的话不能使用,如果要使用,需将redhat的yum卸载后,安装CentOS yum工具,再配置其他源,以下为详细过程:删除redhat原有的yum ...

随机推荐

  1. 赵雅智_service生命周期

    Android中的服务和windows中的服务是类似的东西,服务一般没实用户操作界面.它执行于系统中不easy被用户发觉,能够使用它开发如监控之类的程序. 服务的开发步骤 第一步:继承Service类 ...

  2. 算法笔记_104:蓝桥杯练习 算法提高 新建Microsoft Word文档(Java)

    目录 1 问题描述 2 解决方案   1 问题描述 问题描述 L正在出题,新建了一个word文档,想不好取什么名字,身旁一人惊问:“你出的题目叫<新建Microsoft Word文档>吗? ...

  3. 算法笔记_101:蓝桥杯练习 算法提高 身份证号码升级(Java)

    目录 1 问题描述 2 解决方案   1 问题描述 问题描述 从1999年10月1日开始,公民身份证号码由15位数字增至18位.(18位身份证号码简介).升级方法为: 1.把15位身份证号码中的年份由 ...

  4. lodash 移除数据元素 pull without 删除数组元素

    _.pull(array, [values]) 移除所有经过 SameValueZero 等值比较为 true 的元素 . without 不会修改原数组 <!DOCTYPE html> ...

  5. Odoo,OpenERP widget标签

    Odoo,OpenERP widget标签 widget="statusbar" 头部状态条标签 widget="email"  电子邮件地址标签 widget ...

  6. TCP 的那些事儿(上) SACK

    http://blog.csdn.net/woxiaozhi/article/details/27328557 文章太好了,转载过啦 这篇文章分为上下两篇  确实不错  所以存在这里收藏 TCP是一个 ...

  7. Python 代码块左移或右移

    (就 IDE 是  PyCharm 来说) 选中代码块: 1)右移:直接 Tab 2)左移:Shift + Tab Python 对代码对齐要求很严格的. Python的对齐方式很重要,对齐方式决定了 ...

  8. 深入浅出REST架构 REST架构概述

    http://www.nowamagic.net/librarys/veda/detail/885何为REST? REST是英文Representational State Transfer的缩写,中 ...

  9. Android Unique Device ID

    There are several occasions when the unique identifier of a device is required. For instance you nee ...

  10. SQL&EF优化第一篇 各种情况下的性能测试之count函数篇

    测试环境  mssql 08  +win7    数据 30W条 二〇一六年十月二十九日 09:04:43 结论:1>主键> *>可空列    推测未论证: 根据情况优先选择 顺便提 ...