Ubuntu 出现 Failed to Fetch的解决办法

在使用apt install XXX时出现问题:

复制代码
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/f/fyba/libfyba0_4.1.1-6build1_amd64.deb Connection failed [IP: 185.125.190.39 80]

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/f/freexl/libfreexl1_1.0.5-3_amd64.deb Connection failed [IP: 91.189.91.39 80]

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

由于没有配置好国内的镜像源。

解决方法:

①查看自己Ubuntu的版本:

复制代码
lsb_release -a

(LSB是Linux Standard Base(Linux标准库)的缩写, lsb_release命令 用来与具体Linux发行版相关的Linux标准库信息)

获取版本号后进入:ubuntu | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror

②选取自己版本对应的镜像源,然后进入apt文件夹

复制代码
cd /etc/apt/

把之前的镜像源复制一份为001

复制代码
sudo cp sources.list cources.list.001

再打开镜像源列表

复制代码
sudo vim sources.list

按"a"进入编辑模式,把之前复制的镜像源粘到底下:

复制代码
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse

# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse

# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse

# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse

# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse


# 预发布软件源,不建议启用

# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse

# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse

然后按ESC键,:wq,再按enter保存并退出

③然后更新apt:

复制代码
 sudo apt-get upgrade
相关推荐
wdxylb6 小时前
云原生俱乐部-shell知识点归纳(1)
linux·云原生
飞雪20077 小时前
Alibaba Cloud Linux 3 在 Apple M 芯片 Mac 的 VMware Fusion 上部署的完整密码重置教程(二)
linux·macos·阿里云·vmware·虚拟机·aliyun·alibaba cloud
路溪非溪7 小时前
关于Linux内核中头文件问题相关总结
linux
木易双人青7 小时前
01-Docker-简介、安装与使用
运维·docker·容器
专注API从业者8 小时前
Python + 淘宝 API 开发:自动化采集商品数据的完整流程
大数据·运维·前端·数据挖掘·自动化
Lovyk9 小时前
Linux 正则表达式
linux·运维
Fireworkitte10 小时前
Ubuntu、CentOS、AlmaLinux 9.5的 rc.local实现 开机启动
linux·ubuntu·centos
sword devil90011 小时前
ubuntu常见问题汇总
linux·ubuntu
ac.char11 小时前
在CentOS系统中查询已删除但仍占用磁盘空间的文件
linux·运维·centos
中科米堆12 小时前
中科米堆CASAIM自动化三维测量设备测量汽车壳体直径尺寸
运维·自动化·汽车·视觉检测