阿里云镜像站:https://developer.aliyun.com/mirror
腾讯云镜像站:https://mirrors.cloud.tencent.com
Centos 加速源
# 备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
# Centos 6 Aliyun
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-6.10.repo
# Centos 6 TencentCloud
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos6_base.repo
# Centos 7 Aliyun
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
# Centos 7 TencentCloud
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo
# Centos 8 Aliyun
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
# Centos 8 TencentCloud
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos8_base.repo
# 清理并生成缓存
yum clean all && yum makecache
Debian
Debian GNU/Linux,是一个操作系统及自由软件的发行版,由一群自愿付出时间和精力的用户来维护并更新。它附带了超过 59000 个软件包,这些预先编译好的软件被打包成一种良好的格式以便于用户安装和使用。
下载地址: https://mirrors.aliyun.com/debian/
一般情况下,将/etc/apt/sources.list
文件中Debian默认的软件仓库地址和安全更新仓库地址修改为国内的镜像地址即可,比如将deb.debian.org
和security.debian.org
改为mirrors.xxx.com
,并使用https访问,可使用如下命令:
sed -i "s@http://\(deb\|security\).debian.org@https://mirrors.xxx.com@g" /etc/apt/sources.list
Buster
deb https://mirrors.cloud.tencent.com/debian/ buster main contrib non-free
deb https://mirrors.cloud.tencent.com/debian/ buster-updates main contrib non-free
deb https://mirrors.cloud.tencent.com/debian/ buster-backports main contrib non-free
deb https://mirrors.cloud.tencent.com/debian-security buster/updates main contrib non-free
deb-src https://mirrors.cloud.tencent.com/debian/ buster main contrib non-free
deb-src https://mirrors.cloud.tencent.com/debian/ buster-updates main contrib non-free
deb-src https://mirrors.cloud.tencent.com/debian/ buster-backports main contrib non-free
deb-src https://mirrors.cloud.tencent.com/debian-security buster/updates main contrib non-free
Bullseye
deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
Epel 加速源
EPEL(Extra Packages for Enterprise Linux), 是由Fedora Special Interest Group维护的Enterprise Linux(RHEL、CentOS)中经常用到的包。
# 安装
yum install epel-release -y
# 备份
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
# 腾讯云
wget -O /etc/yum.repos.d/epel.repo http://mirrors.cloud.tencent.com/repo/epel-7.repo
# 阿里云
wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
# 清理并生成缓存
yum clean all && yum makecache
Python
Pypi 加速源
- windows建立
%HOMEPATH%\pip\pip.ini
文件,写入如下内容; - Linux 建立
~/.pip/pip.conf
文件,写入如下内容;
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
[list]
format=columns
[global]
index-url = https://mirrors.cloud.tencent.com/pypi/simple
[install]
trusted-host = mirrors.cloud.tencent.com
[list]
format=columns
临时使用
pip install -i https://mirrors.cloud.tencent.com/pypi/simple <some-package>
设置默认
升级 pip 到最新的版本 (>=10.0.0) 后进行配置:
pip install pip -U
pip config set global.index-url https://mirrors.cloud.tencent.com/pypi/simple
您也可以临时使用本镜像来升级 pip:
pip install -i https://mirrors.cloud.tencent.com/pypi/simple --upgrade pip
pip 常用命令
yum -y install python-pip python-wheel
pip list --format=columns
# 升级
python -m pip install -U pip setuptools
# 如果安装的是for all user的话需要使用如下参数升级,否则可能报错
pip install -U pip setuptools --user
# 若升级后pip报错,可以使用如下命令试试
easy_install pip
# 或者
python -m ensurepip
python -m pip install --upgrade pip
pip search [module]
pip install [module]
# 创建虚拟环境
python3 -m venv /path/to/new/virtual/environment
python3 -m venv c:\path\to\myenv
NodeJS
NPM
# 临时使用
npm --registry https://registry.npmmirror.com install express
# 持久使用
# Aliyun
npm config set registry https://registry.npmmirror.com
# TencentCloud
npm config set registry https://mirrors.cloud.tencent.com/npm/
# 配置后可通过下面方式来验证是否成功
npm config get registry
# 或
npm info express
Docker CE
腾讯云加速源
# CentOS/RHEL
wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo
# 把软件仓库地址替换为
sudo sed -i 's+download.docker.com+mirrors.cloud.tencent.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
# 安装
yum makecache fast
yum install docker-ce
阿里云加速源
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
yum makecache fast
yum install docker-ce
Docker 镜像加速
阿里云:https://cr.console.aliyun.com/#/accelerator
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://hub-mirror.c.163.com", "https://wkumpv63.mirror.aliyuncs.com"]
}
EOF
systemctl daemon-reload
systemctl restart docker
使用docker info命令检查加速设置是否成功
Maven
打开maven的设置文件settings.xml,配置如下repository mirror:
<mirror>
<id>nexus-tencentyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus tencentyun</name>
<url>http://mirrors.cloud.tencent.com/nexus/repository/maven-public/</url>
</mirror>
文章评论