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

* 0. yum报错 [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection refused"
# 使用默认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. 检查wget是否下载
# 该命令已经安装会提示使用方法
[root@kid ~]# wget
wget: missing URL
Usage: wget [OPTION]... [URL]...

Try `wget --help' for more options.
# 没有安装提示, 未找到命令
[root@kid ~]# wget
-bash: sssx: command not found
* 2. 安装wget
[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
...
* 3.切换到yum的配置文件目录
[root@kid ~]# cd /etc/yum.repos.d
[root@kid yum.repos.d]# 
* 4. 下载163网易的yum源wget 
     命令: http://mirrors.163.com/.help/CentOS7-Base-163.repo
[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
* 5. 将默认yum源修配置文件改名称
[root@kid yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.back
* 6. 将网易云yum源配置文件名称改为默认源的名称
[root@kid yum.repos.d]# mv CentOS7-Base-163.repo CentOS-Base.repo
* 7. yum下载会依据CentOS-Base.repo配置配置去服务器下载软件...
     如果替换源之后无法使用, 网易源删掉... 
     将默认源CentOS-Base.repo.back 替换回来, 改名去掉.back, 
[root@kid yum.repos.d]# yum install vim -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
...
# 完成
Complete!

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

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值