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

相关推荐
weixin_3077791311 分钟前
AWS EMR上的Spark日志实时搜索关键指标网页呈现的设计和实现
大数据·python·spark·云计算·aws
前端达人36 分钟前
「AI学习笔记」深度学习进化史:从神经网络到“黑箱技术”(三)
人工智能·笔记·深度学习·神经网络·学习
wdxylb3 小时前
GIt使用笔记大全
笔记·git·elasticsearch
一只码代码的章鱼3 小时前
计算机网络 应用层 笔记1(C/S模型,P2P模型,FTP协议)
笔记·计算机网络
霸王蟹4 小时前
el-table组件样式如何二次修改?
前端·javascript·vue.js·笔记·学习·前端框架
haidizym4 小时前
(笔记+作业)书生大模型实战营春节卷王班---L1G3000 浦语提示词工程实践
笔记
字节全栈_kYu4 小时前
FastDFS实用笔记 (Docker 搭建环境 + 整合 SpringBoot)
spring boot·笔记·docker
憨猪在度假4 小时前
Cmake学习笔记
c++·笔记·学习
学游戏开发的5 小时前
UE学习日志#19 C++笔记#5 基础复习5 引用1
c++·笔记·学习·游戏引擎·unreal engine
__雨夜星辰__10 小时前
Linux 学习笔记__Day2
linux·服务器·笔记·学习·centos 7