kali 更新源 sources.list以及apt-get 相关命令说明

本文介绍了如何为Kali Linux配置更新源,并详细对比了官方源、中科大源及新加坡源等不同源的特点。此外,还提供了使用apt-get进行系统更新的具体步骤,包括update、upgrade及dist-upgrade的区别。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、设置更新源


网上给出的更新源,只有新加坡的更新源是可以更新到源文件的。其他国内源可以作为补充,不过新加坡的源速度也不是很快。


更多环境配置内容,可以参考在线视频:http://edu.51cto.com/lesson/id-34754.html

#官方源
deb http://http.kali.org/kali kali main non-free contrib
deb-src http://http.kali.org/kali kali main non-free contrib
deb http://security.kali.org/kali-security kali/updates main contrib non-free 

#中科大kali源

deb http://mirrors.ustc.edu.cn/kali kali main non-free contrib
deb-src http://mirrors.ustc.edu.cn/kali kali main non-free contrib
deb http://mirrors.ustc.edu.cn/kali-security kali/updates main contrib non-free

#新加坡kali源

deb http://mirror.nus.edu.sg/kali/kali/ kali main non-free contrib
deb-src http://mirror.nus.edu.sg/kali/kali/ kali main non-free contrib
deb http://security.kali.org/kali-security kali/updates main contrib non-free
deb http://mirror.nus.edu.sg/kali/kali-security kali/updates main contrib non-free
deb-src http://mirror.nus.edu.sg/kali/kali-security kali/updates main contrib non-free

#debian_wheezy国内源

deb http://ftp.sjtu.edu.cn/debian wheezy main non-free contrib
deb-src http://ftp.sjtu.edu.cn/debian wheezy main non-free contrib 
deb http://ftp.sjtu.edu.cn/debian wheezy-proposed-updates main non-free contrib 
deb-src http://ftp.sjtu.edu.cn/debian wheezy-proposed-updates main non-free contrib 
deb http://ftp.sjtu.edu.cn/debian-security wheezy/updates main non-free contrib 
deb-src http://ftp.sjtu.edu.cn/debian-security wheezy/updates main non-free contrib 
deb http://mirrors.163.com/debian wheezy main non-free contrib 
deb-src http://mirrors.163.com/debian wheezy main non-free contrib 
deb http://mirrors.163.com/debian wheezy-proposed-updates main non-free contrib 
deb-src http://mirrors.163.com/debian wheezy-proposed-updates main non-free contrib 
deb-src http://mirrors.163.com/debian-security wheezy/updates main non-free contrib 
deb http://mirrors.163.com/debian-security wheezy/updates main non-free contrib

二、更新

对软件进行一次整体更新:

apt-get update 

apt-get upgrade

apt-get dist-upgrade 

apt-get clean

三、关于apt-get相关命令说明

070755_6xB3_2308739.png

四、update upgrade dist-upgrade区别与联系

update是第一步找出哪些需要升级

upgrade:系统将现有的Package升级,如果有相依性的问题,而此相依性需要安装其它新的

Package或影响到其它Package的相依性时,此Package就不会被升级,会保留下来. 

dist-upgrade:可以聪明的解决相依性的问题,如果有相依性问题,需要安装/移除新的Package,

就会试着去安装/移除它. 

(所以通常这个会被认为是有点风险的升级) 

 

apt-get upgrade 和 apt-get dist-upgrade 本质上是没有什么不同的。

 

只不过,dist-upgrade 

会识别出当依赖关系改变的情形并作出处理,而upgrade对此情形不处理。


upgrade: 

upgrade is used to install the newest versions of all packages currently installed on the 

system from the sources enumerated in /etc/apt/sources.list. Packages currently 

installed with new versions available are retrieved and upgraded; under no 

circumstances are currently installed packages removed, or packages not already 

installed retrieved and installed. New versions of currently installed packages 

that cannot be upgraded without changing the install status of another package 

will be left at their current version. 

An update must be performed first so that 

apt-get knows that new versions of packages are available. 

dist-upgrade: dist-upgrade in addition to performing 

the function of upgrade, also intelligently handles changing dependencies with 

new versions of packages; apt-get has a "smart" conflict resolution system, and 

it will attempt to upgrade the most important packages at the expense of less




转载于:https://my.oschina.net/u/2308739/blog/548769

Kali Linux 中遇到 `apt-get update` 新失败的问题,通常与软件配置、证书过期或网络问题有关。以下是几种常见的解决方法,结合了不同情况下的处理方式: ### 1. 新软件密钥 当出现签名密钥过期或无效的提示(如 `EXPKEYSIG` 错误),可以尝试手动新或添加新的密钥。例如: ```bash sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <KEY_ID> ``` 如果不确定具体的密钥 ID,可以尝试新所有密钥: ```bash sudo apt-key update ``` ### 2. 换国内镜像 如果使用的是默认的官方,可能会因为网络问题导致新失败。可以尝试换为国内镜像,例如中科大、阿里云或东软镜像。修改 `/etc/apt/sources.list` 文件,替换为以下内容之一: #### 中科大镜像: ```bash deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib ``` #### 阿里云镜像: ```bash deb http://mirrors.aliyun.com/kali kali-rolling main non-free contrib ``` #### 东软镜像: ```bash deb http://mirrors.neusoft.edu.cn/kali kali-rolling main non-free contrib ``` 保存文件后,执行以下命令新软件包列表: ```bash sudo apt-get update ``` ### 3. 清理 APT 缓存 有时候,缓存中的损坏文件可能导致新失败。可以通过以下命令清理 APT 缓存: ```bash sudo apt-get clean sudo apt-get autoclean ``` 清理完成后,再次尝试新: ```bash sudo apt-get update ``` ### 4. 检查网络连接和 DNS 设置 确保系统能够正常访问互联网,并且 DNS 设置正确。可以通过以下命令测试网络连接: ```bash ping -c 4 http.kali.org ``` 如果网络不通,可以尝试修改 DNS 配置,例如使用 Google 的公共 DNS: ```bash echo "nameserver 8.8.8.8" > /etc/resolv.conf ``` ### 5. 使用 `--fix-missing` 参数 在某些情况下,`apt-get update` 可能会因为某些文件缺失而失败。可以尝试使用 `--fix-missing` 参数来修复: ```bash sudo apt-get update --fix-missing ``` ### 6. 升级系统 如果问题仍然存在,可能是系统版本过旧导致的兼容性问题。可以尝试升级系统: ```bash sudo apt-get upgrade sudo apt-get dist-upgrade ``` 完成升级后,再次尝试新软件包列表: ```bash sudo apt-get update ``` ### 示例操作流程 以下是一个完整的示例操作流程,结合了上述多个步骤: ```bash # 清理缓存 sudo apt-get clean sudo apt-get autoclean # 新密钥 sudo apt-key update # 修改为中科大镜像 echo "deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib" > /etc/apt/sources.list # 新软件包列表 sudo apt-get update --fix-missing # 升级系统 sudo apt-get upgrade sudo apt-get dist-upgrade ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值