Bootstrap

Python、Ubuntu、FreeBSD、docker、Huggingface、github等常用加速镜像

python安装

python安装包下载

华为镜像站点下载python安装包:Index of python-local/3.12.9

清华源下载Miniconda软件包:Index of /anaconda/miniconda/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror

pip设置清华加速镜像

第一种是临时使用,每次使用都需要在pip命令后加入-i参数,如:

pip3 install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple


第二种,使用pip config set global.index-url 存入配置

pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

加速镜像

python pip用清华源:https://pypi.tuna.tsinghua.edu.cn/simple

Ubuntu apt加速

修改/etc/apt/sources.list文件,

ubuntu22.04:

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
# deb-src 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-src 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-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse

# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse

ubuntu24.04

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse

# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
deb http://security.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-proposed main restricted universe multiverse

 FreeBSD 加速镜像

PKG加速

创建 /usr/local/etc/pkg/repos/FreeBSD.conf 覆盖配置,文件内容如下:

FreeBSD: {
  url: "http://mirrors.ustc.edu.cn/freebsd-pkg/${ABI}/quarterly",
  mirror_type: "none",
}

Ports加速

在 /etc/make.conf 中添加以下内容(如果文件不存在,则新建之):

MASTER_SITE_OVERRIDE?=http://mirrors.ustc.edu.cn/freebsd-ports/distfiles/${DIST_SUBDIR}/

 

docker加速镜像

保存文件到/etc/docker/daemon.json

{
  "registry-mirrors": ["https://docker.registry.cyou",
"https://docker-cf.registry.cyou",
"https://dockercf.jsdelivr.fyi",
"https://docker.jsdelivr.fyi",
"https://dockertest.jsdelivr.fyi",
"https://mirror.aliyuncs.com",
"https://dockerproxy.com",
"https://mirror.baidubce.com",
"https://docker.m.daocloud.io",
"https://docker.nju.edu.cn",
"https://docker.mirrors.sjtug.sjtu.edu.cn",
"https://docker.mirrors.ustc.edu.cn",
"https://mirror.iscas.ac.cn",
"https://docker.rainbond.cc"]
}

重启docker命令:

systemctl daemon-reload

systemctl restart docker

或者使用

service docker restart

huggingface加速镜像

Linux下

export HF_ENDPOINT=https://hf-mirror.com

Windows下

set HF_ENDPOINT=https://hf-mirror.com

github加速

使用https://kkgithub.com/ 和https://githubfast.com/ 

https://githubfast.com/ 速度快,但是不支持web浏览,只支持git下载。

https://kkgithub.com/ 支持下载和浏览。

在软件中使用一劳永逸的办法:

在个人用户目录下,编辑.gitconfig文件,加入:

[url "https://githubfast.com/"]
  insteadOf = https://github.com/

然后git clone的时候就会自动到镜像站https://githubfast.com/去下载了,亲测有效!

Mac brew安装软件镜像加速

在.bash_profile文件中加入:

export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles"

# brew4.x API加速
export HOMEBREW_API_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles/api"

然后source一下:

source .bash_profile

再来用brew来安装软件,速度快了很多! 

 Espressif 乐鑫ESP 32下载服务器加速

在安装工具时优先选择 Espressif 下载服务器,请在运行 install.sh 时使用以下命令:

cd ~/esp/esp-idf
export IDF_GITHUB_ASSETS="dl.espressif.cn/github_assets"
./install.sh

也就是国内用户使用国内的下载服务器IDF_GITHUB_ASSETS="dl.espressif.cn/github_assets,以加快下载速度。

;