• Linux替换默认源(yum报错 [Errno 14] curl#7)


    * 0. yum报错 [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection refused"
    
    • 1
    # 使用默认yum源下载vim
    [root@kid ~]# yum install vim -y
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.aliyun.com
     * extras: mirrors.aliyun.com
     * updates: mirrors.aliyun.com
    ...
    http://mirrors.aliyuncs.com/centos/7/os/x86_64/Packages/perl-Carp-1.26-244.el7.noarch.rpm: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection refused"
    Trying other mirror.
    
    # 下载失败 报错 [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection refused"
    Error downloading packages:
      perl-Carp-1.26-244.el7.noarch: [Errno 256] No more mirrors to try.
      perl-Encode-2.51-7.el7.x86_64: [Errno 256] No more mirrors to try.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    * 1. 检查wget是否下载
    
    • 1
    # 该命令已经安装会提示使用方法
    [root@kid ~]# wget
    wget: missing URL
    Usage: wget [OPTION]... [URL]...
    
    Try `wget --help' for more options.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    # 没有安装提示, 未找到命令
    [root@kid ~]# wget
    -bash: sssx: command not found
    
    • 1
    • 2
    • 3
    * 2. 安装wget
    
    • 1
    [root@kid ~]# yum install -y wget
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.aliyun.com
     * extras: mirrors.aliyun.com
     * updates: mirrors.aliyun.com
    ...
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    * 3.切换到yum的配置文件目录
    
    • 1
    [root@kid ~]# cd /etc/yum.repos.d
    [root@kid yum.repos.d]# 
    
    • 1
    • 2
    * 4. 下载163网易的yum源wget 
         命令: http://mirrors.163.com/.help/CentOS7-Base-163.repo
    
    • 1
    • 2
    [root@kid yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
    --2022-08-28 16:43:14--  http://mirrors.163.com/.help/CentOS7-Base-163.repo
    Resolving mirrors.163.com (mirrors.163.com)... 101.71.33.11
    Connecting to mirrors.163.com (mirrors.163.com)|101.71.33.11|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 1572 (1.5K) [application/octet-stream]
    Saving to: ‘CentOS7-Base-163.repo’
    
    100%[===========================>] 1,572       --.-K/s   in 0s      
    
    2022-08-28 16:43:14 (94.3 MB/s) - ‘CentOS7-Base-163.repo’ saved [1572/1572]
    
    # 查看下载
    [root@kid yum.repos.d]# ls
    CentOS7-Base-163.repo  CentOS-Media.repo
    CentOS-Base.repo.back  CentOS-Sources.repo
    CentOS-CR.repo         CentOS-Vault.repo
    CentOS-Debuginfo.repo  CentOS-x86_64-kernel.repo
    CentOS-fasttrack.repo
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    * 5. 将默认yum源修配置文件改名称
    
    • 1
    [root@kid yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.back
    
    • 1
    * 6. 将网易云yum源配置文件名称改为默认源的名称
    
    • 1
    [root@kid yum.repos.d]# mv CentOS7-Base-163.repo CentOS-Base.repo
    
    • 1
    * 7. yum下载会依据CentOS-Base.repo配置配置去服务器下载软件...
         如果替换源之后无法使用, 网易源删掉... 
         将默认源CentOS-Base.repo.back 替换回来, 改名去掉.back, 
    
    • 1
    • 2
    • 3
    [root@kid yum.repos.d]# yum install vim -y
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    Resolving Dependencies
    --> Running transaction check
    ...
    # 完成
    Complete!
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    ————————————————
    文章的段落全是代码块包裹的, 留言是为了避免文章提示质量低.
    文章的段落全是代码块包裹的, 留言是为了避免文章提示质量低.
    文章的段落全是代码块包裹的, 留言是为了避免文章提示质量低.
    文章的段落全是代码块包裹的, 留言是为了避免文章提示质量低.
    文章的段落全是代码块包裹的, 留言是为了避免文章提示质量低.
    文章的段落全是代码块包裹的, 留言是为了避免文章提示质量低.
    文章的段落全是代码块包裹的, 留言是为了避免文章提示质量低.
    文章的段落全是代码块包裹的, 留言是为了避免文章提示质量低.
    文章的段落全是代码块包裹的, 留言是为了避免文章提示质量低.
    文章的段落全是代码块包裹的, 留言是为了避免文章提示质量低.
    ————————————————

  • 相关阅读:
    Java基础20221105
    Dubbo 与 Spring Cloud 完美结合
    好心情精神心理科医生:精神病人为何会出现幻觉?
    代码随想录算法训练营20期|第三十九天| 动态规划part02|● 62.不同路径 ● 63. 不同路径 II
    7.9 混合背包问题7.10 特殊要求7.11 背包问题的搜索解法
    2022 华数杯 B 题 水下机器人的组装计划
    Python可视化 | Python可视化进阶必备 - plotly
    CPU的运行与其对线程的影响
    java基于springboot+vue的编程教学在线考试系统 elementui
    visual studio 15 无法卸载(安装时发生严重错误)
  • 原文地址:https://blog.csdn.net/qq_46137324/article/details/126571737