因为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. Spring笔记⑥--整合struts2

    Spring如何在web应用里面用 需要额外加入的jar包 Spring-web-4.0.0 Spring-webmvc-4.0.0 Spring的配置文件,没什么不同   需要在web.xml下配置 ...

  2. Leetcode题库——19.删除链表的倒数第 n 个节点【##】

    @author: ZZQ @software: PyCharm @file: removeNthFromEnd.py @time: 2018/9/26 21:56 说明:给定一个链表,删除链表的倒数第 ...

  3. Cosplay之孩子的妈咪

    很荣幸的担任“孩子妈妈”的角色,站在父母的角度去思考怎样的一个四则运算的APP才算是符合要求,可以受到广大家长的喜爱.不外乎有这样一些功能:1.可以随时的给孩子出题目,而且可以很快的得出正确答案.分析 ...

  4. Spring下使用开发webservice

    依赖包 <!-- CXF Dependencies --> <dependency> <groupId>org.apache.cxf</groupId> ...

  5. angularJS1笔记-(17)-ng-bind-html指令

    angular不推荐大家在绑定数据的时候绑定html,但是如果你非要这么干也并不是不可以的.举个例子: <!DOCTYPE html> <html lang="en&quo ...

  6. iOS- CALayer绘图,如何绘制渐变效果图

    1.渐变效果 —> 色彩空间 首先:自定义一个渐变视图,在自定义视图中重写drawRect #import "ViewController.h" #import " ...

  7. linu中解压不同后缀的文件

    1.*.tar 用 tar –xvf 解压 2.*.gz 用 gzip -d或者gunzip 解压 3.*.tar.gz和*.tgz 用 tar –xzf 解压 4.*.bz2 用 bzip2 -d或 ...

  8. 2D变换

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  9. IPV6 国内进展情况

    国家下一代互联网产业技术创新战略联盟(以下简称“产业联盟”),近日在北京发布了我国首份IPv6业务用户体验监测报告(以下简称<报告>).该<报告>监测了我国固定宽带的IPv6普 ...

  10. ng-include 上ng-controller 无法获取控件

    A.Html内容如下 <div> <div kendo-grid="testGrid" k-options="testOptions"> ...