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。