What does apt-get update do?
12 May 2024 (Updated 12 May 2024)
1. Fetches package lists
apt-get update
fetches the package lists from /etc/apt/sources.list
and files from the /etc/apt/sources.list.d/
directory. If you inspect a file from these locations, you’ll see something like:
deb http://ppa.launchpad.net/ondrej/php/ubuntu focal main
Let’s break down the components:
deb
: This specifies the archive type.de
b is used for pre-compiled, ready-to-use Debian packages that are ready to be installed without any compilation steps. You can also havedeb-src
which contains the package source and compilation instructions – useful for when you want to inspect or edit the source.http://ppa.launchpad.net/ondrej/php/ubuntu
-
http://ppa.launchpad.net
– a popular platform for hosting open-source pages. You can think of it like GitHub for Ubuntu packages. ondrej/php/ubuntu
is the specific Personal Package Archive (PPA). You can think of it as a GitHub repository.
-
focal
: Specifies the distribution codename that the repository targets. See here for full list of distribution codenames.main
: The component of the repository. A PPA repo can contain multiple components. Themain
component usually contains free and open-source software that’s official supported.
2. Updates local package index
Once it’s fetched the package list, it’ll your system’s local page index – a local copy of all the available packages and versions available from the repositories your system knows about.
3. Prepares system for upgrade
apt-get update
only updates your system’s package index. It doesn’t actually upgrade anything. To upgrade, you’ll want to run apt-get upgrade
.
Tagged:
Ubuntu
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment