为什么要换源?
-
有人就有家,有家就有墙,并且我们的墙是伟大的,翻过墙太费事,因为墙外有的墙内也有,所以这里我们可以换成家里的源,速度快!
怎么更换apt源,换源方式
一般情况下,这个方法适用于所有的Linux系统,只需要修改/etc/apt/sources.list文件,这里我以Debian系统作为例子给大家演示一下。文章源自国外主机测评-https://www.zjcp.org/3588.html
文章源自国外主机测评-https://www.zjcp.org/3588.html
方案一、使用sed命令
sed -i "s@http://deb.debian.org@https://mirrors.163.com@g" /etc/apt/sources.list
或者
sed -i 's/security-cdn.debian.org/mirrors.aliyun.com' /etc/apt/sources.list
如果使用的https源,则需要执行apt install apt-transport-https,再执行apt update更新源索引文章源自国外主机测评-https://www.zjcp.org/3588.html
方案二、
这个方案就是直接在sources.list文件里边改文章源自国外主机测评-https://www.zjcp.org/3588.html
sudo nano /etc/apt/sources.list
或(用哪个编辑器看自己的喜好)
sudo vim /etc/apt/sources.list
常用国内apt源地址、
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
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
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
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
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
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
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