首页 /服务器与软件/其它软件/网赚
 Debian 软件源替换指南
今天 14:37

 当前软件源/etc/apt/sources.list配置

deb http://ftp.us.debian.org/debian/ bookworm main non-free non-free-firmware contrib 
deb-src http://ftp.us.debian.org/debian/ bookworm main non-free non-free-firmware contrib 
deb http://ftp.us.debian.org/debian/ bookworm-updates main non-free non-free-firmware contrib 
deb-src http://ftp.us.debian.org/debian/ bookworm-updates main non-free non-free-firmware contrib 
deb http://ftp.us.debian.org/debian/ bookworm-backports main non-free non-free-firmware contrib 
deb-src http://ftp.us.debian.org/debian/ bookworm-backports main non-free non-free-firmware contrib

 当前使用的是美国FTP服务器源,可能下载速度较慢。

推荐替换命令:

阿里云镜像源

sudo sed -i 's/ftp.us.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list

具体解释:

sudo - 以管理员权限执行命令
sed -i - 使用 sed 文本处理工具直接修改文件内容
's/deb.debian.org/mmirrors.aliyun.com/g' - 替换规则:
s/ - 开始替换操作
deb.debian.org - 要被替换的原始域名(Debian 官方源)
mirrors.aliyun.com - 替换成的新域名(阿里云镜像源)
g - 全局替换(文件中所有匹配项都替换)
/etc/apt/sources.list - 要修改的文件(软件源配置文件)

清华大学镜像源

sudo sed -i 's/ftp.us.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list

中国科技大学镜像源

sudo sed -i 's/ftp.us.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list

变成:

deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main non-free non-free-firmware contrib 
deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main non-free non-free-firmware contrib 
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main non-free non-free-firmware contrib 
deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main non-free non-free-firmware contrib 
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main non-free non-free-firmware contrib 
deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main non-free non-free-firmware contrib

这样就可以愉快地更新软件包了:

sudo apt update

<hr/>

当然/etc/apt/sources.list也可以用华为镜像:

deb http://repo.huaweicloud.com/debian/ bookworm main non-free non-free-firmware contrib 
deb-src http://repo.huaweicloud.com/debian/ bookworm main non-free non-free-firmware contrib 
deb http://repo.huaweicloud.com/debian/ bookworm-updates main non-free non-free-firmware contrib 
deb-src http://repo.huaweicloud.com/debian/ bookworm-updates main non-free non-free-firmware contrib 
deb http://repo.huaweicloud.com/debian/ bookworm-backports main non-free non-free-firmware contrib 
deb-src http://repo.huaweicloud.com/debian/ bookworm-backports main non-free non-free-firmware contrib


 
全部回复(0)
首页 | 电脑版 |