理 理悟万池
`⌘K`

全部工具

CHEATSHEET · MIRRORS

# 国内镜像仓库速查

覆盖 Linux 包管理、Homebrew、Node/Python/Rust/Go/Java/PHP/Ruby、Docker/K8s、GitHub 加速、CDN：每条都给出 URL + 一键可复制的设置命令或配置文件片段。

Ubuntu apt 镜像 Linux 包管理阿里云
`https://mirrors.aliyun.com/ubuntu/`

    # 备份原 sources.list
    sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

    # Ubuntu 22.04 (jammy) 示例，其他版本将 jammy 替换为对应代号
    sudo tee /etc/apt/sources.list <<'EOF'
    deb https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
    deb https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
    deb https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
    deb https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
    EOF

    sudo apt update

📝 将 jammy 替换为你的发行代号：focal/jammy/noble；24.04+ 推荐 noble。

Ubuntu apt 镜像 Linux 包管理清华 TUNA
`https://mirrors.tuna.tsinghua.edu.cn/ubuntu/`

    sudo sed -i 's@//.*archive.ubuntu.com@//mirrors.tuna.tsinghua.edu.cn@g; s@//.*security.ubuntu.com@//mirrors.tuna.tsinghua.edu.cn@g' /etc/apt/sources.list
    sudo apt update

Debian apt 镜像 Linux 包管理阿里云
`https://mirrors.aliyun.com/debian/`

    sudo tee /etc/apt/sources.list <<'EOF'
    deb https://mirrors.aliyun.com/debian/ bookworm main contrib non-free non-free-firmware
    deb https://mirrors.aliyun.com/debian-security/ bookworm-security main contrib non-free non-free-firmware
    deb https://mirrors.aliyun.com/debian/ bookworm-updates main contrib non-free non-free-firmware
    EOF
    sudo apt update

📝 bookworm = Debian 12；trixie = Debian 13。

CentOS / RHEL yum Linux 包管理阿里云
`https://mirrors.aliyun.com/repo/`

    # CentOS 7
    sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
    sudo yum makecache

    # Rocky Linux 9 / Alma 9
    sudo sed -e 's|^mirrorlist=|#mirrorlist=|g' \
      -e 's|^#baseurl=http://dl.rockylinux.org/\$contentdir|baseurl=https://mirrors.aliyun.com/rockylinux|g' \
      -i.bak /etc/yum.repos.d/rocky-*.repo
    sudo dnf makecache

Alpine apk Linux 包管理阿里云
`https://mirrors.aliyun.com/alpine/`

    sudo sed -i 's|dl-cdn.alpinelinux.org|mirrors.aliyun.com|g' /etc/apk/repositories
    sudo apk update

📝 Dockerfile 中：RUN sed -i ... 即可加速容器构建。

Arch Linux pacman Linux 包管理清华 TUNA
`https://mirrors.tuna.tsinghua.edu.cn/archlinux/`

    # 在 /etc/pacman.d/mirrorlist 顶部加入：
    Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
    sudo pacman -Syyu

Homebrew 公式 + bottles macOS Homebrew 清华 TUNA
`https://mirrors.tuna.tsinghua.edu.cn/homebrew/`

    # 替换三大仓库 + bottles 域名（写入 ~/.zshrc 或 ~/.bashrc 永久生效）
    git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
    git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
    git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
    echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zshrc
    echo 'export HOMEBREW_API_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api' >> ~/.zshrc
    source ~/.zshrc
    brew update

📝 Homebrew ≥ 4.0 走 API 拉公式，必须设置 HOMEBREW_API_DOMAIN。

Homebrew 安装脚本 macOS Homebrew 中科大 USTC
`https://mirrors.ustc.edu.cn/brew.git`

    # 一键脚本（中科大维护的中国版 install）
    /bin/bash -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

npm 镜像（npmmirror）Node.js / npm 阿里云 / npmmirror
`https://registry.npmmirror.com`

    # 全局生效
    npm config set registry https://registry.npmmirror.com

    # 或写入 ~/.npmrc
    echo 'registry=https://registry.npmmirror.com' >> ~/.npmrc

    # 仅当前项目（提交进仓库即可团队共享）
    echo 'registry=https://registry.npmmirror.com' > .npmrc

📝 原 cnpmjs.org 已迁移到 npmmirror.com；同时支持 yarn / pnpm。

pnpm 镜像 Node.js / npm 阿里云
`https://registry.npmmirror.com`

    pnpm config set registry https://registry.npmmirror.com
    # 加速二进制（node-gyp、puppeteer、prisma 等）
    pnpm config set node-mirror:release https://npmmirror.com/mirrors/node/
    pnpm config set puppeteer_download_host https://npmmirror.com/mirrors

yarn 镜像 Node.js / npm 阿里云
`https://registry.npmmirror.com`

    yarn config set registry https://registry.npmmirror.com -g
    # yarn berry (v2+)
    yarn config set npmRegistryServer https://registry.npmmirror.com

Node.js 二进制 / nvm Node.js / npm 阿里云
`https://registry.npmmirror.com/-/binary/node/`

    # 写入 ~/.zshrc 或 ~/.bashrc：
    export NVM_NODEJS_ORG_MIRROR=https://npmmirror.com/mirrors/node/
    # 或 nvm 直接指定
    nvm install 20 --mirror=https://npmmirror.com/mirrors/node/

pip / PyPI 镜像 Python / pip 清华 TUNA
`https://pypi.tuna.tsinghua.edu.cn/simple`

    # 永久（写入 ~/.pip/pip.conf 或 %APPDATA%\pip\pip.ini）
    pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
    pip config set global.trusted-host pypi.tuna.tsinghua.edu.cn

    # 一次性
    pip install -i https://pypi.tuna.tsinghua.edu.cn/simple <pkg>

📝 其他可选：阿里 https://mirrors.aliyun.com/pypi/simple/、中科大、腾讯、豆瓣。

pip / PyPI 镜像 Python / pip 阿里云
`https://mirrors.aliyun.com/pypi/simple/`

    pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
    pip config set global.trusted-host mirrors.aliyun.com

Poetry 源 Python / pip 清华 TUNA
`https://pypi.tuna.tsinghua.edu.cn/simple`

    # pyproject.toml 中追加：
    [[tool.poetry.source]]
    name = "tuna"
    url = "https://pypi.tuna.tsinghua.edu.cn/simple"
    priority = "primary"

uv 源（Rust 写的 pip 替代）Python / pip 清华 TUNA
`https://pypi.tuna.tsinghua.edu.cn/simple`

    # 环境变量方式
    export UV_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple

    # 或在 pyproject.toml / uv.toml
    [tool.uv]
    index-url = "https://pypi.tuna.tsinghua.edu.cn/simple"

crates.io 镜像（稀疏索引）Rust / cargo 字节 RsProxy
`https://rsproxy.cn/`

    # 写入 ~/.cargo/config.toml
    [source.crates-io]
    replace-with = "rsproxy-sparse"

    [source.rsproxy]
    registry = "https://rsproxy.cn/crates.io-index"

    [source.rsproxy-sparse]
    registry = "sparse+https://rsproxy.cn/index/"

    [registries.rsproxy]
    index = "https://rsproxy.cn/crates.io-index"

    [net]
    git-fetch-with-cli = true

📝 sparse 协议是 cargo ≥ 1.68 默认；速度比 git 索引快 10x。

crates.io 镜像 Rust / cargo 中科大 USTC
`https://mirrors.ustc.edu.cn/crates.io-index`

    # ~/.cargo/config.toml
    [source.crates-io]
    replace-with = 'ustc'

    [source.ustc]
    registry = "sparse+https://mirrors.ustc.edu.cn/crates.io-index/"

rustup 镜像 Rust / cargo 字节 RsProxy
`https://rsproxy.cn/`

    # 写入 ~/.zshrc / ~/.bashrc 后再执行 rustup-init
    export RUSTUP_DIST_SERVER="https://rsproxy.cn"
    export RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup"
    curl --proto '=https' --tlsv1.2 -sSf https://rsproxy.cn/rustup-init.sh | sh

GOPROXY Go 七牛 / goproxy.cn
`https://goproxy.cn`

    go env -w GO111MODULE=on
    go env -w GOPROXY=https://goproxy.cn,direct
    # 私有仓库不走代理
    go env -w GOPRIVATE=*.corp.example.com,gitlab.com/myorg

📝 阿里：https://mirrors.aliyun.com/goproxy/；字节：https://goproxy.io/cn/。

GOPROXY Go 阿里云
`https://mirrors.aliyun.com/goproxy/`

    go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct

Maven 中央仓库 Java / Maven 阿里云
`https://maven.aliyun.com/repository/public`

    <!-- ~/.m2/settings.xml -->
    <settings>
      <mirrors>
        <mirror>
          <id>aliyunmaven</id>
          <mirrorOf>*</mirrorOf>
          <name>aliyun maven</name>
          <url>https://maven.aliyun.com/repository/public</url>
        </mirror>
      </mirrors>
    </settings>

Maven 中央仓库 Java / Maven 腾讯云
`https://mirrors.cloud.tencent.com/nexus/repository/maven-public/`

    <mirror>
      <id>tencent-cloud</id>
      <mirrorOf>*</mirrorOf>
      <url>https://mirrors.cloud.tencent.com/nexus/repository/maven-public/</url>
    </mirror>

Gradle 仓库 Java / Maven 阿里云
`https://maven.aliyun.com/repository/public`

    // build.gradle.kts 顶部
    repositories {
        maven { url = uri("https://maven.aliyun.com/repository/public") }
        maven { url = uri("https://maven.aliyun.com/repository/google") }
        maven { url = uri("https://maven.aliyun.com/repository/gradle-plugin") }
        mavenCentral()
    }

    // 或者在 ~/.gradle/init.gradle.kts 全局生效
    allprojects {
        repositories {
            maven { url = uri("https://maven.aliyun.com/repository/public") }
        }
    }

Composer 全局镜像 PHP / Composer 阿里云
`https://mirrors.aliyun.com/composer/`

    composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

Composer 全局镜像 PHP / Composer 腾讯云
`https://mirrors.cloud.tencent.com/composer/`

    composer config -g repo.packagist composer https://mirrors.cloud.tencent.com/composer/

RubyGems 镜像 Ruby / Gems RubyChina
`https://gems.ruby-china.com/`

    gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
    gem sources -l
    # Bundler:
    bundle config mirror.https://rubygems.org https://gems.ruby-china.com

Anaconda / conda 镜像 Conda / 数据科学清华 TUNA
`https://mirrors.tuna.tsinghua.edu.cn/anaconda/`

    # 写入 ~/.condarc
    cat > ~/.condarc <<'EOF'
    channels:
      - defaults
    show_channel_urls: true
    default_channels:
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
    custom_channels:
      conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
    EOF
    conda clean -i

Flutter / Pub 镜像 Flutter / Dart 上海交大 SJTUG
`https://mirrors.sjtug.sjtu.edu.cn/dart-pub/`

    # 写入 ~/.zshrc / ~/.bashrc
    export PUB_HOSTED_URL=https://mirrors.sjtug.sjtu.edu.cn/dart-pub
    export FLUTTER_STORAGE_BASE_URL=https://mirrors.sjtug.sjtu.edu.cn/flutter

📝 官方 dev 镜像 https://pub.flutter-io.cn 已废弃，改用社区镜像。

Docker Hub 镜像容器 / Docker 阿里云
`https://<id>.mirror.aliyuncs.com`

    # 登录阿里云 -> 容器镜像服务 -> 镜像加速器 拿到专属 ID
    # 写入 /etc/docker/daemon.json
    sudo mkdir -p /etc/docker
    sudo tee /etc/docker/daemon.json <<'EOF'
    {
      "registry-mirrors": [
        "https://<id>.mirror.aliyuncs.com",
        "https://docker.m.daocloud.io",
        "https://docker.1ms.run"
      ]
    }
    EOF
    sudo systemctl daemon-reload
    sudo systemctl restart docker
    docker info | grep -A2 'Registry Mirrors'

📝 阿里加速器需登录获取专属域名；后两个是公益镜像（可用性会变）。

Docker Hub 公益镜像容器 / Docker DaoCloud / 1ms
`https://docker.m.daocloud.io`

    {
      "registry-mirrors": [
        "https://docker.m.daocloud.io",
        "https://dockerproxy.com",
        "https://docker.1panel.live"
      ]
    }

📝 公益镜像存活率波动大，建议同时配置多个并优先使用云厂商加速器。

gcr.io / k8s.gcr.io 镜像容器 / Docker DaoCloud
`https://m.daocloud.io`

    # 拉取 gcr.io/google-containers/pause 改写为：
    docker pull m.daocloud.io/gcr.io/google-containers/pause:3.9

    # k8s.gcr.io / registry.k8s.io 同理
    docker pull m.daocloud.io/registry.k8s.io/kube-apiserver:v1.30.0

kubectl / k8s 二进制 Kubernetes / Helm 阿里云
`https://mirrors.aliyun.com/kubernetes/`

    # CentOS / RHEL
    sudo tee /etc/yum.repos.d/kubernetes.repo <<'EOF'
    [kubernetes]
    name=Kubernetes
    baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
    enabled=1
    gpgcheck=0
    EOF
    sudo yum install -y kubectl kubeadm kubelet

Helm chart 仓库 Kubernetes / Helm 微软 / 阿里云
`https://mirror.azure.cn/kubernetes/charts/`

    # stable / incubator
    helm repo add stable https://mirror.azure.cn/kubernetes/charts/
    helm repo add aliyun https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
    helm repo update

GitHub Raw / Release 加速 Git / GitHub ghproxy 类公益站点
`https://ghfast.top`

    # 拉取 release / raw 文件，前缀加上代理域名：
    curl -L https://ghfast.top/https://github.com/<user>/<repo>/releases/download/v1/x.tar.gz -o x.tar.gz

    # git clone 也可走前缀
    git clone https://ghfast.top/https://github.com/<user>/<repo>.git

📝 同类站点：gh-proxy.com、ghps.cc、kkgithub.com、gh.api.99988866.xyz；存活率会变，建议测试后再用。

GitHub 镜像（kkgithub）Git / GitHub help.kkgithub.com
`https://kkgithub.com`

    # 把 github.com 替换为 kkgithub.com 可以浏览 / clone
    git clone https://kkgithub.com/<user>/<repo>.git

    # 让 git 永久代理（可选）
    git config --global url."https://kkgithub.com/".insteadOf "https://github.com/"

CDN：cdnjs / unpkg / jsdelivr CDN / JS 多家公益
`https://cdn.jsdelivr.net`

    <!-- jsDelivr：支持 npm + GitHub -->
    <script src="https://cdn.jsdelivr.net/npm/vue@3"></script>
    <script src="https://cdn.jsdelivr.net/gh/<user>/<repo>@<ver>/dist/x.min.js"></script>

    <!-- unpkg -->
    <script src="https://unpkg.com/vue@3"></script>

    <!-- cdnjs -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/3.4.0/vue.global.min.js"></script>

📝 国内访问推荐 jsdelivr（有腾讯/字节边缘）；备用：cdn.bootcdn.net、cdn.staticfile.org。

BootCDN / Staticfile（国内）CDN / JS 七牛 / 又拍
`https://cdn.bootcdn.net`

    <script src="https://cdn.bootcdn.net/ajax/libs/vue/3.4.0/vue.global.min.js"></script>
    <!-- 或 -->
    <script src="https://cdn.staticfile.org/vue/3.4.0/vue.global.min.js"></script>

共38 / 38 条 · 语义搜索：「换源」「加速」「国内」「阿里」「清华」「字节」自动扩展为对应镜像 token。