由于我在网络上搜索关于此的文章给的答案都只有HTTP的源,好多方案即使给了HTTPS的源地址也没有给出前面需要安装证书的步骤,因此就有了此片文章
由于安装好系统后源地址默认是国外的,因此我们需要更换我们国内的安全的快速的源地址,有以下步骤:
1、首先需要备份sources.list文件,他所在目录:/etc/apt/
命令:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.old
关于sources.list.old的后缀可以随意命名,只要自己知道即可比如:sources.list.2024.
2、因为需要换成https源地址,所以我们需要安装https相关证书,所以使用原来的源地址首先进行更新。
命令1:
sudo apt-get update
命令2:
sudo apt-get install --reinstall ca-certificates -y
这里就需要耐心的等待了,过程中如果网速过慢可能会导致失败,但是没关系,找一个网速快的地方再次执行以上的命令即可。
3、下来就可以使用vi命令进行编辑sources.list文件了
sudo vi /etc/apt/sources.list
进入文件后使用dG删除所有,在使用Shift+insert插入下面的源地址,然后使用wq!进行保存。
源地址(我这里选择的是中科大的https源地址[***注意版本 注意版本 注意版本***]):LUG's repo file generator (ustc.edu.cn)
https://mirrors.ustc.edu.cn/repogen/
以下是我选择的版本:
deb https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware
通过以上步骤就换好了https源地址,接着首先进行更新:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
至此,换源步骤完毕