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
相关推荐
想唱rap27 分钟前
UDP套接字编程
服务器·网络·c++·网络协议·ubuntu·udp
AC赳赳老秦35 分钟前
OpenClaw多平台部署:Windows+Linux跨系统协同,实现全场景覆盖
linux·服务器·前端·网络·windows·deepseek·openclaw
念恒1230638 分钟前
进程--程序地址空间下篇(进程地址空间)
linux·c语言
___波子 Pro Max.1 小时前
Linux 外挂 SSD 根目录下的 `.Trash-1000` 到底是什么
linux
爱学习的小囧1 小时前
VMware vCenter Server 9.0.2.0 资源详解+完整部署教程+下载指南+常见问题
运维·服务器·esxi·vmware·虚拟化·esxi9.0.2.0
贾斯汀玛尔斯2 小时前
每天学一个算法--单调栈(Monotonic Stack)
运维·服务器·算法
hhb_6182 小时前
Linux底层运维自动化挂载与磁盘分区实战指南
linux·运维·自动化
SpikeKing2 小时前
Server - 配置 SQLBot 智能问数项目
运维·server·sqlbot
cui_ruicheng2 小时前
Linux库制作与使用(二):ELF文件与链接过程
linux·运维·服务器
ReaF_star2 小时前
【环保】CentOS 7 安装 MySQL 8 实战记录:从安装到排障一次讲清
linux·mysql·centos