有没有同学注意到,我们在Linux下更新内核或软件包的时候会使用到“sudo apt-get update”和“sudo apt-get upgrade”,但他们有什么区别呢?
后来我找到了这句话:
An update should always be performed beforean upgrade or dist-upgrade.
upgrade is used to install the newestversions of all packages currently installed on the system from the sourcesenumerated in /etc/apt/sources.list. Packages currently installed with newversions available are retrieved and upgraded.
即在使用dist-upgrade之前应该使用update更新软件源。单独的update仅仅是简单的信息收集,列出/etc/apt/sources.list 和 /etc/apt/sources.list.d中源的索引。只有在update之后使用upgrade或dist-upgrade才是真正的升级。
建议在更新的时候使用下面4行命令
apt-get update
apt-get upgrade
apt-get dist-upgrade
reboot
附上我在安装vim遇到的这个问题
问题为:
The following packages have unmet dependencies:
vim : Depends: vim-common (= 2:7.3.547-7) but2:7.4.488-7 is to be installed
E: Unable to correct problems, you have heldbroken packages.
根据问题描述,我们可以知道,这是由于OS上存在了另一个版本的vim-common造成的,所以,我们把OS上的vim-common卸载就OK了。
命令:sudoapt-get remove vim-common
然后安装:sudoapt-get install vim