在替换之前,先执行备份命令
cp /etc/apt/sources.list /etc/apt/sources.list.bak
相关细节:Debian10常用国内源更换镜像站汇总
一、配置命令
1、阿里云镜像站
echo 'deb https://mirrors.aliyun.com/kali kali-rolling main non-free contrib' > /etc/apt/sources.list
echo 'deb-src https://mirrors.aliyun.com/kali kali-rolling main non-free contrib' >> /etc/apt/sources.list
2、清华大学源
echo 'deb https://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main non-free contrib' > /etc/apt/sources.list
echo 'deb-src https://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main non-free contrib' >> /etc/apt/sources.list
3、中国科学技术大学
echo 'deb https://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib' > /etc/apt/sources.list
echo 'deb-src https://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib' >> /etc/apt/sources.list
4、腾讯云镜像站
echo 'deb https://mirrors.cloud.tencent.com/kali kali-rolling main non-free contrib' > /etc/apt/sources.list
echo 'deb-src https://mirrors.cloud.tencent.com/kali kali-rolling main non-free contrib' >> /etc/apt/sources.list
5、华为云镜像站
echo 'deb https://mirrors.huaweicloud.com/kali kali-rolling main non-free contrib' > /etc/apt/sources.list
echo 'deb-src https://mirrors.huaweicloud.com/kali kali-rolling main non-free contrib' >> /etc/apt/sources.list
二、实践
root@Y:~# echo 'deb https://mirrors.huaweicloud.com/kali kali-rolling main non-free contrib' > /etc/apt/sources.list
root@Y:~# echo 'deb-src https://mirrors.huaweicloud.com/kali kali-rolling main non-free contrib' >> /etc/apt/sources.list
root@Y:~# apt update
Get:1 https://mirrors.huaweicloud.com/kali kali-rolling InRelease [30.5 kB]
Get:2 https://mirrors.huaweicloud.com/kali kali-rolling/non-free Sources [125 kB]
Get:3 https://mirrors.huaweicloud.com/kali kali-rolling/contrib Sources [60.8 kB]
Get:4 https://mirrors.huaweicloud.com/kali kali-rolling/main Sources [13.1 MB]
Get:5 https://mirrors.huaweicloud.com/kali kali-rolling/main amd64 Packages [16.7 MB]
Get:6 https://mirrors.huaweicloud.com/kali kali-rolling/non-free amd64 Packages [196 kB]
Get:7 https://mirrors.huaweicloud.com/kali kali-rolling/contrib amd64 Packages [96.4 kB]
Fetched 30.3 MB in 21s (1445 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
58 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@Y:~#