修改 apt 源

2023-12-14 14:47:54

1、进入/etc/apt 目录: cd /etc/apt

2、备份源的配置文件:cp /etc/apt/sources.list /etc/apt/sources.list.bak

3、清空配置文件内容:

echo "">sources.list

4、修改源,下面以阿里云的源为例

echo "deb https://mirrors.aliyun.com/debian  stable main contrib non-free">>sources.list

5、还有其它源可以选择,下面是其它源的地址,自己自行替换吧。

清华源

echo ?"deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free" >/etc/apt/sources.list
echo ?"deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free" >>/etc/apt/sources.list
echo ?"deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free" >>/etc/apt/sources.list
echo ?"deb http://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free" >>/etc/apt/sources.list

#中科大源 - ubuntu18.04 - 非arm构架
echo ?"deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse" >/etc/apt/sources.list
echo ?"deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse" >/etc/apt/sources.list
echo ?"deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse" >/etc/apt/sources.list
echo ?"deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse" >/etc/apt/sources.list
echo ?"deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse" >/etc/apt/sources.list
echo ?"deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse" >/etc/apt/sources.list
echo ?"deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse" >/etc/apt/sources.list
echo ?"deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse" >/etc/apt/sources.list
echo ?"deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse" >/etc/apt/sources.list
echo ?"deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse" >/etc/apt/sources.list

中科大源 - ubuntu18.04 - arm构架 【Nvidia Jetson】
echo ?"deb https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse" >/etc/apt/sources.list
echo ?"deb https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse" >/etc/apt/sources.list
echo ?"deb https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse" >/etc/apt/sources.list
echo ?"deb https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse" >/etc/apt/sources.list
echo ?"deb https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-proposed main restricted universe multiverse" >/etc/apt/sources.list
echo ?"deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse" >/etc/apt/sources.list
echo ?"deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse" >/etc/apt/sources.list
echo ?"deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse" >/etc/apt/sources.list
echo ?"deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse" >/etc/apt/sources.list
echo ?"deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-proposed main restricted universe multiverse" >/etc/apt/sources.list

163源
echo ?"deb http://mirrors.163.com/debian/ jessie main non-free contrib" >/etc/apt/sources.list
echo ?"deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib" >/etc/apt/sources.list
echo ?"deb http://mirrors.163.com/debian/ jessie-backports main non-free contrib" >/etc/apt/sources.list
echo ?"deb-src http://mirrors.163.com/debian/ jessie main non-free contrib" >/etc/apt/sources.list
echo ?"deb-src http://mirrors.163.com/debian/ jessie-updates main non-free contrib" >/etc/apt/sources.list
echo ?"deb-src http://mirrors.163.com/debian/ jessie-backports main non-free contrib" >/etc/apt/sources.list
echo ?"deb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib" >/etc/apt/sources.list
echo ?"deb-src http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib" >/etc/apt/sources.list
?

文章来源:https://blog.csdn.net/lbuskeep/article/details/134993561
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。