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
相关推荐
阿钱真强道9 分钟前
03 嵌入式操作系统 | 常用命令Ⅰ:文件、查找与压缩
linux·ubuntu·文件管理·命令行·压缩解压
事圆则缓16 小时前
Ubuntu 安装与配置 Samba 服务器
linux·服务器·ubuntu
乌恩大侠17 小时前
【Sionna】docker build ubuntu cuda
ubuntu·docker·容器·spark·o-ru·ai-ran
Zucker n21 小时前
Ubuntu24.04结合ollama本地使用Hermes
linux·ubuntu
冰水不凉1 天前
CodeX 在 Ubuntu 下 vscode 插件的 bug 问题
vscode·ubuntu·bug
bwz999@88.com1 天前
Ubuntu Server 24.04 设置中文
linux·运维·ubuntu
fly-971 天前
Ubuntu FTP/SFTP 报错:找不到匹配的 hostkey 算法 完整解决
linux·ubuntu
Linux-lucky2 天前
36-Linux学习之旅之MySQL主从复制
linux·运维·学习·mysql·ubuntu
承渊政道2 天前
星空组网真实体验:Mac远程访问Ubuntu,SSH与HTTP全流程验证
ubuntu·http·macos·ssh·服务器管理·星空组网
heqingchun162 天前
Ubuntu 22.04 交叉编译 RK3568 MPP + FFmpeg 完整指南
linux·ubuntu·ffmpeg