ubantu22.04 源异常

问题

bash 复制代码
root@NGN-5004:/usr/lib/apt# apt-get update
命中:2 http://mirrors.aliyun.com/docker-ce/linux/ubuntu focal InRelease
命中:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal InRelease
命中:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates InRelease
命中:4 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports InRelease
命中:5 http://security.ubuntu.com/ubuntu focal-security InRelease
正在读取软件包列表... 完成
E: 无法找到获取软件包的渠道 /usr/lib/apt/methods/<http 所需的驱动程序。
N: 是否安装了 apt-transport-<http 软件包?
E: 无法下载 <http://mirrors.aliyun.com/docker-ce/linux/ubuntu>/dists/focal/InRelease
E: 部分索引文件下载失败。如果忽略它们,那将转而使用旧的索引文件。

解决

bash 复制代码
# 1. 暂时禁用所有第三方源
sudo mv /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/docker.list.disabled

# 2. 使用最简单的官方源
sudo tee /etc/apt/sources.list << 'EOF'
deb http://archive.ubuntu.com/ubuntu focal main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu focal-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu focal-security main restricted universe multiverse
EOF

# 3. 现在应该可以更新了
sudo apt-get update

# 4. 安装 curl 和 wget(如果没有)
sudo apt-get install -y curl wget ca-certificates
相关推荐
桑榆4164 小时前
双系统(Windows + Ubuntu)安装流程
linux·windows·ubuntu
sunly_15 小时前
TypeScript:3、类型声明与类型推断
javascript·ubuntu·typescript
wengqidaifeng16 小时前
1.从“会敲命令”到理解 Linux:15 个基础指令、文件树与命令执行的本质
linux·运维·服务器·ubuntu
问天_观心21 小时前
虚拟环境WSL之Ubuntu的安装
人工智能·ubuntu
lyx494921 小时前
# Ubuntu/Linux 安装 Claude Code 并接入火山方舟 Coding Plan 完整教程(避坑版)
linux·运维·ubuntu
码农阿豪1 天前
Ubuntu部署GodoOS:Docker搭建Web办公桌面并实现远程访问
前端·ubuntu·docker
Groundwork Explorer1 天前
WSL2 Ubuntu 22.04 LTS ESP-IDF 5.5 Micropython 1.28 固件编译指南
运维·python·单片机·ubuntu
zhangrelay2 天前
ROS 2 Lyrical 第4章 URDF机器人建模与Gazebo Garden仿真
linux·笔记·学习·ubuntu·机器人·ros2
mgaofeid2 天前
Ubuntu 24.04 中文输入法安装
linux·运维·ubuntu
bosins2 天前
Ubuntu 24.04部署llama.cpp下载资源一直中断的解决方案
ubuntu·eureka·llama