ubuntu apt 更换阿里云源

简介:Ubuntu系统的APT(Advanced Package Tool)是一个包管理器,用于在Ubuntu上安装、卸载和更新软件包。默认情况下,APT会从Ubuntu官方源中下载软件包,但由于网络原因,有时候下载速度较慢。阿里云是国内较为常用的镜像源之一,其提供了Ubuntu官方源的镜像。

历史攻略:

docker:更换镜像源

更换Ubuntu apt阿里云源的步骤:

1、备份原有源

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

2、打开 sources.list 文件

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

3、替换为阿里云源

python 复制代码
# 18.04

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse


# 20.04

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

4、更新源

python 复制代码
sudo apt-get update
相关推荐
赵大仁3 分钟前
在 CentOS 7 上安装 Node.js 20 并升级 GCC、make 和 glibc
linux·运维·服务器·ide·ubuntu·centos·计算机基础
vvw&8 分钟前
Docker Build 命令详解:在 Ubuntu 上构建 Docker 镜像教程
linux·运维·服务器·ubuntu·docker·容器·开源
冷曦_sole34 分钟前
linux-21 目录管理(一)mkdir命令,创建空目录
linux·运维·服务器
最后一个bug36 分钟前
STM32MP1linux根文件系统目录作用
linux·c语言·arm开发·单片机·嵌入式硬件
dessler1 小时前
Docker-Dockerfile讲解(二)
linux·运维·docker
卫生纸不够用1 小时前
子Shell及Shell嵌套模式
linux·bash
world=hello1 小时前
关于科研中使用linux服务器的集锦
linux·服务器
soragui2 小时前
【ChatGPT】OpenAI 如何使用流模式进行回答
linux·运维·游戏
白云coy3 小时前
Redis 安装部署[主从、哨兵、集群](linux版)
linux·redis