开源加速镜像


分享直接可用,质量好,速度快的包管理器镜像,和一些其他常用软件,系统镜像的国内镜像。

目录

Package-Mirror

以往工作中经历过建设企业内部私服的经历,私服的建设离不开国内一些优秀的镜像代理,这里记录下来,以供大家参考。

注意:假如所有的镜像都已经被本地 nexus 私服代理,那么对应的地址为nexus.eryajf.net/repository/***/。(这只是个域名示例,不代表实际可用!)

Go

Configuration

如果 go 版本用的go1.11或者go1.12,需进行如下配置:

export GO111MODULE=on
export GOPROXY="http://nexus.eryajf.net/repository/go/"

如果使用 go1.13以上的版本则可以用如下配置:

export GOPROXY="http://nexus.eryajf.net/repository/go/"
GONOPROXY="gitlab.eryajf.net"
GONOSUMDB="gitlab.eryajf.net"
GOPRIVATE="gitlab.eryajf.net"
GOSUMDB="sum.golang.google.cn"

关于如上两个版本配置差异,以及配置参数详解可参考:https://wiki.eryajf.net/pages/4941.html

Mirrors

其中GOSUMDB在国内可用的两个镜像分别如下:

Npm

Configuration

配置npm代理,需进行如下配置:

# npm配置
echo 'registry=http://nexus.eryajf.net/repository/npm' > ~/.npmrc
# 查看
npm config get registry
http://nexus.eryajf.net/repository/npm

# yarn配置
echo 'registry "http://nexus.eryajf.net/repository/npm"' > ~/.yarnrc
# 查看
yarn config get registry
http://nexus.eryajf.net/repository/npm

Mirrors

Pip

Configuration

配置Python代理,需进行如下配置:

mkdir ~/.pip

cat > ~/.pip/pip.conf << EOF
[global]
timeout = 60
trusted-host =  nexus.eryajf.net
index-url = http://nexus.eryajf.net/repository/pypi/simple
EOF

注意:通常在配置文件后边,我们会添加一个simple

Mirrors

目前代理外部私仓有:

Composer

Composer 是 PHP 的一个依赖管理工具,需要 PHP 5.3.2 以上才能运行。

Configuration

配置PHP代理,需进行如下配置:

  • 全局配置(推荐)

    • 所有项目都会使用该镜像地址:

      composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
    • 取消配置:

      composer config -g --unset repos.packagist
  • 项目配置

    • 仅修改当前工程配置,仅当前工程可使用该镜像地址:

      composer config repo.packagist composer https://mirrors.aliyun.com/composer/
    • 取消配置:

      composer config --unset repos.packagist

参考:https://developer.aliyun.com/composer

Mirrors

目前代理外部私仓有:

Rubygems

RubyGems 是 Ruby 的一个包管理器,它提供一个分发 Ruby 程序和库的标准格式,还提供一个管理程序包安装的工具。

Configuration

配置Ruby代理,需进行如下配置:

# 首先,查看当前源:
gem sources -l
*** CURRENT SOURCES ***
https://rubygems.org/


# 接着,移除 https://rubygems.org/,并添加国内下载源 https://gems.ruby-china.com/。
gem sources --remove https://rubygems.org/
gem sources -a https://gems.ruby-china.com/
gem sources -l
*** CURRENT SOURCES ***

https://gems.ruby-china.com/

# 请确保只有 gems.ruby-china.com
gem install rails

参考:https://www.runoob.com/ruby/ruby-rubygems.html

Mirrors

目前代理外部私仓有:

Maven

Configuration

Java 系的工具版本规范如下:

  • JDK:1.8.0_292
  • MVN:3.3.9

配置 Maven 代理,参考配置文件: settings.xml

Mirrors

Yum

Configuration

如果CentOS服务器要接入私服yum源,则清空本地 /etc/yum.repos.d的内容,添加如下内容:

cat >> /etc/yum.repos.d/nexus.repo << 'EOF'
[nexus]
name=Nexus Repository
baseurl=http://nexus.eryajf.net/repository/yum/$releasever/os/$basearch/
enabled=1
gpgcheck=0

[nexus-local]
name=Nexus Repository
baseurl=http://nexus.eryajf.net/repository/eryajf-yum-local/
enabled=1
gpgcheck=0
EOF

然后执行如下命令:

yum clean all
yum makecache

Mirrors

目前代理外部源:

Remi

Remi repository 是包含最新版本 PHP 和 MySQL 包的 Linux 源,由 Remi 提供维护。

官方地址:https://rpms.remirepo.net/

Configuration

详情参考:https://wiki.eryajf.net/pages/f35986

yum install -y epel-release
yum install -y https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/remi-release-7.rpm

Mirrors

目前代理外部源:

Epel

EPEL 的全称叫 Extra Packages for Enterprise Linux。EPEL 是由 Fedora 社区打造,为 RHEL 及衍生发行版如 CentOS、Scientific Linux 等提供高质量软件包的项目。

官方地址:https://docs.fedoraproject.org/en-US/epel/

Configuration

# 备份
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup

# 下载
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

Mirrors

目前代理外部源:

Homebrew

Configuration

如果你使用了 zsh,那么配置方式如下:

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

参考:Homebrew 替换国内镜像源

Mirrors

cargo

rust 包管理镜像源

Configuration

修改文件~/.cargo/config(没有则新建)

[source.crates-io]
replace-with = 'rsproxy'

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

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

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

Mirrors

还有一些软件,直接通过官方下载比较困难,也整理出方便下载的国内优质镜像。

Docker

Official

Mirrors

Kubernetes

Official

Mirrors

K3s

Official

Mirrors

Minikube

Official

Mirrors

Helm

Official

Mirrors

Harbor

Official

Mirrors

Jenkins

Official

Mirrors

GitLab-ce

Official

Mirrors

GitLab-runner

Official

Mirrors

ElasticSearch

Official

Mirrors

Logstash

Official

Mirrors

Kibana

Official

Mirrors

Filebeat

Official

Mirrors

MySQL

Official

Mirrors

MariaDB

Official

Mirrors

Percona

Official

Mirrors

MongoDB

Official

Mirrors

Redis

Official

Mirrors

PostgreSQL

Official

Mirrors

Golang

Official

Mirrors

Node

Official

Mirrors

Yarn

Official

Mirrors

Python

Official

Mirrors

Rust

Official

Mirrors

Zabbix

Official

Mirrors

Prometheus

Official

Mirrors

Grafana

Official

Mirrors

Pinpoint

Official

Mirrors

Apache

Official

Mirrors

Nginx

Official

Mirrors

OpenResty

Official

Mirrors

Keepalived

Official

Mirrors

Ceph

Official

Mirrors

Influxdata

Official

Mirrors

ClickHouse

Official

Mirrors

Rabbitmq

Official

Mirrors

ETCD

Official

Mirrors

WireShark

Official

Mirrors

Virtualbox

Official

Mirrors

iina

Official

Mirrors

System-Mirror

系统镜像,又大又远,更需要找到好用优秀的国内镜像。

CentOS

尽管 CentOS 不再更新了,但它仍旧并且还将持续是国内企业系统主力军。

可能官方考虑到下载困难的问题,官方也列出了距离使用者更近的镜像列表,可谓贴心。

Official

Mirrors

CentOS-altarch

ARM 架构下的 CentOS 镜像。

Official

Mirrors

Ubuntu

Official

Mirrors

Debian

Official

Mirrors

Deepin

Official

Mirrors

Fedora

Official

Mirrors

Gentoo

Official

Mirrors

kali

Official

Mirrors

Opensuse

Official

Mirrors

Freebsd

Official

Mirrors

GNU

Official

Mirrors

Other-Mirror

Docker-hub

没有整理 Docker-hub 的镜像的原因是,鉴于这种仓库的特殊性,国内也确实没有一家将之全站镜像的,果真如此,倒也并不科学了。

不过关于 Docker-hub 以及 GitHub 的使用,又的确会经常遇到网络方面的问题,因此也一直在留心这方面的解决方案,目前大多是提供加速的方案,算是镜像方案之下的一个折中策略。

Official

其他的镜像仓库不再单独列出。

Mirrors

使用方式:

使用方式都是替换原来镜像的前缀域名即可实现加速效果,比如:

原来地址: eryajf/centos:7.4  # 这个是官方镜像,省略了前边的域名
替换地址: docker.mirrors.sjtug.sjtu.edu.cn/eryajf/centos:7.4

另外,加速通常只是针对某个源站进行的加速,国外对公开放的 docker 仓库并非官方一家,因此这里就以源站的维度进行区分,整理出经过测试可用的加速站。

  • Docker-hub
    • 上海交通大学
      • docker.mirrors.sjtug.sjtu.edu.cn
    • 中科大
      • docker.mirrors.ustc.edu.cn
    • docker proxy
      • dockerproxy.com
  • gcr.io
  • k8s.gcr.io
    • 上海交通大学
      • k8s-gcr-io.mirrors.sjtug.sjtu.edu.cn
    • docker proxy
      • k8s.dockerproxy.com
    • lank8s
      • lank8s.cn
  • ghcr.io
  • quay.io
    • 中科大
      • quay.mirrors.ustc.edu.cn

感谢

在此,对那些提供公共仓库镜像的企业或组织,致以感谢 🫡!

来自开源仓库

Gitee:Thanks-Mirror: 整理记录各个包管理器,系统镜像,以及常用软件的好用镜像,Thanks Mirror。 走过路过,如觉不错,麻烦点个赞 👆🌟

GitHub:GitHub - eryajf/Thanks-Mirror: 整理记录各个包管理器,系统镜像,以及常用软件的好用镜像,Thanks Mirror。 走过路过,如觉不错,麻烦点个赞 👆🌟


文章作者: 张登友
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 张登友 !
  目录