zoukankan      html  css  js  c++  java
  • 在rhel上配置yum 源

    记录在redhat 上配置yum 源的过程。

    服务器 redhat 6.7 版本 ,redhat本身的yum源需要注册,于是切换为Centos 6的源,以下记录 切换的过程。

    1 查看并卸载本机安装的yum 相关包

    查看

    [root@localhost 20200422]# rpm -qa | grep yum
    yum-langpacks-0.4.2-7.el7.noarch
    yum-plugin-fastestmirror-1.1.31-42.el7.noarch
    yum-utils-1.1.31-42.el7.noarch
    yum-metadata-parser-1.1.4-10.el7.x86_64
    yum-3.4.3-154.el7.centos.noarch
    

    卸载

    [root@localhost 20200422]# rpm -qa | grep yum | xargs rpm -e --nodeps
    

    2 到阿里云下载相关rpm包 https://mirrors.aliyun.com/centos/6/os/x86_64/Packages/

    createrepo-0.9.9-28.el6.noarch.rpm
    python-urlgrabber-3.9.1-11.el6.noarch.rpm
    yum-3.2.29-81.el6.centos.noarch.rpm
    yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
    yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
    yum-updateonboot-1.1.30-41.el6.noarch.rpm
    yum-utils-1.1.30-41.el6.noarch.rpm
    

    3 安装

    • 先安装 python-urlgrabber-3.9.1-11.el6.noarch.rpm
    [root@localhost yum_temp]# rpm -Uvh python-urlgrabber-3.9.1-11.el6.noarch.rpm
    
    • 再安装其余的包
    [root@localhost yum_temp]#rpm -ivh yum-*
    

    4 切换源

    使用 wget下载新的 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
    修改CentOS-Base.repo文件中的$releasever全部替换为版本号7.
    命令: %s/$releasever/6/g
    

    或者

    cd /etc/yum.repos.d/ 
    mv redhat.repo redhat.repo.bak
    mv rhel-source.repo rhel-source.repo.bak
    vi /etc/yum.repos.d/CentOS-Base.repo
    粘贴如下信息:
     
    #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-6 - Base - 163.com
    #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
    baseurl=http://mirrors.163.com/centos/7/os/$basearch/
    gpgcheck=1
    gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6.7
     
    #released updates
    [updates]
    name=CentOS-6 - Updates - 163.com
    #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates
    baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
    gpgcheck=1
    gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6.7
     
    #additional packages that may be useful
    [extras]
    name=CentOS-6 - Extras - 163.com
    #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
    baseurl=http://mirrors.163.com/centos/7/extras/$basearch/
    gpgcheck=1
    gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6.7
     
    #additional packages that extend functionality of existing packages
    [centosplus]
    name=CentOS-6 - Plus - 163.com
    baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/
    gpgcheck=1
    enabled=0
    gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6.7
     
    

    5 清理缓存

    yum clean all
    yum makecache
    

    6 验证

    yum install telnet
    
    种一棵树最好的时间是十年前,其次是现在!
  • 相关阅读:
    大三学习进度64
    大三学习进度70
    中美科技巨头——BATH和GAFA
    多线程写excel数据思路
    3
    1
    比特币
    加分项
    3e
    换题了
  • 原文地址:https://www.cnblogs.com/gaozhidao/p/13187253.html
Copyright © 2011-2022 走看看