Ubuntu 22.04系统国内镜像源配置指南

备份原配置文件

在修改前需备份原文件,防止配置错误导致系统异常:

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

编辑源文件

使用文本编辑器(如vinano)修改源文件:

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

国内镜像源配置示例

根据需求选择以下任意一种镜像源,替换文件内容后保存。

清华源(Tuna)

plaintext 复制代码
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse

阿里源(Aliyun)

plaintext 复制代码
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

中科大源(USTC)

plaintext 复制代码
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse

网易源(163)

plaintext 复制代码
deb http://mirrors.163.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-backports main restricted universe multiverse

更新软件源

修改完成后运行以下命令使更改生效:

bash 复制代码
sudo apt update

注意事项

  • 版本代号 :确保使用jammy(Ubuntu 22.04),其他版本需替换对应代号(如20.04为focal)。
  • 网络环境:虚拟机需检查网络模式(如VMware的NAT模式),物理机确保网络连通。
  • 协议选择 :部分镜像源支持httphttps,推荐优先使用https协议。
相关推荐
HABuo42 分钟前
【linux线程(三)】生产者消费者模型(条件变量阻塞队列版本、信号量环形队列版本)详细剖析
linux·运维·服务器·c语言·c++·ubuntu·centos
Milu_Jingyu1 小时前
Windows与Ubuntu文件共享详细指南
linux·windows·ubuntu
海兰2 小时前
【实战】HiMarket本地化部署指南
人工智能·ubuntu·架构·银行系统
进击的码力5 小时前
/dev/nume0n1p2导致ubuntu系统无法启动
linux·运维·ubuntu
激昂网络5 小时前
在Ubuntu 24.04上编译T527 Android系统:遇到的几个问题及解决方法
android·linux·ubuntu
嵌入式学不会不改名6 小时前
香橙派环境
linux·ubuntu
酌量8 小时前
nvidia orin agx刷机忘记CUDA runtime,安装torch和cuda
linux·笔记·ubuntu·torch·cuda·agx
藤谷性能9 小时前
Ubuntu 22.04:制作Ubuntu 22.04安装U盘
linux·运维·ubuntu
AzusaFighting9 小时前
llama.cpp CUDA with Gemma4-E4B(Ubuntu 24.04)部署
linux·运维·ubuntu
softshow10269 小时前
在 Ubuntu 下进行磁盘分卷
linux·数据库·ubuntu