This is for programers in China, where people are a bit inconvenient to go online (off the G^F^W).
After changing to the native source, obtaining updates gets faster.
Change Linux Repository Mirror Sources
Sources can be edited in /etc/apt/sources.list
, and you have the following sources (take kali for example) as alternatives to write in this file.
1 | # USTC |
Recently we encounter “E: Some index files failed to download. They have been ignored, or old ones used instead.”.
Change source and delete everything under /var/lib/apt/lists/
, then update.
Deal with problems about public key:
1 | wget -q -O - https://archive.kali.org/archive-key.asc | apt-key add |
Change pip
Sources
Temporary Way
1 | $ pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple # use it for once |
Long-term Way
1 | $ vim ~/.pip/pip.conf # edit or create it |
Or one command to configure
1 | $ pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple |
Some other sources
1 | aliyun: http://mirrors.aliyun.com/pypi/simple/ |
For windows this file is in C:\Users\-YourUserName-\pip\pip.ini
On some latest released Linux
like Ubuntu 20.xx
, the pip
of Python2
(python2-pip
) is not included in the official repo, so we install it by get-pip.py
:
1 | $ sudo apt update |
Change Docker
Registry
Just edit the file
1 | $ vim /etc/docker/daemon.json |
Some others
1 | netease: http://hub-mirror.c.163.com |
Then we do
1 | $ systemctl daemon-reload |
If you run docker on windows, I highly recommend you to use virtualbox to be the host, which is convenient to update, storage expansion and network configuration.
Change gem
Sources
Update first(ruby
developer does)
1 | $ gem update --system # oh this step needs to climb off the G F W |
Then change sources
1 | $ gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/ |
If you are using Gemfile
or Bundler
Edit Gemfile
1 | source 'https://gems.ruby-china.com/' |
or just
1 | $ bundle config mirror.https://rubygems.org https://gems.ruby-china.com |
Change npm
Registry
You can replace npm
with cnpm
, then use cnpm
to install packages.
Install the cnpm
by
1 | $ npm install -g cnpm --registry=https://registry.npm.taobao.org |
Or, change package source can be conducted by
1 | $ npm config set registry https://registry.npm.taobao.org |
Then see the result
1 | $ npm config list |
Change go
Sources
Execute
1 | $ go env -w GO111MODULE=on |
or change envs
1 | $ export GO111MODULE=on |