• linux配置yum源


    在做linux配置yum源的时候,笔者从网上找的教程, 然后发现各种报错,最后总结了一下,比较好用的一种方法是,复制一台yum源是正常的linux虚拟机对应的  

    /etc/yum.repos.d

    目录下的文件,以下为笔者/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-$releasever - Base
    mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
    #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
    
    #released updates 
    [updates]
    name=CentOS-$releasever - Updates
    mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
    #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
    
    #additional packages that may be useful
    [extras]
    name=CentOS-$releasever - Extras
    mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
    #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
    
    #additional packages that extend functionality of existing packages
    [centosplus]
    name=CentOS-$releasever - Plus
    mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
    #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
    gpgcheck=1
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

    CentOS-Debuginfo.repo内容如下:

    # CentOS-Debug.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.
    #
    
    # All debug packages from all the various CentOS-7 releases
    # are merged into a single repo, split by BaseArch
    #
    # Note: packages in the debuginfo repo are currently not signed
    #
    
    [debug]
    name=CentOS-7 - Debuginfo
    baseurl=http://debuginfo.centos.org/7/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-7
    enabled=0
    #

    CentOS-Sources.repo文件内容如下:

    # CentOS-Sources.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-source]
    name=CentOS-$releasever - Base Sources
    baseurl=http://vault.centos.org/centos/$releasever/os/Source/
    gpgcheck=1
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
    
    #released updates 
    [updates-source]
    name=CentOS-$releasever - Updates Sources
    baseurl=http://vault.centos.org/centos/$releasever/updates/Source/
    gpgcheck=1
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
    
    #additional packages that may be useful
    [extras-source]
    name=CentOS-$releasever - Extras Sources
    baseurl=http://vault.centos.org/centos/$releasever/extras/Source/
    gpgcheck=1
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
    
    #additional packages that extend functionality of existing packages
    [centosplus-source]
    name=CentOS-$releasever - Plus Sources
    baseurl=http://vault.centos.org/centos/$releasever/centosplus/Source/
    gpgcheck=1
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

    CentOS-Vault.repo文件内容如下:

    # placeholder for now
    # #
    # CentOS Vault contains rpms from older releases in the CentOS-7 
    # tree.
    #
    # At this point in 7.0.1406, we have no older release

    根据里边的代码内容来看,CentOS-Vault.repo文件似乎没有什么作用,应该可以不需要该文件,笔者也未对其进行验证,如有兴趣的可以自己不加该文件进行验证是否能正确配置yum源。 

    最后通过以下命令进行验证是否成功设置yum源

    yum clean all   
    yum makecache  
    yum update
    
    yum repolist

    yum update对应的命令截图过长,截图部分

     

  • 相关阅读:
    ORACLE【0】:基本操作
    ORACLE【3】:分区表以及分区索引
    ORACLE【2】:锁机制及解锁
    log4j学习一:解决系统日志错位问题
    使用一个非堵塞的socket用于接收http请求
    Python中文转换报错 'ascii' codec can't decode byte 0xe8 in position
    首次使用Redis记录【3】
    xsi:schemaLocation有何作用
    【转】【redis】3.Spring 集成注解 redis 项目配置使用
    maven仓库地址
  • 原文地址:https://www.cnblogs.com/longchengruoxi/p/11307283.html
Copyright © 2020-2023  润新知