apt 查看可更新软件包

  1. apt list --upgradable

apt 镜像源配置

阿里云:https://developer.aliyun.com/mirror/ubuntu
清华:https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/

apt-get 原理

  • 执行apt-get update;
  • 程序分析/etc/apt/sources.list;
  • 自动连网寻找 list 中对应的 Packages/Sources/Release 列表文件,如果有更新则下载之,存入 /var/lib/apt/lists/ 目录;
  • 然后 apt-get install 相应的包 ,下载并安装。

默认 /etc/apt/sources.list 内容如下:

  1. # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
  2. # newer versions of the distribution.
  3. deb http://archive.ubuntu.com/ubuntu/ focal main restricted
  4. # deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted
  5. ## Major bug fix updates produced after the final release of the
  6. ## distribution.
  7. deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted
  8. # deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted
  9. ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
  10. ## team. Also, please note that software in universe WILL NOT receive any
  11. ## review or updates from the Ubuntu security team.
  12. deb http://archive.ubuntu.com/ubuntu/ focal universe
  13. # deb-src http://archive.ubuntu.com/ubuntu/ focal universe
  14. deb http://archive.ubuntu.com/ubuntu/ focal-updates universe
  15. # deb-src http://archive.ubuntu.com/ubuntu/ focal-updates universe
  16. ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
  17. ## team, and may not be under a free licence. Please satisfy yourself as to
  18. ## your rights to use the software. Also, please note that software in
  19. ## multiverse WILL NOT receive any review or updates from the Ubuntu
  20. ## security team.
  21. deb http://archive.ubuntu.com/ubuntu/ focal multiverse
  22. # deb-src http://archive.ubuntu.com/ubuntu/ focal multiverse
  23. deb http://archive.ubuntu.com/ubuntu/ focal-updates multiverse
  24. # deb-src http://archive.ubuntu.com/ubuntu/ focal-updates multiverse
  25. ## N.B. software from this repository may not have been tested as
  26. ## extensively as that contained in the main release, although it includes
  27. ## newer versions of some applications which may provide useful features.
  28. ## Also, please note that software in backports WILL NOT receive any review
  29. ## or updates from the Ubuntu security team.
  30. deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
  31. # deb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
  32. ## Uncomment the following two lines to add software from Canonical's
  33. ## 'partner' repository.
  34. ## This software is not part of Ubuntu, but is offered by Canonical and the
  35. ## respective vendors as a service to Ubuntu users.
  36. # deb http://archive.canonical.com/ubuntu focal partner
  37. # deb-src http://archive.canonical.com/ubuntu focal partner
  38. deb http://security.ubuntu.com/ubuntu/ focal-security main restricted
  39. # deb-src http://security.ubuntu.com/ubuntu/ focal-security main restricted
  40. deb http://security.ubuntu.com/ubuntu/ focal-security universe
  41. # deb-src http://security.ubuntu.com/ubuntu/ focal-security universe
  42. deb http://security.ubuntu.com/ubuntu/ focal-security multiverse
  43. # deb-src http://security.ubuntu.com/ubuntu/ focal-security multiverse
  44. deb [arch=amd64] https://apt.releases.hashicorp.com focal main
  45. # deb-src [arch=amd64] https://apt.releases.hashicorp.com focal main