apt upgrade与 apt dist-upgrade的区别

先说结论

apt upgrade可以更新包,apt dist-upgrade是增强版本,它可以智能的删除和安装一些包,以满足各个包的依赖关系。

为什么需要dist-upgrade

upgrade的过程中会出现包的版本冲突的情况,比如:

    The following packages have unmet dependencies:
     libapache2-mod-php5 : Depends: php5-common (>= 5.3.3-7+squeeze14) but 5.3.3-7+squeeze13 is to be installed
                           Depends: php5-cli but it is not going to be installed
                           Depends: php5-json but it is not going to be installed
                           Depends: php5-readline but it is not going to be installed
    E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

这个时候,就需要dist-upgrade了。

怎么用dist-upgrade

很简单:


sudo apt update && sudo apt dist-upgrade

以上代码将会更新所有的包,包括系统的核心包。比如,你用linux高级模式进入了一个较低版本的系统内核,然后你想升级到最新的内核,就可以用这个命令。之后重启,就可以进入最新的内核了。

你可能感兴趣的:(运维,linux,服务器,ubuntu)