How to Configure Raspberry Pi with Domestic Mirrors

1. Why Configure Two Mirror Sources

The Raspbian repository contains not only the apt software source but also other code. The apt software source is not located in the root directory of the repository but in the raspbian/ subdirectory.

2. Common Domestic Mirror Sources

//University of Science and Technology of China//Raspberry Pi OS http://mirrors.ustc.edu.cn/raspbian/raspbian/
//Aliyun//Raspberry Pi OS http://mirrors.aliyun.com/raspbian/raspbian/
//Tsinghua University//Raspberry Pi OS http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/
//Huazhong University of Science and Technology//Raspberry Pi OS http://mirrors.hustunique.com/raspbian/raspbian///Arch Linux ARM http://mirrors.hustunique.com/archlinuxarm/
//South China Agricultural University (for South China users)//Raspberry Pi OS http://mirrors.scau.edu.cn/raspbian/
//Dalian Neusoft Information College Source (for Northern users)//Raspberry Pi OS http://mirrors.neusoft.edu.cn/raspbian/raspbian/
//Chongqing University Source (for Central and Western users)//Raspberry Pi OS http://mirrors.cqu.edu.cn/Raspbian/raspbian/

3. Backup Two Mirror Sources

Note: It is best to add the date

sudo cp /etc/apt/sources.list /etc/apt/sources.list.20240116.baksudo cp /etc/apt/sources.list.d/raspi.list /etc/apt/sources.list.d/raspi.list.20240116.bak
4. Replace Sources
vim /etc/apt/sources.list
The following content replaces for the bookworm system:
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ bookworm main non-free contribdeb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ bookworm main non-free contrib
The following content replaces for the bullseye system:
deb http://mirrors.sysu.edu.cn/raspbian/raspbian/ bullseye main contrib non-freedeb-src http://mirrors.sysu.edu.cn/raspbian/raspbian/ bullseye main contrib non-free
The following content replaces for the buster system:
deb http://mirrors.sysu.edu.cn/raspbian/raspbian/ buster main contrib non-freedeb-src http://mirrors.sysu.edu.cn/raspbian/raspbian/ buster main contrib non-free
The following content replaces for the stretch system:
deb http://mirrors.sysu.edu.cn/raspbian/raspbian/ stretch main contrib non-freedeb-src http://mirrors.sysu.edu.cn/raspbian/raspbian/ stretch main contrib non-free
The following content replaces for the jessie system:
deb http://mirrors.sysu.edu.cn/raspbian/raspbian/ jessie main contrib non-freedeb-src http://mirrors.sysu.edu.cn/raspbian/raspbian/ jessie main contrib non-free
If you do not know the system version, the simplest way is to check the system label:

How to Configure Raspberry Pi with Domestic Mirrors

5. Replace System Sources

vim  /etc/apt/sources.list.d/raspi.list 
Comment out the original content and append the replacement;
The systems of bookworm, bullseye, buster, stretch, and jessie versions can be modified according to the previous rules for modifying software sources, which will not be repeated here.
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ bookworm main non-free contrib# Uncomment line below then 'apt-get update' to enable 'apt-get source'#deb-src http://archive.raspberrypi.org/debian/ buster main ui

6. Update Sources

#Update software source list
sudo apt-get update
#Update software version (optional)
sudo apt-get upgradesudo apt-get dist-upgrade

(Note: Some content is sourced from the open-source community, thanks to the teachers of the open-source community!)

Leave a Comment

×