• 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

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

  • 相关阅读:
    ILM ADO storage tiering policy on table partition
    vulnhub靶场之MOMENTUM: 1
    杰理之CMD_SET_BLE_VISIBILITY【篇】
    Rust 第三方库创建和导入(cargo --lib)
    python实现图像二分类精准率(numpy)
    【python】内置库函数大集合 ❢ 这不得点赞收藏一波~
    接口测试经典面试题:Session、cookie、token有什么区别?
    基于springboot财务管理系统设计与实现-计算机毕业设计源码+LW文档
    前端JS基础第二篇:作用域与作用域链
    Rustdesk 自建服务器教程
  • 原文地址:https://blog.csdn.net/qq_46137324/article/details/126571737