Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3【技术分享】国内开发加速方法合集 #3

Open
brandonxiang opened this issue Jun 3, 2017 · 0 comments
Open

3【技术分享】国内开发加速方法合集 #3

brandonxiang opened this issue Jun 3, 2017 · 0 comments

Comments

@brandonxiang
Copy link
Member

brandonxiang commented Jun 3, 2017

由于国内GFW的限制,作为开发者,不得不养成加速安装的良好习惯。

Ubuntu apt-get

cd /etc/apt
sudo cp sources.list sources.list.backup

添加资源,我信阿里云。

sudo vi /etc/apt/sources.list

deb https://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
##测试版源
deb https://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
# 源码
deb-src https://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
##测试版源
deb-src https://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
# Canonical 合作伙伴和附加
deb https://archive.canonical.com/ubuntu/ xenial partner
deb https://extras.ubuntu.com/ubuntu/ xenial main

额外参考安装Ubuntu 16.04后要做的事

brew Mac

参考Homebrew有比较快的源(mirror)

export HOMEBREW_BOTTLE_DOMAIN=https://7xkcej.dl1.z0.glb.clouddn.com

Github Clone

参考github加速方法

Ubuntu 修改hosts映射(/etc/hosts)
185.31.16.184 github.global.ssl.fastly.net

pip python

python 加速方法
清华: https://pypi.tuna.tsinghua.edu.cn/simple
豆瓣: https://pypi.douban.com/simple/
阿里: https://mirrors.aliyun.com/pypi/simple/

方法一:临时换源

在安装同时,你可以多输入两个参数。

sudo pip install scrapy -i https://pypi.douban.com/simple --trusted-host pypi.douban.com

方法二:永久换源

配置文件~/.pip/pip.conf :

[global]
index-url = https://pypi.douban.com/simple/
[install]
trusted-host = https://pypi.douban.com/simple/

最终解决方案

使用我写的换源库--brandonxiang/psm
参考Python 笔记九:打造pypi换源加速神器

npm nodejs

最终解决方案

使用换源库Pana/nrm

参考 phantomjs 下载镜像 PHANTOMJS_CDNURL,同理也可以为很多node.js构建工具的库进行提速。在你的`npm install

registry=https://registry.npm.taobao.org 
sass_binary_site=https://npm.taobao.org/mirrors/node-sass
phantomjs_cdnurl=https://npm.taobao.org/mirrors/phantomjs
ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant