Debian更改源

本文介绍了如何在Debian系统中找到并修改源文件/etc/apt/sources.list,通过使用gedit编辑器来更改内容,并提供了备份建议及更新源的命令。

Debian源文件的位置/etc/apt/sources.list,更改此源文件内容即可

使用终端命令:
su

gedit /etc/apt/sources.list
这里写图片描述

更新源:apt-get update
这里写图片描述
注:建议更改前备份此源文件

Debian 11系统中修改软件主要有以下两种常见方法: ### 手动修改文件 修改`/etc/apt/sources.list`文件,将其中Debian默认的软件仓库地址和安全新仓库地址修改为国内的镜像地址。以清华大学镜像为例,修改后的内容如下: ```plaintext deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free ``` 修改完成后保存文件即可 [^1]。 ### 使用命令替换 一般情况下,可使用如下命令将`deb.debian.org`和`security.debian.org`替换为国内镜像地址(如`mirrors.xxx.com`),并使用https访问: ```bash sed -i "s@http://\(deb\|security\).debian.org@https://mirrors.xxx.com@g" /etc/apt/sources.list ``` 将`mirrors.xxx.com`替换为实际要使用的国内镜像地址 [^2]。 另外,如果想使用阿里云镜像,可插入以下内容到`/etc/apt/sources.list`文件: ```plaintext deb http://mirrors.aliyun.com/debian/ bullseye main contrib non-free deb-src http://mirrors.aliyun.com/debian/ bullseye main contrib non-free deb http://mirrors.aliyun.com/debian-security bullseye-security main contrib non-free deb-src http://mirrors.aliyun.com/debian-security bullseye-security main contrib non-free deb http://mirrors.aliyun.com/debian/ bullseye-updates main contrib non-free deb-src http://mirrors.aliyun.com/debian/ bullseye-updates main contrib non-free ``` 插入完成后保存文件 [^3]。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值