因为redhat中的yum是收费的,未注册时不允许使用的,下面是挂载光盘后的情况,未挂载是没有yum命令。但是下面即便挂载了也是需要验证的

[root@localhost /]# yum install openssl
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Setting up Install Process
Nothing to do

所以最好是去使用centos的yum源,免费的。

推文:https://blog.csdn.net/yingfengjia520/article/details/54866007

推文:RedHat6使用CentOS yum源 换yum

安装步骤:

一:查看原来的yum源,删除原有yum源

rpm -aq | grep yum    #查看
rpm -aq | grep yum|xargs rpm -e --nodeps #删除

二:下载centos的yum安装包

这里使用网易的yum源即可,快些

http://mirrors.163.com/centos/6/os/x86_64/Packages/  #修改前面的6可以修改centos版本  注意(x86_64是64位系统,i386是32位)

安装yum源的相关依赖包

http://mirrors.163.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm
http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

yum源包

http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm
http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-updateonboot-1.1.30-40.el6.noarch.rpm
http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-utils-1.1.30-40.el6.noarch.rpm

注意:在上面yum源包中yum=metadata-parser是需要系统版本要求,需要64位,这里我们的系统是32位,会出现错误

error: Failed dependencies:
libc.so.()(64bit) is needed by yum-metadata-parser-1.1.-.el6.x86_64
libc.so.(GLIBC_2.2.5)(64bit) is needed by yum-metadata-parser-1.1.-.el6.x86_64
libglib-2.0.so.()(64bit) is needed by yum-metadata-parser-1.1.-.el6.x86_64
libpthread.so.()(64bit) is needed by yum-metadata-parser-1.1.-.el6.x86_64
libpython2..so.1.0()(64bit) is needed by yum-metadata-parser-1.1.-.el6.x86_64
libsqlite3.so.()(64bit) is needed by yum-metadata-parser-1.1.-.el6.x86_64
libxml2.so.()(64bit) is needed by yum-metadata-parser-1.1.-.el6.x86_64
libxml2.so.(LIBXML2_2.4.30)(64bit) is needed by yum-metadata-parser-1.1.-.el6.x86_64

错误原因:版本不符

所以我们需要再去下载一个32位的包,原来的删掉

http://mirrors.163.com/centos/6/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.i686.rpm
[root@localhost yum]# rm -rf yum-metadata-parser-1.1.-.el6.x86_64.rpm 

三:上传安装包

[root@localhost yum]# ls
python-iniparse-0.3.-2.1.el6.noarch.rpm
python-urlgrabber-3.9.-.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
yum-updateonboot-1.1.-.el6.noarch.rpm
yum-utils-1.1.-.el6.noarch.rpm

四:先安装python依赖包

[root@localhost yum]# rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
warning: python-iniparse-0.3.-2.1.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [%]
package python-iniparse-0.3.-2.1.el6.noarch is already installed
[root@localhost yum]# rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm
warning: python-urlgrabber-3.9.-.el6.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [%]
file /usr/lib/python2./site-packages/urlgrabber/grabber.py from install of python-urlgrabber-3.9.-.el6.noarch conflicts with file from package python-urlgrabber-3.9.-.el6.noarch
file /usr/lib/python2./site-packages/urlgrabber/grabber.pyc from install of python-urlgrabber-3.9.-.el6.noarch conflicts with file from package python-urlgrabber-3.9.-.el6.noarch
file /usr/lib/python2./site-packages/urlgrabber/grabber.pyo from install of python-urlgrabber-3.9.-.el6.noarch conflicts with file from package python-urlgrabber-3.9.-.el6.noarch
file /usr/lib/python2./site-packages/urlgrabber/progress.pyc from install of python-urlgrabber-3.9.-.el6.noarch conflicts with file from package python-urlgrabber-3.9.-.el6.noarch
file /usr/lib/python2./site-packages/urlgrabber/progress.pyo from install of python-urlgrabber-3.9.-.el6.noarch conflicts with file from package python-urlgrabber-3.9.-.el6.noarch

这里发现:安装python-urlgrabber与原来的python中的插件冲突(已经安装了一个低版本的,我们要先去卸载他)

[root@localhost yum]# rpm -qa|grep python-url  查看已安装的旧版本python-urlgrabber

python-urlgrabber-3.9.1-8.el6.noarch

[root@localhost yum]# rpm -e --nodeps python-urlgrabber-3.9.1-8.el6.noarch  #强制卸载
[root@localhost yum]# rpm -qa|grep python-url
[root@localhost yum]#

再次去安装新的python-urlgrabber

[root@localhost yum]# rpm -ivh python-urlgrabber-3.9.-.el6.noarch.rpm
warning: python-urlgrabber-3.9.-.el6.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [%]
:python-urlgrabber ########################################### [%]

成功!!

五:开始安装yum源

[root@localhost yum]# ls
yum-3.2.-.el6.centos.noarch.rpm
yum-metadata-parser-1.1.-.el6.i686.rpm
yum-plugin-fastestmirror-1.1.-.el6.noarch.rpm
yum-updateonboot-1.1.-.el6.noarch.rpm
yum-utils-1.1.-.el6.noarch.rpm
[root@localhost yum]# rpm -ivh yum-*

注意:有可能你之前有安装过其他的yum包,没有卸载干净,这时我们需要先去卸载掉原有的

[root@localhost yum]# rpm -qa| grep yum
yum-updateonboot-1.1.-.el6.noarch
yum-3.2.-.el6.noarch
yum-utils-1.1.-.el6.noarch
yum-rhn-plugin-0.9.-.el6.noarch
PackageKit-yum-0.5.-.el6.i686
yum-plugin-security-1.1.-.el6.noarch
yum-plugin-fastestmirror-1.1.-.el6.noarch
yum-metadata-parser-1.1.-.el6.i686
PackageKit-yum-plugin-0.5.-.el6.i686

将所有的卸载掉

[root@localhost yum]# rpm -e --nodeps yum-3.2.-.el6.noarch
[root@localhost yum]# rpm -e --nodeps yum-updateonboot-1.1.-.el6.noarch
[root@localhost yum]# rpm -e --nodeps yum-plugin-fastestmirror-1.1.-.el6.noarch
[root@localhost yum]# rpm -e --nodeps yum-metadata-parser-1.1.-.el6.i686
[root@localhost yum]# rpm -e --nodeps yum-utils-1.1.-.el6.noarch
[root@localhost yum]# rpm -e --nodeps yum-plugin-security-1.1.-.el6.noarch
[root@localhost yum]# rpm -e --nodeps PackageKit-yum-plugin-0.5.-.el6.i686
[root@localhost yum]# rpm -e --nodeps yum-rhn-plugin-0.9.-.el6.noarch

重新安装:

[root@localhost yum]# rpm -ivh yum-*
warning: yum-3.2.-.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [%]
:yum-metadata-parser ########################################### [ %]
:yum-plugin-fastestmirro########################################### [ %]
:yum ########################################### [ %]
:yum-updateonboot ########################################### [ %]
:yum-utils ########################################### [%]

安装完成!!

六:修改yum的repo配置文件

[root@localhost yum]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
epel.repo epel-testing.repo packagekit-media.repo rhel-source.repo
[root@localhost yum.repos.d]# rm -rf *

下载centos的repo文件,放到上面的文件夹下

[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo  #没有网可以直接下载,再去上传
[root@localhost yum.repos.d]# ls
CentOS6-Base-.repo

修改配置文件:将baseurl中的$releasever修改为centos版本号,这里使用6既可以

# 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-$releasever - Base - .com
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #released updates
[updates]
name=CentOS-$releasever - Updates - .com
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&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-$releasever - Extras - .com
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&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-$releasever - Plus - .com
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&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-$releasever - Contrib - .com
baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=
enabled=
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

原来文件内容

# 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=$releasever&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=$releasever&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=$releasever&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=$releasever&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=$releasever&arch=$basearch&repo=contrib
gpgcheck=
enabled=
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

修改后的文件

七:修改后的测试

yum clean all    #清空缓存
显示已安程序包及可安程序包
yum list #需要联网

测试安装OpenSSL

[root@redhat2 yum.repos.d]# yum install openssl
Loaded plugins: fastestmirror, product-id, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Setting up Install Process
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package openssl.i686 :1.0.-.el6_2. will be updated
---> Package openssl.i686 :1.0.1e-.el6 will be an update
--> Finished Dependency Resolution Dependencies Resolved ================================================================================================================
Package Arch Version Repository Size
================================================================================================================
Updating:
openssl i686 1.0.1e-.el6 base 1.5 M Transaction Summary
================================================================================================================
Upgrade Package(s) Total size: 1.5 M
Is this ok [y/N]: y
Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
Userid: "CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>"
From : http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
** Found pre-existing rpmdb problem(s), 'yum check' output follows:
PackageKit-0.5.-.el6.i686 has missing requires of PackageKit-yum = ('', '0.5.8', '20.el6')
PackageKit-0.5.-.el6.i686 has missing requires of PackageKit-yum-plugin = ('', '0.5.8', '20.el6')
rhn-check-1.0.-.el6.noarch has missing requires of yum-rhn-plugin >= ('', '0.9.1', '')
Updating : openssl-1.0.1e-.el6.i686 /
Cleanup : openssl-1.0.-.el6_2..i686 /
Installed products updated.
Verifying : openssl-1.0.1e-.el6.i686 /
Verifying : openssl-1.0.-.el6_2..i686 / Updated:
openssl.i686 :1.0.1e-.el6 Complete!

成功!!正确

redhat6下安装centos的yum源的更多相关文章

  1. centos6.7不联网的情况下安装配置本地yum源

    1  cd / 2 mkdir -p /app/ios 3  cd /opt     mkdir ios 4   把下载好的centos-6.7-x86_64-bin-dvd1.iso  上传到 /o ...

  2. redhat 7安装CentOS 7 yum源

    http://www.bubuko.com/infodetail-2004218.html http://www.bubuko.com/infodetail-2004218.html ******** ...

  3. CentOS使用yum源中自带的rpm包安装LAMP环境

    CentOS使用yum源中自带的rpm包安装LAMP环境.这是Linux下安装LAMP的环境一种最基本最简便的方式.新手可以从容安装使用. 1. 安装基础包(可选安装)yum install -y w ...

  4. Redhat6下安装QEMU

    Redhat6下安装QEMU 1.下载QEUM:http://wiki.qemu.org/Download 2.解压qemu-1.6.1.tar.bz2到/tmp目录(也可以是其他目录)下,并进入解压 ...

  5. Centos更换yum源

    Centos更换yum源 步骤如下: 备份原始源 cd /etc/yum.repos.d/ mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/ ...

  6. 修改CentOS默认yum源为国内yum镜像源

    CentOS默认的yum源不是国内的yum源,在通过yum安装一些软件的时候,会出现这样那样的错误,以及在下载安装的速度上也是非常慢的. 所以这个时候就需要将yum源替换成国内的yum源,国内主要开源 ...

  7. Red Hat6设置使用CentOS的yum源

    环境查看 red hat系统使用自己默认的yum源未注册在使用yum安装软件的时候会出现以下错误提示 可以修改成centos的yum源 卸载yum软件 rpm -qa|grep yum|xargs r ...

  8. centos配置yum源为中国镜像源

    有时候CentOS默认的yum源不一定是国内镜像,导致yum在线安装及更新速度不是很理想.这时候需要将yum源设置为国内镜像站点.国内主要开源的开源镜像站点应该是网易和阿里云了. 修改CentOS默认 ...

  9. [转载]Redhat Enterprise 6.1 如何使用免费的CentOS的yum源

    Redhat Enterprise 6.1 如何使用免费的CentOS的yum源 graybull posted @ 2013年2月18日 22:29 in Unix/Linux with tags  ...

随机推荐

  1. 第二阶段每日站立会议Second Day

    昨天我在手机端安装cpp后进行界面效果测试以及进一步完善 今天对图片显示的大小进行调整 遇到的问题:当图片太小时,显示一块灰色区域,不美观

  2. 《Spring1之第三次站立会议》

    <第三次站立会议> 昨天:我对自己找到的代码进行了相关的了解后,把它们在编译环境中进行了编译以及接着对代码进行逐步深入了解: 今天:我把小组成员找到的写关于登录界面的代码加到了我的项目工程 ...

  3. 灵悟礼品网上专卖店——第三阶段Sprint

    一.小组成员: 洪雪意(产品负责人) 陈淑筠(Master) 二.组内人员任务情况 已完成的任务: 陈淑筠:主页面的设计 洪雪意:导航条的改进和页面中插入页面的功能 正在进行的任务: 陈淑筠:主页面的 ...

  4. python learning1.py

    # 廖雪峰的官方网站 python教材 1~4章 # 格式控制符语法 print('Hello, %s' % 'world') print('hello, %s, you have %d dollar ...

  5. Mininet安装,简单实现一个网络拓扑结构

    安装mininet Mininet安装教程,可以按照这个来,然而这个虚拟机有时会很难装.可以考虑如下的做法:先 git clone,cd mininet 和 cat INSTALL之后,可以在提示信息 ...

  6. 1003 我要通过!| PAT (Basic Level) Practice

    1003 我要通过! (20 分) "答案正确"是自动判题系统给出的最令人欢喜的回复.本题属于 PAT 的"答案正确"大派送 -- 只要读入的字符串满足下列条件 ...

  7. 电梯调度系统(界面由C图形库编绘)

    电梯调度系统编程 1.编程题目 电梯调度. 2.结对编程组员 黄冠译,刘畅. 3.编程语言 C语言图形库. 4.题目要求: 5.代码运行及结果调试: ① 运行界面为C++图形库支持,开始运行的初始界面 ...

  8. HDU 1027 打印沙漏

    https://pintia.cn/problem-sets/994805260223102976/problems/994805294251491328 本题要求你写个程序把给定的符号打印成沙漏的形 ...

  9. JMeter性能测试基础 (3) - 使用参数文件做搜索引擎性能对比

    本篇文章主要对如何在JMeter中进行URL的参数进行配置进行介绍,通过CSV文件配置参数数据,对baidu.sogou.haosou进行搜索性能对比测试. 1.建立测试计划.线程组,并在线程组下添加 ...

  10. Three.js入门篇(一)创建一个场景

    上一面讲述了向场景中添加物体对象.这一篇准备把每个功能点细细的讲述一遍,一方面是为了加深自己的理解.另一方面希望能够 帮助到有需要的人. 一.在学习WEBGL的时候,你应该先了解要创建一个WebGL程 ...