解决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 文件的内容。

相关推荐
Warren981 天前
Python自动化测试全栈面试
服务器·网络·数据库·mysql·ubuntu·面试·职场和发展
HIT_Weston1 天前
39、【Ubuntu】【远程开发】拉出内网 Web 服务:构建静态网页(二)
linux·前端·ubuntu
大牙Adela2 天前
在Mac上通过Multipass虚拟机中的Ubuntu系统使用Graphviz工具
c语言·qt·ubuntu·macos·multipass·graphviz
码上上班2 天前
ubuntu 安装ragflow
linux·运维·ubuntu
HIT_Weston2 天前
38、【Ubuntu】【远程开发】拉出内网 Web 服务:构建静态网页(一)
linux·前端·ubuntu
路人甲ing..2 天前
用 Android Studio 自带的模拟 Android Emulator 调试
android·java·ide·ubuntu·kotlin·android studio
q***71852 天前
Java进阶-在Ubuntu上部署SpringBoot应用
java·spring boot·ubuntu
JobDocLS2 天前
Ubuntu 22.04上安装搜狗输入法
linux·运维·ubuntu
序属秋秋秋2 天前
《Linux系统编程之进程基础》【进程切换 + 进程调度】
linux·运维·服务器·c语言·c++·ubuntu·系统编程
艾莉丝努力练剑2 天前
【Linux基础开发工具 (四)】Linux编程基础:深入理解gcc / g++编译与链接原理
linux·运维·服务器·c++·人工智能·ubuntu·centos