国内镜像源配置

    Operation OS

    deepin 配置阿里源

    sudo vim /etc/apt/sources.list

    #阿里稳定源:
    deb [by-hash=force] http://mirrors.aliyun.com/deepin lion main contrib non-free
    #阿里不稳定源:
    deb [by-hash=force] http://mirrors.aliyun.com/deepin panda main contrib non-free
    

    Ubuntu

    Ubuntu,是一款基于Debian Linux的以桌面应用为主的操作系统,内容涵盖文字处理、电子邮件、软件开发工具和Web服务等,可供用户免费下载、使用和分享。

    下载地址: https://mirrors.aliyun.com/ubuntu/

    相关仓库
    Ubuntu安装源(ubuntu-releases): https://developer.aliyun.com/mirror/ubuntu-releases
    Ubuntu ARM源(ubuntu-ports): https://developer.aliyun.com/mirror/ubuntu-ports
    Ubuntu过期源(oldubuntu-releases): https://developer.aliyun.com/mirror/oldubuntu-releases
    Ubuntu其他架构安装镜像(ubuntu-cdimage): https://developer.aliyun.com/mirror/ubuntu-cdimage

    Ubuntu 22.04 ARM 镜像源

    清华源

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

    apt 配置代理

    sudo apt-get -o Acquire::http::proxy="socks5h://127.0.0.1:1080/" update

    NPM

    npm 配置官方源

    npm config set registry https://registry.npmjs.org/

    npm 配置淘宝源

    npm set registry https://registry.npm.taobao.org

    npm 配置腾讯源

    npm config set registry http://mirrors.cloud.tencent.com/npm/

    yarn 配置源

    yarn config set registry https://registry.npmmirror.com/
    yarn config set registry http://mirrors.cloud.tencent.com/npm/

    pip

    pip 配置清华源

    pypi 镜像每 5 分钟同步一次。

    临时使用

    pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package

    注意,simple 不能少, 是 https 而不是 http

    设为默认

    升级 pip 到最新的版本 (>=10.0.0) 后进行配置:

    pip3 install pip -U

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

    如果您到 pip 默认源的网络连接较差,临时使用本镜像站来升级 pip:

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

    Yarn

    Git标签

    如果你在Git仓库中运行yarn version,Git标签默认会在格式之后创建v0.0.0。

    您可以使用yarn config set自定义创建的git标记或禁用此行为。

    要更改git标签的前缀,您可以使用version-tag-prefix:

    yarn config set version-tag-prefix "v"
    

    或者,您可以使用version-git-message 其中%s版本字符串来更改git消息

    yarn config set version-git-message "v%s"
    

    您还可以使用version-sign-git-tag以下功能开启或关闭签署git标签:

    yarn config set version-sign-git-tag false
    

    您甚至可以完全使用version-git-tag启用或禁用git标记行为:

    yarn config set version-git-tag false
    

    Github

    Github国内加速克隆及下载
    fastgit.org
    https://doc.fastgit.org/

    gitclone.com
    https://gitclone.com/

    gitee
    https://gitee.com/mirrors

    cnpmjs.org
    https://github.com.cnpmjs.org/

    克隆加速

    #原地址
    git clone https://github.com/kubernetes/kubernetes.git

    #改为
    git clone https://github.com.cnpmjs.org/kubernetes/kubernetes.git

    #或者
    git clone https://hub.fastgit.org/kubernetes/kubernetes.git

    #或者
    git clone https://gitclone.com/github.com/kubernetes/kubernetes.git

    release下载加速

    #原地址
    wget https://github.com/goharbor/harbor/releases/download/v2.0.2/harbor-offline-installer-v2.0.2.tgz

    #改为
    wget https://hub.fastgit.org/goharbor/harbor/releases/download/v2.0.2/harbor-offline-installer-v2.0.2.tgz

    #免替换方法

    git config --global url."https://hub.fastgit.org".insteadOf https://github.com

    #测试
    git clone https://github.com/kubernetes/kubernetes.git

    查看git配置信息

    git config --global --list

    取消设置

    git config --global --unset url.https://github.com/.insteadof

    raw文件下载加速

    #原地址:
    wget https://raw.githubusercontent.com/kubernetes/kubernetes/master/README.md

    #替换为
    wget https://raw.staticdn.net/kubernetes/kubernetes/master/README.md

    提供web界面的github资源加速网站:

    GitHub 文件加速:https://gh.api.99988866.xyz/

    Github仓库加速:https://github.zhlh6.cn/

    Github仓库加速:http://toolwa.com/github/

    Docker

    1. 安装/升级Docker客户端

    推荐安装1.10.0以上版本的Docker客户端,参考文档 docker-ce

    2. 配置镜像加速器

    针对Docker客户端版本大于 1.10.0 的用户

    您可以通过修改daemon配置文件/etc/docker/daemon.json来使用加速器

    sudo mkdir -p /etc/docker
    sudo tee /etc/docker/daemon.json <<-'EOF'
    {
      "registry-mirrors": ["https://u13zwy2w.mirror.aliyuncs.com"]
    }
    EOF
    sudo systemctl daemon-reload
    sudo systemctl restart docker
    

    Go

    # 启用 Go Modules 功能
    go env -w GO111MODULE=on
    
    # 配置 GOPROXY 环境变量,以下三选一
    
    # 1. 七牛 CDN
    go env -w  GOPROXY=https://goproxy.cn,direct
    
    # 2. 阿里云
    go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct
    
    # 3. 官方
    go env -w  GOPROXY=https://goproxy.io,direct
    
    ————————————————
    原文作者:Summer
    转自链接:https://learnku.com/go/wikis/38122
    版权声明:著作权归作者所有。商业转载请联系作者获得授权,非商业转载请保留以上作者信息和原文链接。
    

    评论栏