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
相关推荐
2601_949847759 小时前
bcrypt.js 跨端三方库仓颉适配全流程
linux·运维·ubuntu
靳某某。14 小时前
Ubuntu安装php8.4 及redis ngin
linux·redis·ubuntu
木泽八14 小时前
《Ubuntu系统GRUB引导修复操作记录》
linux·运维·ubuntu
承渊政道20 小时前
Linux网络学习【从深入理解网络层原理到IP分片与重组全过程剖析】
linux·计算机网络·ubuntu·ip分片与重组
~城南花已开~20 小时前
Redfish 事件接收服务搭建指南(Ubuntu Server 实测)
linux·服务器·python·ubuntu
_小许_20 小时前
Linux 常用命令速查:CentOS 与 Ubuntu 双线对照
linux·ubuntu·centos
2601_9498477521 小时前
io-ts 跨端三方库仓颉适配全流程
linux·运维·ubuntu
打工仔折腾 AI1 天前
在 Ubuntu ARM64 部署 Q1 V3.0 MuJoCo 模型:加载、单步推理与执行器响应解析
linux·运维·人工智能·python·深度学习·ubuntu·性能优化
缘友一世2 天前
GLM5.3 CyberSec w4A16本地部署[10]:CUDA 图捕获与编译开关
ubuntu·vllm·glm5.3 cybersec
m0_547486662 天前
《Ubuntu Linux操作系统与实验教程》全套PPT课件2026
linux·ubuntu·操作系统