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
    
  • 相关阅读:
    spring aop实现数据库的读写分离
    MySQL主从复制(Master-Slave)实践
    java 注解 Annontation
    java NIO介绍
    为什么你学不会递归?告别递归,谈谈我的一些经验(转)
    maven的安装、路径配置、修改库文件路径和eclipse中的配置、创建maven工程(转)
    Eclipse中创建Maven多模块工程
    Eclipse的Working Set管理项目
    Java使用POI读取和写入Excel指南(转)
    Webpack安装和命令
  • 原文地址:https://www.cnblogs.com/300js/p/11016244.html
Copyright © 2011-2022 走看看