解决ubuntu18.04系统更新的问题

作者:朱金灿

来源:clever101的专栏

  ubuntu18.04已经不受官方支持了,如果要进行更新,会出现以下错误:

bash 复制代码
E: 仓库 "http://mirrors.aliyun.com/ubuntu bionic Release" 没有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
E: 仓库 "http://cn.archive.ubuntu.com/ubuntu bionic-backports Release" 不再含有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
E: 仓库 "http://mirrors.aliyun.com/ubuntu bionic-updates Release" 没有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
E: 仓库 "http://mirrors.aliyun.com/ubuntu bionic-security Release" 没有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
E: 仓库 "http://security.ubuntu.com/ubuntu bionic-security Release" 不再含有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。

  因此要解决这个问题,需要更换系统更新镜像网站。具体是将 Ubuntu 系统的 /etc/apt/sources.list 文件中的国外更新镜像网站改为国内镜像网站。

  在修改之前,建议先备份原始文件,以防出现问题:

bash 复制代码
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

使用文本编辑器(如gedit、 nano 或 vim)打开 /etc/apt/sources.list 文件:

bash 复制代码
sudo gedit /etc/apt/sources.list

将文件中的默认镜像地址替换为国内镜像地址。注意不要用阿里云镜像源,已经测试过了不行,使用清华大学镜像源,具体是把以下内容

bash 复制代码
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb 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

全部覆盖原来的/etc/apt/sources.list 文件的内容。

相关推荐
明月不会写代码14 小时前
Ubuntu 下 Kitty 终端配置记录
linux·ubuntu
weipt14 小时前
利用wsl给windows电脑上安装一个ubuntu
linux·运维·ubuntu
阿钱真强道15 小时前
01 嵌入式操作系统 | 课程导论与虚拟机安装 Ubuntu
linux·ubuntu·嵌入式·虚拟机
IT菜鸟程17 小时前
Ubuntu 下 apt 版 Nginx 升级为源码编译版本完整操作指南(1.24.0 → 1.30.4 实战)
linux·nginx·ubuntu
Mr-Apple18 小时前
系统找不到指定的文件-CreateInstance/CreateVm/HCS/ERROR_FILE_NOT_FOUND
linux·windows·ubuntu·wsl
自律最差的编程狗20 小时前
Ubuntu下Docker部署Ollama 轻量模型
linux·ubuntu·docker
阿钱真强道1 天前
04 嵌入式操作系统 | 常用命令Ⅱ:用户权限、进程与网络
linux·ubuntu·进程管理·用户权限·网络排查
阿钱真强道1 天前
03 嵌入式操作系统 | 常用命令Ⅰ:文件、查找与压缩
linux·ubuntu·文件管理·命令行·压缩解压
事圆则缓2 天前
Ubuntu 安装与配置 Samba 服务器
linux·服务器·ubuntu
乌恩大侠2 天前
【Sionna】docker build ubuntu cuda
ubuntu·docker·容器·spark·o-ru·ai-ran