【笔记】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 已经使用阿里云源进行软件包的更新和下载。

相关推荐
Dann Hiroaki6 小时前
笔记分享: 哈尔滨工业大学CS31002编译原理——02. 语法分析
笔记·算法
KhalilRuan6 小时前
Unity-MMORPG内容笔记-其三
笔记
kfepiza8 小时前
Debian的`/etc/network/interfaces`的`allow-hotplug`和`auto`对比讲解 笔记250704
linux·服务器·网络·笔记·debian
I'm写代码11 小时前
el-tree树形结构笔记
javascript·vue.js·笔记
Andy杨12 小时前
20250707-4-Kubernetes 集群部署、配置和验证-K8s基本资源概念初_笔记
笔记·容器·kubernetes
UQI-LIUWJ14 小时前
李宏毅LLM笔记: AI Agent
人工智能·笔记
ouliten14 小时前
cuda编程笔记(6)--流
笔记
Love__Tay14 小时前
笔记/云计算基础
笔记·学习·云计算
学术小八14 小时前
第二届云计算与大数据国际学术会议(ICCBD 2025)
大数据·云计算
容器魔方15 小时前
中选名单出炉|18位学生入选开源之夏KubeEdge课题,欢迎加入!
云原生·容器·云计算