国内常用镜像源大全(35 个,完整版)
作者实战总结 · 覆盖 Linux / Python / Node / Java / Go / Docker / Conda / Homebrew
目标:一条命令能搞定,绝不让你多敲一行
一、为什么要换国内镜像源?
| 场景 | 不换源 | 换源后 |
|---|---|---|
pip install numpy | 等 10 分钟 | 10 秒搞定 |
apt update | 转圈到天亮 | 秒完 |
docker pull | 卡在 0% | 正常速度 |
核心原因只有一个:
默认源在境外,国内访问慢甚至根本连不上。
二、通用公共镜像站(7 个)
| # | 名称 | 地址 | 特点 | 推荐指数 |
|---|---|---|---|---|
| 1 | 清华大学开源镜像站 | https://mirrors.tuna.tsinghua.edu.cn/ | 覆盖最全,HTTPS + IPv6 | ⭐⭐⭐⭐⭐ |
| 2 | 阿里云开源镜像站 | https://mirrors.aliyun.com/ | 企业级稳定,ECS 内网加速 | ⭐⭐⭐⭐⭐ |
| 3 | 中科大开源镜像站 | https://mirrors.ustc.edu.cn/ | 科研友好 | ⭐⭐⭐⭐⭐ |
| 4 | 腾讯云开源镜像站 | https://mirrors.cloud.tencent.com/ | K8s / Docker 优化 | ⭐⭐⭐⭐ |
| 5 | 华为云开源镜像站 | https://mirrors.huaweicloud.com/ | ARM / openEuler | ⭐⭐⭐⭐ |
| 6 | 网易开源镜像站 | https://mirrors.163.com/ | 老旧系统支持好 | ⭐⭐⭐ |
| 7 | 华中科技大学镜像站 | https://mirror.hust.edu.cn/ | 中部区域优化 | ⭐⭐⭐ |
三、Linux 系统专属镜像源(5 个)
Ubuntu
| # | 镜像站 | 地址 | 推荐版本 |
|---|---|---|---|
| 8 | 清华大学 | https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ | 全版本 |
| 9 | 阿里云 | https://mirrors.aliyun.com/ubuntu/ | 全版本 |
| 10 | 中科大 | https://mirrors.ustc.edu.cn/ubuntu/ | 全版本 |
CentOS / RHEL
| # | 镜像站 | 地址 | 说明 |
|---|---|---|---|
| 11 | 阿里云 CentOS | https://mirrors.aliyun.com/centos/ | CentOS 7/8,ECS 内网优化 |
| 12 | 兰州大学 | https://mirror.lzu.edu.cn/ | 西北区域加速,IPv6 |
Debian
| # | 镜像站 | 地址 | 说明 |
|---|---|---|---|
| 13 | 网易 Debian | https://mirrors.163.com/debian/ | 老旧版本(Debian 9)支持最好 |
| 14 | 清华大学 Debian | https://mirrors.tuna.tsinghua.edu.cn/debian/ | 稳定,全分支覆盖 |
四、Python / pip 镜像源(6 个)
| # | 名称 | 地址 | 稳定性 |
|---|---|---|---|
| 15 | 清华 PyPI | https://pypi.tuna.tsinghua.edu.cn/simple/ | 极稳,首选 |
| 16 | 阿里云 PyPI | https://mirrors.aliyun.com/pypi/simple/ | 企业首选 |
| 17 | 中科大 PyPI | https://pypi.mirrors.ustc.edu.cn/simple/ | 科研场景好 |
| 18 | 腾讯云 PyPI | https://mirrors.cloud.tencent.com/pypi/simple/ | 腾讯云环境快 |
| 19 | 华为云 PyPI | https://repo.huaweicloud.com/repository/pypi/simple/ | 华为云环境快 |
| 20 | 豆瓣 PyPI | https://pypi.douban.com/simple/ | 个人测试用 |
五、Node.js / npm 镜像源(2 个)
| # | 名称 | 地址 | 说明 |
|---|---|---|---|
| 21 | 淘宝 npmmirror | https://registry.npmmirror.com/ | 原 npm.taobao.org 已废弃 |
| 22 | 腾讯云 npm | https://mirrors.cloud.tencent.com/npm/ | 腾讯云环境备选 |
六、Java / Maven 镜像源(2 个)
| # | 名称 | 地址 | 说明 |
|---|---|---|---|
| 23 | 阿里云 Maven | https://maven.aliyun.com/repository/public | Spring Boot 优化 |
| 24 | 华为云 Maven | https://repo.huaweicloud.com/repository/maven/ | ARM 服务器友好 |
七、Go 模块代理(3 个)
| # | 名称 | 地址 | 说明 |
|---|---|---|---|
| 25 | goproxy.cn | https://goproxy.cn | 七牛云出品,最稳定 |
| 26 | goproxy.io | https://goproxy.io | 有时更快 |
| 27 | 阿里云 Go 代理 | https://mirrors.aliyun.com/goproxy/ | ECS 内网加速 |
八、Docker 镜像加速(5 个)
⚠️ 注意:阿里云公共加速器、中科大、清华、网易等旧 Docker 源已于 2024 年前后陆续停止同步。
| # | 名称 | 地址 | 速度 | 稳定性 |
|---|---|---|---|---|
| 28 | 轩辕镜像 | https://docker.xuanyuan.me | ~12 MB/s | 99.2% |
| 29 | 毫秒镜像 | https://docker.1ms.run | ~12 MB/s | 99.5% |
| 30 | DaoCloud | https://docker.m.daocloud.io | ~9 MB/s | 97.6% |
| 31 | AtomHub | https://atomhub.openatom.cn | ~8 MB/s | 100% |
| 32 | 阿里云专属加速 | https://cr.console.aliyun.com/ | 需登录获取专属地址 | 极稳 |
九、Conda / Anaconda 镜像源(2 个)
| # | 名称 | 地址 | 说明 |
|---|---|---|---|
| 33 | 清华 Conda | https://mirrors.tuna.tsinghua.edu.cn/anaconda/ | 首选 |
| 34 | 北京外国语大学 | https://mirrors.bfsu.edu.cn/anaconda/ | 清华抖动时备选 |
十、Homebrew 镜像源(1 个)
| # | 名称 | 地址 | 说明 |
|---|---|---|---|
| 35 | 清华 Homebrew | https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/ | macOS 必备 |
十一、各场景一键换源命令
🐧 Ubuntu / Debian
一键换清华源(Ubuntu 22.04)
bash
sudo sed -i 's|http://archive.ubuntu.com/ubuntu|https://mirrors.tuna.tsinghua.edu.cn/ubuntu|g' /etc/apt/sources.list
sudo apt update自动识别版本(推荐)
bash
ubuntu_codename=$(lsb_release -cs)
sudo tee /etc/apt/sources.list <<EOF
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ ${ubuntu_codename} main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ ${ubuntu_codename}-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ ${ubuntu_codename}-security main restricted universe multiverse
EOF
sudo apt update🐧 CentOS 7
bash
sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
sudo yum makecache🐍 pip
临时使用
bash
pip install 包名 -i https://pypi.tuna.tsinghua.edu.cn/simple/永久生效(Linux / macOS)
bash
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/
pip config set global.trusted-host pypi.tuna.tsinghua.edu.cnWindows PowerShell
powershell
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/恢复官方源
bash
pip config unset global.index-url📦 npm
临时
bash
npm install --registry=https://registry.npmmirror.com永久
bash
npm config set registry https://registry.npmmirror.com使用 nrm
bash
npm install -g nrm
nrm ls
nrm use taobao
nrm test☕ Maven
在 ~/.m2/settings.xml 中添加:
xml
<mirror>
<id>aliyunmaven</id>
<mirrorOf>*</mirrorOf>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>🐹 Go
bash
go env -w GOPROXY=https://goproxy.cn,direct
go env -w GONOSUMCHECK=*
go env GOPROXY🐳 Docker
Linux 一键配置
bash
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<EOF
{
"registry-mirrors": [
"https://docker.xuanyuan.me",
"https://docker.1ms.run",
"https://docker.m.daocloud.io"
]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker验证
bash
docker info | grep -A5 "Registry Mirrors"临时拉取
bash
docker pull docker.xuanyuan.me/library/nginx:latest🐍 Conda
bash
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
conda config --show channels🍺 Homebrew(macOS)
bash
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
echo 'export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"' >> ~/.zshrc
echo 'export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"' >> ~/.zshrc
echo 'export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"' >> ~/.zshrc
source ~/.zshrc
brew update✅ 收藏这篇,新机器部署、新项目搭环境,直接翻出来抄命令。
