西数超哥博客
运维经验教程分享

Debian如何更换apt源

怎么更换apt源,换源方式  推荐使用163网易的源

一般情况下,这个方法适用于所有的Linux系统,只需要修改/etc/apt/sources.list文件,这里我以Debian系统作为例子给大家演示一下。

方案一、使用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更新源索引

方案二、

这个方案就是直接在sources.list文件里边改

打开sources.list文件

sudo nano /etc/apt/sources.list
或(用哪个编辑器看自己的喜好)
sudo vim /etc/apt/sources.list
修改之后,保存就可以了,后面是给大家的常用源

常用国内apt源地址、

163镜像源

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
赞(0)
声明:本站发布的内容(图片、视频和文字)以原创、转载和分享网络内容为主,若涉及侵权请及时告知,将会在第一时间删除。本站原创内容未经允许不得转载:西数超哥博客 » Debian如何更换apt源