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
相关推荐
Better Bench3 小时前
Ubuntu aarch64 (arm64)架构开发板的Linux系统安装拼音输入法
linux·ubuntu·arm64·aarch64·拼音输入法
Jovin Giogic3 小时前
简明教程:记录 Ubuntu系统命令行安装TexLive,配置vscode
linux·vscode·ubuntu·latex·texlive
starvapour5 小时前
基于端口转发部署seafile私人云盘服务器
linux·ubuntu·seafile
Better Bench6 小时前
ubuntu 不同系统架构(aarch64\arm64\x86_64)安装miniconda以及配置pip镜像
linux·ubuntu·pip
HIT_Weston6 小时前
57、【Ubuntu】【Gitlab】拉出内网 Web 服务:Gitlab 配置审视(一)
前端·ubuntu·gitlab
nandycooh6 小时前
Ubuntu22.04.5安装ROS2教程(使用鱼香ROS工具)
ubuntu·ros
皓空揽月6 小时前
Ubuntu 单机安装 Hadoop 3.2.4教程
linux·hadoop·ubuntu
新手村领路人7 小时前
ubuntu24.04 安装后常用配置动态更新
ubuntu
AI大模型学徒7 小时前
Ubuntu_install(一)
linux·运维·ubuntu