Software Development in China

Developing software in China (as I am sometimes doing as I live in Shanghai), can be frustrating. While the internet inside of China is mostly extremely fast, access to services and websites outside of China is almost impossible (because some websites are blocked) or most of the time awfully slow.

The instructions below make use of the https://mirrors.tuna.tsinghua.edu.cn mirror, as that is very fast and serves repositories for much open source software. Check the website to find a list of all mirrored repositories and also some usage instructions (in Chinese, but you can mostly guess the relevant commands).

Update 2020-02-29: There is another mirror from another univerity at http://mirrors.ustc.edu.cn available with almost the same mirrored projects.

Python Package Index (pypi)

The mirror for Python packages is https://pypi.tuna.tsinghua.edu.cn/simple. If you use pip for installing software, specify the mirror like this:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple PACKAGE

For pipenv, you can either set an environment variable

export PIPENV_PYPI_MIRROR=https://pypi.tuna.tsinghua.edu.cn/simple

or you can edit the Pipfile to specify the mirror as the package source:

[[source]]
url = "https://pypi.tuna.thinghua.edu.cn/simple"
verify_ssl = true
name = "pypi"

[packages]
pelican = ""
markdown = ""
...

Ubuntu and Armbian

For Ubuntu, edit /etc/apt/sources.list and replace the repository server name http://archive.ubuntu.com or similar with the mirror name:

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-updates main restricted
[...]

Armbian

As Armbian is based on Ubuntu (yes, there’s also an Armbian Debian variant, but I did not check that), you need to do a similar update as above in /etc/apt/sources.list. Main difference is, that you do not refer to the standard Ubuntu packages for PC, but to the ports repository:

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ eoan main restricted universe multiverse
#deb-src http://ports.ubuntu.com/ eoan main restricted universe multiverse

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ eoan-security main restricted universe multiverse
#deb-src http://ports.ubuntu.com/ eoan-security main restricted universe multiverse

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ eoan-updates main restricted universe multiverse
#deb-src http://ports.ubuntu.com/ eoan-updates main restricted universe multiverse

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ eoan-backports main restricted universe multiverse
#deb-src http://ports.ubuntu.com/ eoan-backports main restricted universe multiverse

Additionally you need to update the packe source for Armbian specific packages in /etc/apt/sources.list.d/armbian.list

deb http://mirrors.tuna.tsinghua.edu.cn/armbian eoan main eoan-utils eoan-desktop
LinkedIn logo mail logo