使用sudo apt-get update报错:

E: 无法下载 http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/dists/xenial/main/binary-amd64/Packages 404 Not Found [IP: 101.6.15.130 80]
E: 部分索引文件下载失败。如果忽略它们,那将转而使用旧的索引文件。
在这里插入图片描述

原因分析:源的问题,更换源

先备份源文件

sudo cp /etc/apt/sources.list  /etc/apt/sources-bak.list 

修改源文件

sudo gedit /etc/apt/sources.list

将内容替换成

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

保存即可,重新运行sudo apt-get update

本教程使用的是ubuntu18.04,其他版本清参考以下网址替换内容
https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐