How to change apt source in Debian

888u

Last update at :2024-07-07,Edit by888u

Why change the source?

  • Everyone has a home, and a home has a wall, and our wall is great. It is too troublesome to climb over the wall, because there are some outside the wall and inside the wall, so here we can switch to the source at home, which is fast!

How to change the apt source, how to change the source

Generally, this method is applicable to all Linux systems. You only need to modify the /etc/apt/sources.list file. Here I will use the Debian system as an example to demonstrate.

Option 1, use the sed command

sed -i "s@http://deb.debian.org@https://mirrors.163.com@g" /etc/apt/sources. list
or
sed -i 's/security-cdn.debian.org/mirrors.aliyun.com' /etc/apt/sources.list

If you use https source, you need to execute apt install apt-transport-https, and then execute apt update to update the source index

Option 2,

This solution is to change it directly in the sources.list file.

Open the sources.list file
sudo nano /etc/apt/sources.list
Or (which editor to use depends on your preference)
sudo vim /etc/apt/sources.list
After modification, just save it. The following are common sources for everyone

Commonly used apt source addresses in mainland China,

163 Mirror source
deb http://mirrors.163.com/debian/ stretch main non-free contrib
deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib
Mirror source of University of Science and Technology of China
deb https://mirrors.ustc.edu.cn/debian/ stretch main non-free contrib
deb https://mirrors.ustc.edu.cn/debian/ stretch-updates main non-free contrib
deb https://mirrors.ustc.edu.cn/debian/ stretch-backports main non-free contrib
deb-src https://mirrors.ustc.edu.cn/debian/ stretch main non-free contrib
deb-src https://mirrors.ustc.edu.cn/debian/ stretch-updates main non-free contrib
deb-src https://mirrors.ustc.edu.cn/debian/ stretch-backports main non-free contrib
deb https://mirrors.ustc.edu.cn/debian-security/ stretch/updates main non-free contrib
deb-src https://mirrors.ustc.edu.cn/debian-security/ stretch/updates main non-free contrib
Alibaba Cloud Image Source
deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb http://mirrors.aliyun.com/debian-security/ stretch/updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian-security/ stretch/updates main non-free contrib
Huawei Cloud Image Source
deb https://mirrors.huaweicloud.com/debian/ stretch main non-free contrib
deb https://mirrors.huaweicloud.com/debian/ stretch-updates main non-free contrib
deb https://mirrors.huaweicloud.com/debian/ stretch-backports main non-free contrib
deb-src https://mirrors.huaweicloud.com/debian/ stretch main non-free contrib
deb-src https://mirrors.huaweicloud.com/debian/ stretch-updates main non-free contrib
deb-src https://mirrors.huaweicloud.com/debian/ stretch-backports main non-free contrib
deb https://mirrors.huaweicloud.com/debian-security/ stretch/updates main non-free contrib
deb-src https://mirrors.huaweicloud.com/debian-security/ stretch/updates main non-free contrib
Tsinghua University Cloud Mirror Source
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch main non-free contrib
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-updates main non-free contrib
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-backports main non-free contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch main non-free contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-updates main non-free contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-backports main non-free contrib
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ stretch/updates main non-free contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ stretch/updates main non-free contrib
Lanzhou University Cloud Mirror Source
deb http://mirror.lzu.edu.cn/debian/ stretch main non-free contrib
deb http://mirror.lzu.edu.cn/debian/ stretch-updates main non-free contrib
deb http://mirror.lzu.edu.cn/debian/ stretch-backports main non-free contrib
deb-src http://mirror.lzu.edu.cn/debian/ stretch main non-free contrib
deb-src http://mirror.lzu.edu.cn/debian/ stretch-updates main non-free contrib
deb-src http://mirror.lzu.edu.cn/debian/ stretch-backports main non-free contrib
deb http://mirror.lzu.edu.cn/debian-security/ stretch/updates main non-free contrib
deb-src http://mirror.lzu.edu.cn/debian-security/ stretch/updates main non-free contrib
Shanghai Jiao Tong University Cloud Mirror Source
deb https://mirror.sjtu.edu.cn/debian/ stretch main non-free contrib
deb https://mirror.sjtu.edu.cn/debian/ stretch-updates main non-free contrib
deb https://mirror.sjtu.edu.cn/debian/ stretch-backports main non-free contrib
deb-src https://mirror.sjtu.edu.cn/debian/ stretch main non-free contrib
deb-src https://mirror.sjtu.edu.cn/debian/ stretch-updates main non-free contrib
deb-src https://mirror.sjtu.edu.cn/debian/ stretch-backports main non-free contrib
deb https://mirror.sjtu.edu.cn/debian-security/ stretch/updates main non-free contrib
deb-src https://mirror.sjtu.edu.cn/debian-security/ stretch/updates main non-free contrib

Recommended site searches: domain name registration official website, free asp.net space, independent ip space, registration query network, cheap domain name registration, cloud host, website registration information query, mainland China dynamic ip agent, domain name query, registration space, < /p>

How to change apt source in Debian

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码