Debian如何更换apt源

主机教程 其他教程 技术教程评论942字数 4788阅读15分57秒阅读模式

为什么要换源?

  • 有人就有家,有家就有墙,并且我们的墙是伟大的,翻过墙太费事,因为墙外有的墙内也有,所以这里我们可以换成家里的源,速度快!

怎么更换apt源,换源方式

一般情况下,这个方法适用于所有的Linux系统,只需要修改/etc/apt/sources.list文件,这里我以Debian系统作为例子给大家演示一下。文章源自国外主机测评-https://www.zjcp.org/3588.html

debian文章源自国外主机测评-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

打开sources.list文件文章源自国外主机测评-https://www.zjcp.org/3588.html
sudo nano /etc/apt/sources.list
或(用哪个编辑器看自己的喜好)
sudo vim /etc/apt/sources.list
修改之后,保存就可以了,后面是给大家的常用源

常用国内apt源地址、

163镜像源文章源自国外主机测评-https://www.zjcp.org/3588.html
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
中科大镜像源文章源自国外主机测评-https://www.zjcp.org/3588.html
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
阿里云镜像源文章源自国外主机测评-https://www.zjcp.org/3588.html
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
华为云镜像源文章源自国外主机测评-https://www.zjcp.org/3588.html
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
清华大学云镜像源文章源自国外主机测评-https://www.zjcp.org/3588.html
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
 
  • 本文由 主机测评 发表于 2022年10月31日23:08:00
  • 转载请务必保留本文链接:https://www.zjcp.org/3588.html

发表评论