镜像源加速下载
对于一些服务,国内的服务器下载的速度很慢,这时我们可以使用一些镜像源来加速下载。
Docker
0. docker install
- docker.io
sudo apt install docker.io
1. 使用cf Workers自建
https://gist.github.com/y0ngb1n/7e8f16af3242c7815e7ca2f0833d3ea6
cf自建1: https://github.com/yaming116/docker-pull-proxy/blob/main/worker.js
cf自建2: https://github.com/mzzsfy/Dockerfile/blob/main/cf-worker/docker-image.js
cf自建3: https://github.com/ciiiii/cloudflare-docker-proxy/blob/master/src/index.js
cf自建4: https://github.com/lework/cloudflare-workers/blob/master/docker_proxy.js
在Works和Pages填入下面的代码后,需要添加对应的DNS记录(随便填,可以填8.8.8.8)和绑定Works路由(“docker.xxx.xyz/*”与对应Works绑定)。
2. 一些docker镜像源
(不稳定,强烈建议使用cf自建)
1 |
|
3. Linux修改
修改/etc/docker/daemon.json配置文件
1 |
|
4. 群晖修改
4.1 修改注册表方式
对于群晖来说需要依次点击docker->注册表->设置->编辑Docker Hub->勾选启动注册表镜像和信任SSL自我签署证书,在注册表镜像URL里填写更换镜像源的链接。最后重启Docker和DSM(不一定需要),如下图方式。
4.2 命令行或docker-compose附加
也可以使用命令行docker pull,或者使用docker-compose,只需要在image的前面加上镜像前缀即可。
1
2
docker pull docker.m.daocloud.io/linuxserver/emby:latest
image: "docker.m.daocloud.io/linuxserver/emby:latest"
4.3 修改环境变量(不建议)
群晖可以参考以下链接进行尝试修改,修改前请备份对应文件!
https://www.v2ex.com/t/981481#r_14833577
https://post.m.smzdm.com/p/ag82opxd/
其他的地址
gcr.io >>>>> gcr.chenby.cn
quay.io >>>>> quay.chenby.cn
ghcr.io >>>>> ghcr.chenby.cn
docker.io >>>>> docker.chenby.cn
k8s.gcr.io >>>>> k8s.chenby.cn
registry.k8s.io >>>>> k8s.chenby.cn
docker.elastic.co >>>>> elastic.chenby.cn
docker.cloudsmith.io >>>>> cloudsmith.chenby.cn
cr.l5d.io >>>>> l5d.m.daocloud.io
docker.elastic.co >>>>> elastic.m.daocloud.io
docker.io >>>>> docker.m.daocloud.io
gcr.io >>>>> gcr.m.daocloud.io
ghcr.io >>>>> ghcr.m.daocloud.io
k8s.gcr.io >>>>> k8s-gcr.m.daocloud.io
registry.k8s.io >>>>> k8s.m.daocloud.io
mcr.microsoft.com >>>>> mcr.m.daocloud.io
nvcr.io >>>>> nvcr.m.daocloud.io
quay.io >>>>> quay.m.daocloud.io
registry.jujucharms.com >>>>> jujucharms.m.daocloud.io
rocks.canonical.com >>>>> rocks-canonical.m.daocloud.io
Ubuntu/Debian/Centos加速下载
1 |
|
1.Ubuntu
1 |
|
Ubuntu12
1 |
|
14.04 LTS
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse
16.04 LTS
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
18.04 LTS
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
20.04 LTS
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
21.04
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ hirsute main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ hirsute main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ hirsute-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ hirsute-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ hirsute-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ hirsute-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ hirsute-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ hirsute-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ hirsute-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ hirsute-proposed main restricted universe multiverse
21.10
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ impish main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ impish main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ impish-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ impish-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ impish-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ impish-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ impish-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ impish-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ impish-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ impish-proposed main restricted universe multiverse
22.04 LTS
# 默认注释了源码镜像以提高 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 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/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
1 |
|
2.Debian
3.Centos
cmd
临时生效
1 |
|
取消
1 |
|
永久生效
右键【我的电脑 】-> 属性 -> 高级系统设置 -> 高级 -> 环境变量 -> 系统环境变量
变量 | 值 |
---|---|
http_proxy |
http://127.0.0.1:7890 |
https_proxy |
http://127.0.0.1:7890 |
# 账户和密码(如果有的话) | |
http_proxy_user |
username |
http_proxy_pass |
password |
git
参考之前写的
pip
1 |
|
1.临时使用:
可以在使用pip的时候,加上参数-i和镜像地址
1 |
|
2.永久修改
推荐使用
1 |
|
1 |
|
a. Linux
1 |
|
b. Windows
1 |
|
github加速
a. 添加hosts
点击寻找合适的ip,不出意外的话大陆都是红色,将香港、台湾、新加坡的IP加入hosts,应该可行。
b. 使用镜像站
c. 使用steam++、ds、FastGithub
d. 梯子
不介绍
油猴插件加速
Release、Code(ZIP) 文件加速:
使用方法为:前面为代理地址,后面为你想要下载的地址
示例:https://gh.shyi.org/https://github.com/hunshcn/project/archive/master.zip
- https://gh.shyi.org
- https://gh.api.99988866.xyz
- https://gh.gh2233.ml
- https://gh2.yanqishui.work
- https://gh.ddlc.top
以上使用的是cf work,有些地区打不开
- https://ghproxy.com
- https://mirror.ghproxy.com
- https://download.fastgit.org # 需要将github.com替换成download.fastgit.org
Git Clone 加速:
1 |
|
git clone 私有仓库
Clone 私有仓库需要用户在 Personal access tokens 申请 Token 配合使用.
git clone https://user:your_token@ghproxy.com/https://github.com/your_name/your_private_repo
npm
一、
npm换源
1 |
|
npm设置代理
1 |
|
二、
1 |
|
1.使用 cnpm命令行工具代替默认的 npm
1 |
|
2.添加 npm
参数 alias
一个新命令
1 |
|
安装模块
1 |
|
同步模块
1 |
|
其他命令
支持 npm 除了 publish 之外的所有命令
1 |
|
gg
gg 是一个命令行工具,可在 Linux 环境下对任意命令进行一键代理,而无需安装 v2ray 等其他工具。
你只需要在想代理的命令之前添加 gg
即可,例如: gg python -m pip install torch
.
引用与参考:
清华大学开源软件镜像站 | Tsinghua Open Source Mirror
USTC Open Source Software Mirror
Docker更换国内镜像源 - 憨厚的小怪 - 博客园 (cnblogs.com)
群晖docker镜像源更换为阿里云镜像源_MoFalleaves的博客-CSDN博客_群晖docker源
Ubuntu 更换下载源 - 走看看 (zoukankan.com)
修改Ubuntu系统默认软件下载源_达少Rising的博客-CSDN博客_ubuntu更换下载源
https://github.com/DaoCloud/public-image-mirror
https://www.oiox.cn/index.php/archives/405/
https://gist.github.com/y0ngb1n/7e8f16af3242c7815e7ca2f0833d3ea6