APT (Advanced Package Tool),作为一个高级包装工具,用于下载和安装包。在使用过程中容易混淆update upgrade命令。
apt-get update
updates the list of available packages and their versions, but it does not install or upgrade any packages.
更新可用软件包及其版本的列表,但不会安装或升级任何软件包。
somnus@somnus-virtual-machine:~$ sudo apt-get update
[sudo] password for somnus:
Hit http://archive.ubuntukylin.com:10006 xenial InRelease
Hit http://security.ubuntu.com trusty-security InRelease
........此处省略........
Ign http://us.archive.ubuntu.com trusty/universe Translation-en_US
Fetched 5,567 B in 28s (192 B/s)
Reading package lists... Done
更新的列表在 etc/apt/sources.list文件中,我们可以通过如下命令查看。
sudo vim /etc/apt/sources.list
apt-get upgrade
actually installs newer versions of the packages you have. After updating the lists, the package manager knows about available updates for the software you have installed.
实际上安装了你的新版本的软件包。 更新列表后,程序包管理器会知道您已安装的软件的可用更新。
总结
update是更新软件支持列表,upgrade更新软件包,所以在执行upgrade之前需要先执行update。