因为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. poi读取、通过poi导出数据库的记录到excl表

    package com.nt.test;   import java.io.File; import java.io.FileInputStream; import java.io.FileNotFo ...

  2. java 框架 面试

    Java—SSH(MVC)1. 谈谈你mvc的理解MVC是Model—View—Controler的简称.即模型—视图—控制器.MVC是一种设计模式,它强制性的把应用程序的输入.处理和输出分开.MVC ...

  3. 配置树莓派/Linux默认声卡设备

    1.设置默认声卡为USB声卡 在$HOME下新建.asoundrc $cd $HOME $nano .asoundrc 输入以下内容 defaults.ctl.card 1 defaults.pcm. ...

  4. 用JAVA制作微型操作系统4月23日情况

    弄好了一个自认为十分精美的界面,但本想着昨天就在开始按钮上先套入控制jp222面板上的jb2标签上的时间更新,这按钮起到开始线程的作用(我认为按钮应该可以通过t.start()来触发线程,结果不知为什 ...

  5. Think In Java读书笔记:内部类覆盖及其初始化

    本文相关章节:第十章 内部类 10.10 内部类可以被覆盖吗 在读至本节第二个范例代码时(及下方的代码),我对输出结果中的第一个“Egg.Yolk()”很不理解,为什么它会第一个地方输出. 我起初认为 ...

  6. EF 小数位的保留

    问题描述:当采用EF的DbContext保存decimal类型数据到数据库,默认只会保存小数点后的前2位小数,其余均置0:例如保存101.182352152322,实际存到数据库里的数据为101.18 ...

  7. ci钩子

    钩子 - 扩展框架核心 CodeIgniter 的钩子特性提供了一种方法来修改框架的内部运作流程,而无需修改 核心文件.CodeIgniter 的运行遵循着一个特定的流程,你可以参考这个页面的 应用程 ...

  8. Centos7 django+uwsgi+nginx+python3.6.8部署

    安装依赖 yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-d ...

  9. true和false

    下面这些值在JavaScript中都是falsy: false 0 (数字零) "" (空字符串) null undefined NaN (一个特殊的Number值,意为Not-a ...

  10. 我的虚拟机中的 centOS 连不了网了

    网上的办法试过了,查看虚拟机的网络配置,是 NET的, 也 cd 到/etc/sysconfig/network-script/ifcfg-eth0 里面看了,onboot 本来就是 yes,要不然我 ...