5 篇文章带有标签 “china”

GitHub加速

通过网游加速器

在路径上增加 .cnpmjs.org

正常下载:git clone https://github.com/microsoft/onnxruntime.git

加速下载:git clone https://github.com.cnpmjs.org/microsoft/onnxruntime.git

查找当前位置距离最快的 GitHub IP

运行测速脚本 gh-check

curl -fsSL  https://gist.githubusercontent.com/lilydjwg/93d33ed04547e1b9f7a86b64ef2ed058/raw/134c1971ad95930aaec4cf93c8509f0f4927c03c/gh-check \
    | python3 -

文件 hosts 路径

  • Windows
C:\Windows\System32\drivers\etc\hosts
  • Mac OS X
/etc/hosts
  • Linux
/etc/hosts

修改 hosts 文件

199.232.69.194 github.global.ssl.fastly.net
140.82.112.4 github.com

下载

git clone https://github.com/microsoft/onnxruntime.git

配置pip镜像源

加速 pip 下载安装包的速度。下面使用的是来自于阿里云的镜像源:https://mirrors.aliyun.com/pypi/simple/

国内可用的pip镜像源

https://mirrors.aliyun.com/pypi/simple/
https://pypi.tuna.tsinghua.edu.cn/simple/
http://pypi.douban.com/simple/
https://pypi.mirrors.ustc.edu.cn/simple/
http://pypi.hustunique.com/
http://pypi.sdutlinux.org/

更新pip

# pip install --upgrade pip
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Requirement already up-to-date: pip in /usr/local/lib/python3.6/site-packages (20.2.4)

临时使用pip镜像

# pip install -i https://mirrors.aliyun.com/pypi/simple/ package

列出加载配置的路径和配置信息 # pip confi

配置Kubernetes镜像源

配置 Kubernetes 镜像源

apt-get update && apt-get install -y apt-transport-https
curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add - 
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main
EOF
apt-get update

参考资料

配置Docker镜像源

加速 Docker Hub 镜像拉取速度。

这里以阿里云镜像源:https://75oltije.mirror.aliyuncs.com 为例进行配置。

$ sudo nano /etc/docker/daemon.json
{
  "registry-mirrors": ["https://75oltije.mirror.aliyuncs.com"]
}
## 另一种方法()
cat << EOF >/etc/docker/daemon.json
{
  "registry-mirrors": ["https://75oltije.mirror.aliyuncs.com"]
}
EOF

重启 Docker daemon 服务

$ sudo systemctl restart docker

参考资料

在Ubuntu上配置apt镜像源

在国内使用官方的镜像源安装 Ubuntu 应用非常慢,通常配置国内的镜像源来加快速度,如阿里云。

这里以[阿里云镜像源]为例,替换掉官方源。

使用 http://mirrors.aliyun.com/ubuntu/ 替换 http://cn.archive.ubuntu.com/ubuntu/,需要查看一下文件 /etc/apt/sources.list,要替换的可能是 http://archive.ubuntu.com/ubuntu/

替换配置

sed -i 's/cn.archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list

基于配置的镜像源更新安装包的列表

apt-get update

国内主要的 Ubuntu 镜像源

  • 阿里云 http://mirrors.aliyun.com/ubuntu/
  • 网易 http://mirrors.163.com/ubuntu/
  • 清华大学 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/
  • 中科大 https://mirrors.ustc.edu.cn/ubuntu/