Apt-get, Npm,Composer, Docker 等国内加速镜像大集合

update@2019-05-08
这里有大多数常用的镜像 : https://mirrors.tuna.tsinghua.edu.cn/help/debian/
python pip: https://yq.aliyun.com/articles/652884

常常为了等 Npm install , Composer update 完成, 以为喝杯咖啡回来就完成了, 或者以为晚上下班不关电脑,难道明天回来上班时还没完成! 然后第二天来了 ...

生命岂能浪费在此!

来,我们用国内镜像加速:

Apt-get

一行命令备份apt/sources.list并加入 阿里云和 163 加速镜像:

sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak && \
	echo "deb http://mirrors.aliyun.com/ubuntu/ wily main restricted universe multiverse" >/etc/apt/sources.list && \
	echo "deb http://mirrors.aliyun.com/ubuntu/ wily-security main restricted universe multiverse" >>/etc/apt/sources.list && \
	echo "deb http://mirrors.aliyun.com/ubuntu/ wily-updates main restricted universe multiverse" >>/etc/apt/sources.list && \
	echo "deb http://mirrors.aliyun.com/ubuntu/ wily-proposed main restricted universe multiverse" >>/etc/apt/sources.list && \
	echo "deb http://mirrors.aliyun.com/ubuntu/ wily-backports main restricted universe multiverse" >>/etc/apt/sources.list && \
	echo "deb-src http://mirrors.aliyun.com/ubuntu/ wily main restricted universe multiverse" >>/etc/apt/sources.list && \
	echo "deb-src http://mirrors.aliyun.com/ubuntu/ wily-security main restricted universe multiverse" >>/etc/apt/sources.list && \
	echo "deb-src http://mirrors.aliyun.com/ubuntu/ wily-updates main restricted universe multiverse" >>/etc/apt/sources.list && \
	echo "deb-src http://mirrors.aliyun.com/ubuntu/ wily-proposed main restricted universe multiverse" >>/etc/apt/sources.list && \
	echo "deb-src http://mirrors.aliyun.com/ubuntu/ wily-backports main restricted universe multiverse" >>/etc/apt/sources.list && \
    echo "deb http://mirrors.163.com/debian/ jessie main non-free contrib" >>/etc/apt/sources.list && \
    echo "deb http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list && \
    echo "deb-src http://mirrors.163.com/debian/ jessie main non-free contrib" >>/etc/apt/sources.list && \
    echo "deb-src http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list 

之后看看 apt-get update是不是快多了!

Npm

npm install -g cnpm -registry=https://registry.npm.taobao.org

之后开始用 cnpm install xxx 代替 npm install xxx

Composer

在项目的composer.json加上:

"repositories": {
    "packagist": {
        "type": "composer",
        "url": "https://packagist.phpcomposer.com"
    }
}

之后 composer require , composer update 是不是快多了!

Docker

阿里云提供Docker加速镜像, 但是要账号的:
https://yq.aliyun.com/articles/29941