zoukankan      html  css  js  c++  java
  • redhat7 配置使用centos的yum源

    新安装了redhat7.安装后,登录系统,使用yum update 更新系统。提示:

    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

    无法更新。

    redhat 默认自带的 yum 源需要注册,才能更新。我们想不花钱也可以更新,需要替换掉redhat的yum源。

    1.检查是否安装yum包

    查看RHEL是否安装了yum,若是安装了,那么又有哪些yum包:

    [root@syq yum.repos.d]# rpm -qa |grep yum
    yum-3.4.3-118.el7.noarch
    yum-utils-1.1.31-24.el7.noarch
    yum-rhn-plugin-2.0.1-4.el7.noarch
    PackageKit-yum-0.8.9-11.el7.x86_64
    yum-langpacks-0.4.2-3.el7.noarch
    yum-metadata-parser-1.1.4-10.el7.x86_64

    2 删除redhat自带的yum包

    卸载上面显示的所有yum包:

    [root@localhost ~]# rpm -qa|grep yum|xargs rpm -e --nodeps(不检查依赖,直接删除rpm包)

    再用

    [root@localhost ~]# rpm -qa |grep yum

    [root@localhost ~]# 

    查看,无信息显示表示已经卸载完成。

    3.下载新的yum包。使用Centos7的yum包

    wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

    wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-150.el7.centos.noarch.rpm

    wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-40.el7.noarch.rpm

    wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-40.el7.noarch.rpm

    wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm     ( rpm -qa|grep python-urlgrabber|xargs rpm -e --nodeps )

    安装yum软件包

    注意:单个的安装包可能会依赖其它包(例如yum和yum-fastestmirror会相互依赖),所以我们可以把所有这些包放在一起,用一行命令将它们同时安装即可:

    rpm -ivh python-urlgrabber-3.10-8.el7.noarch.rpm

    rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm yum-3.4.3-150.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-40.el7.noarch.rpm

    4.更换yum源。使用阿里云的源

     第一步:备份你的原镜像文件,以免出错后可以恢复。

    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
    第二步:下载新的CentOS-Base.repo 到/etc/yum.repos.d/
    CentOS 5
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
    
    CentOS 6
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
    CentOS 7
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    更改CentOS-Media.repo使其为不生效:
    enabled=0
    第三步:修改CentOS-Base.repo文件中的$releasever全部替换为版本号7.

    第四步:运行yum makecache生成缓存
    yum clean all
    yum makecache
    yum update
  • 相关阅读:
    Android Push Notification实现信息推送使用
    线段树 Interval Tree
    树状数组
    LCA和RMQ
    RMQ (Range Minimal Query) 问题 ,稀疏表 ST
    winner tree 胜者树
    ORA-64379: Action cannot be performed on the tablespace assigned to FastStart while the feature is enabled
    mybatis 查询优化主子表查询之association和collection
    Oracle 11gR2 用户重命名(rename user)
    redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketException: 断开的管道 (Write failed)
  • 原文地址:https://www.cnblogs.com/syqlp/p/6555524.html
Copyright © 2011-2022 走看看