zoukankan      html  css  js  c++  java
  • 腾讯云更换镜像源遇到的坑

    首先查看你LINUX的版本

    cat /etc/redhat-release
    uname -a
    cat /proc/version
    

    笔者的版本是: centos7.5

    更换为阿里云镜像源

    curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    
    • 执行命令更新源
    yum clean all
    yum makecache    //将服务器上的软件包信息缓存到本地,以提高搜索安装软件的速度
    

    执行到此处就遇到以下错误

    cp: 在"CentOS-Epel.repo" 后缺少了要操作的目标文件
    Try 'cp --help' for more information.
    [root@sgfoot2021 yum.repos.d]# cp CentOS-Epel.repo CentOS-Epel.repo.bak
    [root@sgfoot2021 yum.repos.d]# vim CentOS-Epel.repo
    [root@sgfoot2021 yum.repos.d]# yum makecache
    已加载插件:fastestmirror, langpacks
    Determining fastest mirrors
     * base: mirrors.aliyun.com
     * extras: mirrors.aliyun.com
     * updates: mirrors.aliyun.com
    base                                                                                                                                                                                                                                    | 3.6 kB  00:00:00
    docker-ce-stable                                                                                                                                                                                                                        | 3.5 kB  00:00:00
    http://mirrors.tencentyun.com/epel/7/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.tencentyun.com; 未知的错误"
    正在尝试其它镜像。
    
    
     One of the configured repositories failed (EPEL for redhat/centos 7 - x86_64),
     and yum doesn't have enough cached data to continue. At this point the only
     safe thing yum can do is fail. There are a few ways to work "fix" this:
    
         1. Contact the upstream for the repository and get them to fix the problem.
    
         2. Reconfigure the baseurl/etc. for the repository, to point to a working
            upstream. This is most often useful if you are using a newer
            distribution release than is supported by the repository (and the
            packages for the previous distribution release still work).
    
         3. Run the command with the repository temporarily disabled
                yum --disablerepo=epel ...
    
         4. Disable the repository permanently, so yum won't use it by default. Yum
            will then just ignore the repository until you permanently enable it
            again or use --enablerepo for temporary usage:
    
                yum-config-manager --disable epel
            or
                subscription-manager repos --disable=epel
    
         5. Configure the failing repository to be skipped, if it is unavailable.
            Note that yum will try to contact the repo. when it runs most commands,
            so will have to try and fail each time (and thus. yum will be be much
            slower). If it is a very temporary problem though, this is often a nice
            compromise:
    
                yum-config-manager --save --setopt=epel.skip_if_unavailable=true
    
    failure: repodata/repomd.xml from epel: [Errno 256] No more mirrors to try.
    http://mirrors.tencentyun.com/epel/7/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.tencentyun.com; 未知的错误"
    
    • 解决以上问题
    cd /etc/yum.repos.d
    
    vim CentOS-Epel.repo
    #以下为内容, 换tencentyun更换成aliyun
    [epel]
    name=EPEL for redhat/centos $releasever - $basearch
    failovermethod=priority
    gpgcheck=1
    gpgkey=http://mirrors.tencentyun.com/RPM-GPG-KEY-EPEL-7
    enabled=1
    baseurl=http://mirrors.tencentyun.com/epel/$releasever/$basearch/
    
    
    • 更换后的CentOS-Epel.repo
    [epel]
    name=EPEL for redhat/centos $releasever - $basearch
    failovermethod=priority
    gpgcheck=1
    gpgkey=http://mirrors.tencentyun.com/RPM-GPG-KEY-EPEL-7
    enabled=1
    baseurl=http://mirrors.tencentyun.com/epel/$releasever/$basearch/
    
    

    执行以下命令,更新

    yum clean all
    yum makecache
    yum -y update
    
  • 相关阅读:
    活久见!Jmeter也能实现文件传输和发送邮件啦
    震惊!资深测试开发已经不用postman测试接口了!
    app测试日志如何获取,logcat值得拥有
    TestNG学会了,Java单元测试你就掌握了一半
    超实用:精准衡量接口测试覆盖率
    Reviewboard用户指南(1.3)—— Getting Started: General Workflow
    Reviewboard用户指南(1.2)—— Getting Started: What is Code Review?
    Reviewboard用户指南(1.4)—— Getting Started: Account Settings
    Reviewboard管理员指南(4.1)—— Overview of the Administration UI
    Reviewboard用户指南(6.4)——Issue Tracking
  • 原文地址:https://www.cnblogs.com/300js/p/11016244.html
Copyright © 2011-2022 走看看