先把原本的官方 yum 源 删除 或 备份
cd /etc/yum.repos.d/
备份(Redhat 同理)
rename repo repo.backup *
删除(Redhat 同理)
rm *
(必须要在 repos.d 目录下)
下载 Centos 8 repo 文件(Redhat也可用Centos源)
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
清除yum缓存
yum clean all 或 dnf clean all
生成新的yum缓存
yum makecache 或 dnf makecache
中国科学技术大学开源软件镜像 Centos stream 8 源
sudo sed -e 's|^mirrorlist=|#mirrorlist=|g' \
-e 's|^#baseurl=http://mirror.centos.org/$contentdir|baseurl=https://mirrors.ustc.edu.cn/centos|g' \
-i.bak \
/etc/yum.repos.d/CentOS-Stream-AppStream.repo \
/etc/yum.repos.d/CentOS-Stream-BaseOS.repo \
/etc/yum.repos.d/CentOS-Stream-Extras.repo \
/etc/yum.repos.d/CentOS-Stream-PowerTools.repo
清除yum缓存
yum clean all 或 dnf clean all
生成新的yum缓存
yum makecache 或 dnf makecache
修改 sources.list 文件
sudo vim /etc/apt/sources.list
输入 i 进入编辑模式
将官方源注释掉(用 # 号)
在末尾追加国内源
随便选一个源,填上去
官方源
deb http://http.kali.org/kali kali-rolling main non-free contrib
deb-src http://http.kali.org/kali kali-rolling main non-free contrib
中科大
deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
deb-src http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
阿里云
deb http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
deb-src http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
清华大学
deb http://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free
浙大
deb http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free
deb-src http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free
东软大学
deb http://mirrors.neusoft.edu.cn/kali kali-rolling/main non-free contrib
deb-src http://mirrors.neusoft.edu.cn/kali kali-rolling/main non-free contrib
重庆大学
deb http://http.kali.org/kali kali-rolling main non-free contrib
deb-src http://http.kali.org/kali kali-rolling main non-free contrib
输入完后按 esc 键输入 :wq 保存并退出
清除原来的缓存包
sudo apt-get clean // 删除缓存包
并生成新的缓存
sudo apt-get update // 更新索引
sudo apt-get upgrade // 更新包
sudo apt-get dist-upgrade // 更新包(智能解决依赖)
手机扫一扫
移动阅读更方便
你可能感兴趣的文章