因为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. Sprint会议2

    昨天:准备查找安卓APP开发的有关资料,安装有关软件 今天:自己制作一个安卓小程序,熟悉一下操作 遇到问题:安装遇到问题,环境配置出现问题

  2. mianshi

    https://blog.csdn.net/u012557610/article/details/80350099 https://blog.csdn.net/liuqiyao_01/article/ ...

  3. Leetcode题库——11.盛最多水的容器

    @author: ZZQ @software: PyCharm @file: maxArea.py @time: 2018/10/11 21:47 说明:给定 n 个非负整数 a1,a2,...,an ...

  4. 利用Hibernate子查询(in) 得到部分字段(实体类的构造函数)

    感人= = 终于弄好了 String hql="select new Shop(s.strid,s.shopname,s.tradearea,s.discountinfo,s.beginti ...

  5. Codeforces Round #258 (Div. 2) 容斥+Lucas

    题目链接: http://codeforces.com/problemset/problem/451/E E. Devu and Flowers time limit per test4 second ...

  6. IT小小鸟读书笔记(3.9)

    对于IT小小鸟呢,我也不知道怎么说,或许一开始我就没想到这是一本集合了众多从事IT工作人员的学习,求职经历.读完这本书,说没什么感触,或许连我自己也不太相信. 在书的一开始邹欣就有说到:兴趣是第一原则 ...

  7. gitlab账号注册及分组

    .开启注册邮箱验证 admin area -->setting-->Sign-up restrictions-->勾选Send confirmation email on sign- ...

  8. windows多线程(九) PV原语分析同步问题

    一.PV原语介绍 PV原语通过操作信号量来处理进程间的同步与互斥的问题.其核心就是一段不可分割不可中断的程序. 信号量的概念1965年由著名的荷兰计算机科学家Dijkstra提出,其基本思路是用一种新 ...

  9. 解决Linux关闭SSH,终端后运行程序终止问题(包括后台)

    问题描述: 每次SSH到服务器上,然后运行了一个自己写的服务端程序,比如 ./myserver.sh ,然后关闭ssh或者终端之后,发现服务不能访问. 简要分析下: 根据   这篇博文  的提示,ss ...

  10. poj 2299 Ultra-QuickSort(树状数组求逆序数)

    链接:http://poj.org/problem?id=2299 题意:给出n个数,求将这n个数从小到大排序,求使用快排的需要交换的次数. 分析:由快排的性质很容易发现,只需要求每个数的逆序数累加起 ...