【笔记】apt源设置为阿里云源

目录

  • [1. 备份现有的源列表(可选,但推荐):](#1. 备份现有的源列表(可选,但推荐):)
  • [2. 编辑 `sources.list` 文件:](#2. 编辑 sources.list 文件:)
  • [3. 替换内容为阿里源:](#3. 替换内容为阿里源:)
  • [4. 保存并退出:](#4. 保存并退出:)
  • [5. 更新软件包索引:](#5. 更新软件包索引:)

在 Ubuntu 系统中,将 APT 源设置为阿里云源可以提高软件包更新和下载速度。你可以按照以下步骤操作:

1. 备份现有的源列表(可选,但推荐):

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

2. 编辑 sources.list 文件:

使用以下命令打开 sources.list 文件:

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

3. 替换内容为阿里源:

根据你使用的 Ubuntu 版本,将内容替换为对应的阿里源。以下是常见版本的源地址:

  • Ubuntu 22.04 (Jammy):

    复制代码
    deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
  • Ubuntu 20.04 (Focal):

    复制代码
    deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
  • Ubuntu 18.04 (Bionic):

    复制代码
    deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

4. 保存并退出:

编辑完成后,按 Ctrl + O 保存文件,然后按 Ctrl + X 退出编辑器。

5. 更新软件包索引:

使用以下命令更新软件包索引:

bash 复制代码
sudo apt update

完成以上步骤后,APT 已经使用阿里云源进行软件包的更新和下载。

相关推荐
dessler22 分钟前
代理服务器-LVS的DR模式
linux·运维·云计算
love530love38 分钟前
【PyCharm必会基础】正确移除解释器及虚拟环境(以 Poetry 为例 )
开发语言·ide·windows·笔记·python·pycharm
知之则吱吱1 小时前
亚马逊AWS云服务器高效使用指南:最大限度降低成本的实战策略
服务器·云计算·aws
普宁彭于晏2 小时前
元素水平垂直居中的方法
前端·css·笔记·css3
m0_637146932 小时前
计算机网络基础总结:TCP/IP 模型、TCP vs UDP、DNS 查询过程
笔记·tcp/ip·计算机网络
Lester_11012 小时前
嵌入式学习笔记 - freeRTOS vTaskPlaceOnEventList()函数解析
笔记·学习
moxiaoran57534 小时前
uni-app学习笔记二十三--交互反馈showToast用法
笔记·学习·uni-app
scdifsn11 小时前
动手学深度学习12.7. 参数服务器-笔记&练习(PyTorch)
pytorch·笔记·深度学习·分布式计算·数据并行·参数服务器
jackson凌14 小时前
【Java学习笔记】SringBuffer类(重点)
java·笔记·学习
huangyuchi.15 小时前
【Linux】LInux下第一个程序:进度条
linux·运维·服务器·笔记·进度条·c/c++