difference between apt-get upgrade vs. update followed by install

Lolo

I understand that sudo apt-get update only updates the package list whereas sudo apt-get upgrade will install the newer version of the package.

But will sudo apt-get update && sudo apt-get install be equivalent to sudo apt-get install followed by sudo apt-get upgrade?

Stephen Kitt

I’m not 100% sure what your question is exactly, but perhaps a general answer will help.

The various apt operations behave as follows:

  • update retrieves the current package indexes from the repositories
  • install installs the listed packages and any necessary dependencies, using the package indexes available locally (so it might fail, if the indexes refer to package versions which are no longer available in the repositories or the package cache)
  • upgrade upgrades all installed packages to the latest versions listed in the package indexes available locally, following the pin priorities (this might fail for the same reason as install); it also installs any newly-required dependencies

If you install a package with out-dated indexes, then update and upgrade, you’ll end up with the same installed version as you’d get by updating before you install, as long as the older version is still available in the repositories. Strictly speaking the installation isn’t exactly equivalent: installing a new version from scratch isn’t quite the same as installing an older version and upgrading. Assuming no bugs, the result should be the same (apart from obsolete configuration files, but that’s a minor concern).

It’s always best to update before installing or upgrading, unless you’ve updated since the last mirror pulse (I’d have to check how often they happen now; if you updated within the last day you should be fine).

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Difference between Update Manager and apt-get dist-upgrade

分類Dev

What is the difference between sudo apt-get install and sudo apt install

分類Dev

Will "apt-get upgrade" update the kernel on LTS?

分類Dev

Is there a difference between "sudo apt-get install cuda" and "sudo apt-get install nvidia-cuda-toolkit"?

分類Dev

apt-get install vs pip install

分類Dev

What is the difference between apt-get and aptitude?

分類Dev

How to rollback an "apt-get install dist-upgrade"?

分類Dev

Problem with IPv6 sudo apt-get update/upgrade

分類Dev

apt-get install python-xxx vs pip install

分類Dev

Chefでのapt-get updateおよびapt-get upgrade

分類Dev

Unable to lock the administration directory (sudo apt-get upgrade && apt-get update)

分類Dev

Apt install vs apt-get install. Does they do the same task?

分類Dev

LLVM and Clang installation: apt-get vs. manual install

分類Dev

ubuntu 14.04 cannot “apt-get update or install” ok

分類Dev

Errors on "apt-get update" after trying to install "Ubuntu TV"

分類Dev

Difference between apt-get compilation and manual compilation from source

分類Dev

Difference between 'sudo apt-get' and 'sudo -E apt-get'

分類Dev

How do you recover from a failed upgrade ('apt-get -f install' and 'dpkg --configure -a' fail)?

分類Dev

How do you recover from a failed upgrade ('apt-get -f install' and 'dpkg --configure -a' fail)?

分類Dev

Python Dockerfileでapt-get updateおよびupgradeが必要ですか

分類Dev

apt-get update && upgradeの後に起動できません

分類Dev

Does Software Updater sync up changes with apt-get update/upgrade?

分類Dev

IPv6 sudo apt-get update / upgradeの問題

分類Dev

apt-get updateとupgradeの違いは何ですか?

分類Dev

Not update to "apt-get update"

分類Dev

カーネルソースを取得する:apt-get install vs apt-get source

分類Dev

Performance difference between Map.has vs Map.get

分類Dev

sudo apt-get upgrade not work

分類Dev

アップグレードvsdist-upgrade vs apt-get installlinux-headers-generic

Related 関連記事

  1. 1

    Difference between Update Manager and apt-get dist-upgrade

  2. 2

    What is the difference between sudo apt-get install and sudo apt install

  3. 3

    Will "apt-get upgrade" update the kernel on LTS?

  4. 4

    Is there a difference between "sudo apt-get install cuda" and "sudo apt-get install nvidia-cuda-toolkit"?

  5. 5

    apt-get install vs pip install

  6. 6

    What is the difference between apt-get and aptitude?

  7. 7

    How to rollback an "apt-get install dist-upgrade"?

  8. 8

    Problem with IPv6 sudo apt-get update/upgrade

  9. 9

    apt-get install python-xxx vs pip install

  10. 10

    Chefでのapt-get updateおよびapt-get upgrade

  11. 11

    Unable to lock the administration directory (sudo apt-get upgrade && apt-get update)

  12. 12

    Apt install vs apt-get install. Does they do the same task?

  13. 13

    LLVM and Clang installation: apt-get vs. manual install

  14. 14

    ubuntu 14.04 cannot “apt-get update or install” ok

  15. 15

    Errors on "apt-get update" after trying to install "Ubuntu TV"

  16. 16

    Difference between apt-get compilation and manual compilation from source

  17. 17

    Difference between 'sudo apt-get' and 'sudo -E apt-get'

  18. 18

    How do you recover from a failed upgrade ('apt-get -f install' and 'dpkg --configure -a' fail)?

  19. 19

    How do you recover from a failed upgrade ('apt-get -f install' and 'dpkg --configure -a' fail)?

  20. 20

    Python Dockerfileでapt-get updateおよびupgradeが必要ですか

  21. 21

    apt-get update && upgradeの後に起動できません

  22. 22

    Does Software Updater sync up changes with apt-get update/upgrade?

  23. 23

    IPv6 sudo apt-get update / upgradeの問題

  24. 24

    apt-get updateとupgradeの違いは何ですか?

  25. 25

    Not update to "apt-get update"

  26. 26

    カーネルソースを取得する:apt-get install vs apt-get source

  27. 27

    Performance difference between Map.has vs Map.get

  28. 28

    sudo apt-get upgrade not work

  29. 29

    アップグレードvsdist-upgrade vs apt-get installlinux-headers-generic

ホットタグ

アーカイブ