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
相关推荐
程序漫游人24 分钟前
centos8.5安装jdk21详细安装教程
java·linux
小扎仙森26 分钟前
关于服务器宝塔转移wordperss子比主题问题
运维·服务器
小小小糖果人30 分钟前
Linux云计算基础篇(5)
linux·运维·服务器
我不是哆啦A梦35 分钟前
破解风电运维“百模大战”困局,机械版ChatGPT诞生?
运维·人工智能·python·算法·chatgpt
small_wh1te_coder1 小时前
硬件嵌入式学习路线大总结(一):C语言与linux。内功心法——从入门到精通,彻底打通你的任督二脉!
linux·c语言·汇编·嵌入式硬件·算法·c
小张是铁粉1 小时前
docker在Linux的安装遇到的问题
linux·docker·容器
weixin_7714323111 小时前
linux系统 weblogic10.3.6(jar) 下载及安装
linux·运维·jar
绝不偷吃1 小时前
FastDFS分布式储存
linux·nginx
scuter_yu1 小时前
主流零信任安全产品深度介绍
运维·网络·安全
开开心心就好1 小时前
免费PDF处理软件,支持多种操作
运维·服务器·前端·spring boot·智能手机·pdf·电脑