Ubuntu 国内源配置方法

Ubuntu 国内源配置方法

方法 1:命令行自动切换

阿里云镜像(推荐):

bash

复制

备份原 sources.list

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

替换为阿里云源

sudo sed -i 's/cn.archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list

sudo sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list

更新

sudo apt update && sudo apt upgrade

方法 2:手动编辑 sources.list

bash

复制

sudo nano /etc/apt/sources.list

内容替换为:

list

复制

阿里云镜像 (Ubuntu 22.04/Jammy)

deb http://mirrors.aliyun.com/ubuntu/ jammy 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-security main restricted universe multiverse

Ubuntu 20.04/Focal 用 focal 替换 jammy

方法 3:其他国内镜像

镜像 地址

阿里云 mirrors.aliyun.com/ubuntu/

腾讯云 mirrors.cloud.tencent.com/ubuntu/

华为云 repo.huaweicloud.com/ubuntu/

网易 mirrors.163.com/ubuntu/

中科大 mirrors.ustc.edu.cn/ubuntu/

验证源速度

bash

复制

测试连接速度

time wget -qO- http://mirrors.aliyun.com/ubuntu/ | head -1

遇到 HTTPS 问题

如果 apt update 报 HTTPS 错误:

bash

复制

sudo apt install apt-transport-https ca-certificates

相关推荐
再__努力1点2 分钟前
一个开源的AI边缘计算平台:一个项目把算能、瑞芯微、x86的NPU全打通了
人工智能·python·课程设计·媒体·流媒体
小oo呆9 分钟前
【学习心得】Python函数参数中的两个特殊分隔符
开发语言·python
SEO_juper21 分钟前
AI 爬虫 robots.txt 检查工具:你的站是不是把 AI 挡在门外了
开发语言·人工智能·爬虫·python·外贸独立站
看我debug27 分钟前
Android 运行时分析工作台 (Demo)。统一管理 Frida 脚本、自动注入(修改运行时代码)、收集结构化结果、生成 JSON 报告。
android·python·pip
染指111028 分钟前
151.Agent-LangGraph-Send发送(Map-Reduce模式)
人工智能·python·langchain·状态模式·agents
OKkankan31 分钟前
python 进阶(三):面向对象进阶——从“会写 class”到设计可维护的后端对象
开发语言·数据结构·python
用户03321266636732 分钟前
Python 办公自动化:用 Python 快速生成精美 PPT 演示文稿
python
打工仔折腾 AI37 分钟前
极空间部署Portainer实战:绕过Socket权限、解决9000端口冲突与固定内网访问
人工智能·后端·python·性能优化
魔都吴所谓40 分钟前
【Python】 多线程 & 多进程&协程 常见题 + 应用场景整理
开发语言·python
Data_Journal1 小时前
如何使用 Python 解析 HTML
python·html