• 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

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

  • 相关阅读:
    sql注入学习笔记
    CMake中option和cmake_dependent_option的使用
    纯c语言版单链表(上)
    单目标应用:萤火虫算法(Firefly Algorithm,FA)优化RBF神经网络实现数据预测(RBF隐藏层神经元个数可以自行设定)
    3种在ArcGIS Pro中制作山体阴影的方法
    Week2:包含 min 函数的栈
    MyBioSource 多巴胺受体 D1 (DRD1),多克隆抗体方案
    在Ubuntu使用Git向Github发布自己的项目
    C Primer Plus(6) 中文版 第6章 C控制语句:循环 6.13 关键概念 6.14 本章小结
    springcloudalibaba架构(31):SpringCloud实现用户信息在微服务之间传递
  • 原文地址:https://blog.csdn.net/qq_46137324/article/details/126571737