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
相关推荐
超越自己4 分钟前
远程连接银河麒麟服务器-xrdp方式
linux·运维·服务器·远程桌面·银河麒麟
sakoba5 分钟前
Linux上kafka部署和使用
linux·运维·kafka
小武~12 分钟前
嵌入式Linux安全启动全解析:从原理到实战
linux·网络·安全
刘一说22 分钟前
CentOS Stream 网络故障排查:静态IP丢失、无法访问的完整解决方案
linux·tcp/ip·centos
硬核子牙23 分钟前
gdb调试多线程底层实现原理
linux
用户61354114601626 分钟前
OceanBase all-in-one 4.2.0.0 安装教程(CentOS 7/EL7 一键部署详细步骤)
linux
橘子1333 分钟前
Linux网络(二)——socket编程
linux·网络
lxmyzzs41 分钟前
在使用 `resolvconf` 的 Ubuntu 系统上持久化 DNS 设置
linux·运维·ubuntu
nassi_1 小时前
文件属性获取与目录IO操作详解
linux·服务器·网络
User_芊芊君子1 小时前
【LeetCode 经典题解】:队列与栈的双向模拟——从原理到代码详解
linux·redis·leetcode