0

0

更新Ubuntu软件源

星夢妙者

星夢妙者

发布时间:2025-07-18 11:36:15

|

968人浏览过

|

来源于php中文网

原创

大家好,欢迎再次相聚,我是你们的朋友全栈君。

Ubuntu软件源的原始配置文件路径是/etc/apt/sources.list,其内容如下:

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to# newer versions of the distribution.deb http://archive.ubuntu.com/ubuntu/ focal main restricted# deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted## Major bug fix updates produced after the final release of the## distribution.deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted# deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu## team. Also, please note that software in universe WILL NOT receive any## review or updates from the Ubuntu security team.deb http://archive.ubuntu.com/ubuntu/ focal universe# deb-src http://archive.ubuntu.com/ubuntu/ focal universedeb http://archive.ubuntu.com/ubuntu/ focal-updates universe# deb-src http://archive.ubuntu.com/ubuntu/ focal-updates universe## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu## team, and may not be under a free licence. Please satisfy yourself as to## your rights to use the software. Also, please note that software in## multiverse WILL NOT receive any review or updates from the Ubuntu## security team.deb http://archive.ubuntu.com/ubuntu/ focal multiverse# deb-src http://archive.ubuntu.com/ubuntu/ focal multiversedeb http://archive.ubuntu.com/ubuntu/ focal-updates multiverse# deb-src http://archive.ubuntu.com/ubuntu/ focal-updates multiverse## N.B. software from this repository may not have been tested as## extensively as that contained in the main release, although it includes## newer versions of some applications which may provide useful features.## Also, please note that software in backports WILL NOT receive any review## or updates from the Ubuntu security team.deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse# deb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse## Uncomment the following two lines to add software from Canonical's## 'partner' repository.## This software is not part of Ubuntu, but is offered by Canonical and the## respective vendors as a service to Ubuntu users.# deb http://archive.canonical.com/ubuntu focal partner# deb-src http://archive.canonical.com/ubuntu focal partnerdeb http://security.ubuntu.com/ubuntu/ focal-security main restricted# deb-src http://security.ubuntu.com/ubuntu/ focal-security main restricteddeb http://security.ubuntu.com/ubuntu/ focal-security universe# deb-src http://security.ubuntu.com/ubuntu/ focal-security universedeb http://security.ubuntu.com/ubuntu/ focal-security multiverse# deb-src http://security.ubuntu.com/ubuntu/ focal-security multiverse

要备份原有的软件源,可以使用以下命令:

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

接下来,您需要修改sources.list文件的内容。可以使用以下指令进行编辑:

vi /etc/apt/sources.list

sources.list的内容修改为以下内容:

# 清华源deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricteddeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricteddeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial universedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates universedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial multiversedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates multiversedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiversedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricteddeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security universedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security multiverse# 阿里源deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

修改后的sources.list内容如下:

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricteddeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricteddeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial universedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates universedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial multiversedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates multiversedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiversedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricteddeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security universedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

更新Ubuntu软件源

jQuery水平布局软件版本更新信息时间轴代码
jQuery水平布局软件版本更新信息时间轴代码

jQuery水平布局软件版本更新信息时间轴代码

下载

完成sources.list的更新后,使用以下命令进行更新:

apt-get update

更新的结果显示如下:

# 显示结果Get:1 http://mirrors.aliyun.com/ubuntu bionic InRelease [242 kB]Get:2 http://mirrors.aliyun.com/ubuntu bionic-security InRelease [88.7 kB]Get:3 http://mirrors.aliyun.com/ubuntu bionic-updates InRelease [88.7 kB]Get:4 http://mirrors.aliyun.com/ubuntu bionic-proposed InRelease [242 kB]Get:5 http://mirrors.aliyun.com/ubuntu bionic-backports InRelease [74.6 kB]Get:6 http://mirrors.aliyun.com/ubuntu bionic/multiverse Sources [216 kB]Get:7 http://mirrors.aliyun.com/ubuntu bionic/restricted Sources [5823 B]Get:8 http://mirrors.aliyun.com/ubuntu bionic/main Sources [1063 kB]Get:9 http://mirrors.aliyun.com/ubuntu bionic/universe Sources [11.5 MB]Get:10 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial InRelease [247 kB]Get:11 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates InRelease [99.8 kB]Get:12 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-backports InRelease [97.4 kB]Get:13 http://mirrors.aliyun.com/ubuntu bionic/multiverse amd64 Packages [186 kB]Get:14 http://mirrors.aliyun.com/ubuntu bionic/restricted amd64 Packages [13.5 kB]Get:15 http://mirrors.aliyun.com/ubuntu bionic/main amd64 Packages [1344 kB]Get:16 http://mirrors.aliyun.com/ubuntu bionic/universe amd64 Packages [11.3 MB]Get:17 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security InRelease [99.8 kB]Get:18 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial/main amd64 Packages [1558 kB]Get:19 http://mirrors.aliyun.com/ubuntu bionic-security/multiverse Sources [8784 B]Get:20 http://mirrors.aliyun.com/ubuntu bionic-security/universe Sources [365 kB]Get:21 http://mirrors.aliyun.com/ubuntu bionic-security/main Sources [331 kB]Get:22 http://mirrors.aliyun.com/ubuntu bionic-security/restricted Sources [26.8 kB]Get:23 http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 Packages [2628 kB]Get:24 http://mirrors.aliyun.com/ubuntu bionic-security/multiverse amd64 Packages [21.1 kB]Get:25 http://mirrors.aliyun.com/ubuntu bionic-security/restricted amd64 Packages [829 kB]Get:26 http://mirrors.aliyun.com/ubuntu bionic-security/universe amd64 Packages [1478 kB]Get:27 http://mirrors.aliyun.com/ubuntu bionic-updates/universe Sources [598 kB]Get:28 http://mirrors.aliyun.com/ubuntu bionic-updates/restricted Sources [30.2 kB]Get:29 http://mirrors.aliyun.com/ubuntu bionic-updates/multiverse Sources [18.2 kB]Get:30 http://mirrors.aliyun.com/ubuntu bionic-updates/main Sources [655 kB]Get:31 http://mirrors.aliyun.com/ubuntu bionic-updates/main amd64 Packages [3067 kB]Get:32 http://mirrors.aliyun.com/ubuntu bionic-updates/universe amd64 Packages [2256 kB]Get:33 http://mirrors.aliyun.com/ubuntu bionic-updates/multiverse amd64 Packages [29.0 kB]Get:34 http://mirrors.aliyun.com/ubuntu bionic-updates/restricted amd64 Packages [863 kB]Get:35 http://mirrors.aliyun.com/ubuntu bionic-proposed/multiverse Sources [2053 B]Get:36 http://mirrors.aliyun.com/ubuntu bionic-proposed/main Sources [95.0 kB]Get:37 http://mirrors.aliyun.com/ubuntu bionic-proposed/universe Sources [9634 B]Get:38 http://mirrors.aliyun.com/ubuntu bionic-proposed/restricted Sources [14.4 kB]Get:39 http://mirrors.aliyun.com/ubuntu bionic-proposed/main amd64 Packages [236 kB]Get:40 http://mirrors.aliyun.com/ubuntu bionic-proposed/universe amd64 Packages [20.8 kB]Get:41 http://mirrors.aliyun.com/ubuntu bionic-proposed/restricted amd64 Packages [171 kB]Get:42 http://mirrors.aliyun.com/ubuntu bionic-proposed/multiverse amd64 Packages [2329 B]Get:43 http://mirrors.aliyun.com/ubuntu bionic-backports/main Sources [5862 B]Get:44 http://mirrors.aliyun.com/ubuntu bionic-backports/universe Sources [7129 B]Get:45 http://mirrors.aliyun.com/ubuntu bionic-backports/universe amd64 Packages [12.6 kB]Get:46 http://mirrors.aliyun.com/ubuntu bionic-backports/main amd64 Packages [11.6 kB]Get:47 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial/restricted amd64 Packages [14.1 kB]Get:48 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial/universe amd64 Packages [9827 kB]Get:49 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial/multiverse amd64 Packages [176 kB]Get:50 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates/multiverse amd64 Packages [26.2 kB]Get:51 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates/main amd64 Packages [2560 kB]Get:52 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates/universe amd64 Packages [1544 kB]Get:53 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates/restricted amd64 Packages [16.4 kB]Get:54 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-backports/universe amd64 Packages [12.7 kB]Get:55 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-backports/main amd64 Packages [10.9 kB]Get:56 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security/multiverse amd64 Packages [8820 B]Get:57 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security/main amd64 Packages [2051 kB]Get:58 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security/restricted amd64 Packages [15.9 kB]Get:59 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security/universe amd64 Packages [984 kB]Fetched 59.6 MB in 41s (1446 kB/s)Reading package lists... Done

更新Ubuntu软件源

完成Ubuntu软件源的更换操作。如果您在Docker中更换源(不使用vim),可以使用以下命令:

echo "">/etc/apt/sources.listecho "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted">>/etc/apt/sources.listecho "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted">>/etc/apt/sources.listecho "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial universe">>/etc/apt/sources.listecho "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates universe">>/etc/apt/sources.listecho "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial multiverse">>/etc/apt/sources.listecho "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates multiverse">>/etc/apt/sources.listecho "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse">>/etc/apt/sources.listecho "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted">>/etc/apt/sources.listecho "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security universe">>/etc/apt/sources.listecho "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security multiverse">>/etc/apt/sources.listecho "deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse">>/etc/apt/sources.listecho "deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse">>/etc/apt/sources.listecho "deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse">>/etc/apt/sources.listecho "deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse">>/etc/apt/sources.listecho "deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse">>/etc/apt/sources.listecho "deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse">>/etc/apt/sources.listecho "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse">>/etc/apt/sources.listecho "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse">>/etc/apt/sources.listecho "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse">>/etc/apt/sources.listecho "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse">>/etc/apt/sources.list

发布者:全栈程序员栈长,转载请注明出处:https://www.php.cn/link/a97c37ca1941f04c8822733923adb673

热门AI工具

更多
DeepSeek
DeepSeek

幻方量化公司旗下的开源大模型平台

豆包大模型
豆包大模型

字节跳动自主研发的一系列大型语言模型

通义千问
通义千问

阿里巴巴推出的全能AI助手

腾讯元宝
腾讯元宝

腾讯混元平台推出的AI助手

文心一言
文心一言

文心一言是百度开发的AI聊天机器人,通过对话可以生成各种形式的内容。

讯飞写作
讯飞写作

基于讯飞星火大模型的AI写作工具,可以快速生成新闻稿件、品宣文案、工作总结、心得体会等各种文文稿

即梦AI
即梦AI

一站式AI创作平台,免费AI图片和视频生成。

ChatGPT
ChatGPT

最最强大的AI聊天机器人程序,ChatGPT不单是聊天机器人,还能进行撰写邮件、视频脚本、文案、翻译、代码等任务。

相关专题

更多
堆和栈的区别
堆和栈的区别

堆和栈的区别:1、内存分配方式不同;2、大小不同;3、数据访问方式不同;4、数据的生命周期。本专题为大家提供堆和栈的区别的相关的文章、下载、课程内容,供大家免费下载体验。

434

2023.07.18

堆和栈区别
堆和栈区别

堆(Heap)和栈(Stack)是计算机中两种常见的内存分配机制。它们在内存管理的方式、分配方式以及使用场景上有很大的区别。本文将详细介绍堆和栈的特点、区别以及各自的使用场景。php中文网给大家带来了相关的教程以及文章欢迎大家前来学习阅读。

600

2023.08.10

vim保存退出命令
vim保存退出命令

vim是一个非常强大的文本编辑器,常用于Unix和Linux系统。它是从vi发展而来的,相比vi有许多改进和扩展。在vim中,保存并退出的命令是:wq"wq"这个命令是由两个部分组成的。其中,"w"表示写入文件,将所做的更改保存到磁盘;而"q"表示退出vim编辑器。php中文网给大家带来了相关的教程以及文章,欢迎大家前来学习阅读。

269

2023.08.01

k8s和docker区别
k8s和docker区别

k8s和docker区别有抽象层次不同、管理范围不同、功能不同、应用程序生命周期管理不同、缩放能力不同、高可用性等等区别。本专题为大家提供k8s和docker区别相关的各种文章、以及下载和课程。

280

2023.07.24

docker进入容器的方法有哪些
docker进入容器的方法有哪些

docker进入容器的方法:1. Docker exec;2. Docker attach;3. Docker run --interactive --tty;4. Docker ps -a;5. 使用 Docker Compose。本专题为大家提供相关的文章、下载、课程内容,供大家免费下载体验。

515

2024.04.08

docker容器无法访问外部网络怎么办
docker容器无法访问外部网络怎么办

docker 容器无法访问外部网络的原因和解决方法:配置 nat 端口映射以将容器端口映射到主机端口。根据主机兼容性选择正确的网络驱动(如 host 或 overlay)。允许容器端口通过主机的防火墙。配置容器的正确 dns 服务器。选择正确的容器网络模式。排除主机网络问题,如防火墙或连接问题。本专题为大家提供相关的文章、下载、课程内容,供大家免费下载体验。

416

2024.04.08

docker镜像有什么用
docker镜像有什么用

docker 镜像是预构建的软件组件,用途广泛,包括:应用程序部署:简化部署,提高移植性。本专题为大家提供相关的文章、下载、课程内容,供大家免费下载体验。

452

2024.04.08

Docker容器化部署与DevOps实践
Docker容器化部署与DevOps实践

本专题面向后端与运维开发者,系统讲解 Docker 容器化技术在实际项目中的应用。内容涵盖 Docker 镜像构建、容器运行机制、Docker Compose 多服务编排,以及在 DevOps 流程中的持续集成与持续部署实践。通过真实场景演示,帮助开发者实现应用的快速部署、环境一致性与运维自动化。

38

2026.02.11

JavaScript浏览器渲染机制与前端性能优化实践
JavaScript浏览器渲染机制与前端性能优化实践

本专题围绕 JavaScript 在浏览器中的执行与渲染机制展开,系统讲解 DOM 构建、CSSOM 解析、重排与重绘原理,以及关键渲染路径优化方法。内容涵盖事件循环机制、异步任务调度、资源加载优化、代码拆分与懒加载等性能优化策略。通过真实前端项目案例,帮助开发者理解浏览器底层工作原理,并掌握提升网页加载速度与交互体验的实用技巧。

1

2026.03.06

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
Kotlin 教程
Kotlin 教程

共23课时 | 4.2万人学习

C# 教程
C# 教程

共94课时 | 10.8万人学习

Java 教程
Java 教程

共578课时 | 78万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号