Package Manager
Package Manager
• Key Features:
◦ Automatic Dependency Resolution: YUM automatically
resolves and installs all necessary dependencies for a given
package.
◦ Repository Management: YUM works with repositories defined
in .repo configuration files (usually located in /etc/
yum.repos.d/). These files specify the repository URL, GPG key
for verification (optional but recommended), and other metadata.
◦ Transaction Management: YUM performs installations and
updates as transactions, ensuring system consistency. If an error
occurs during the process, the transaction can be rolled back to
prevent partial installations.
• Core Commands:
◦ yum install <package_name>: Installs a package. Example: yum
install firefox
◦ yum remove <package_name>: Removes a package. Example: yum
remove firefox
◦ yum update <package_name>: Updates a specific package.
Example: yum update kernel
◦ yum update: Updates all packages on the system.
◦ yum search <keyword>: Searches for packages matching a
keyword. Example: yum search webserver
◦ yum list installed: Lists all installed packages.
◦ yum info <package_name>: Provides detailed information about a
package. Example: yum info httpd
◦ yum clean all: Clears the YUM cache (metadata and downloaded
packages). This can resolve issues with outdated information.
◦ ‘sudo yum repolist’ : How many software repositories are
configured for YUM.
• Useful Options:
◦ -y or --assumeyes: Automatically answers “yes” to all prompts.
Useful for scripting. Example: yum install -y vim
◦ --enablerepo=<repo_id>: Enables a specific repository for the
current operation. Example: yum install --enablerepo=epel-
testing some_package
◦ --disablerepo=<repo_id>: Disables a specific repository.
Example: yum update --disablerepo=* --enablerepo=updates
(updates only from the “updates” repo)
RPM is the lower-level package manager that YUM uses behind the scenes.
While YUM is generally preferred for most tasks, understanding RPM can be
helpful for troubleshooting or working with individual package files.
• Key Features:
◦ Package Verification: RPM uses checksums and digital
signatures to verify the integrity of package files.
◦ Detailed Package Information: RPM provides detailed
information about installed packages, including dependencies, file
lists, and installation scripts.
• Querying Packages:
◦ ‘rpm -qa | grep wget’ : Check the Package Version
◦ rpm -q <package_name>: Checks if a package is installed.
Example: rpm -q nano
◦ rpm -qi <package_name>: Displays detailed information about a
package. Example: rpm -qi bash
◦ rpm -ql <package_name>: Lists files installed by a package.
Example: rpm -ql httpd
◦ rpm -qf <file_path>: Determines which package owns a specific
file. Example: rpm -qf /usr/bin/python3
• Installing/Upgrading/Removing Packages (less common with
YUM):
◦ rpm -ivh <package_file.rpm>: Installs a package from a local
file. Example: rpm -ivh mypackage-1.0-1.x86_64.rpm ( i for
install, v for verbose output, h for hash marks showing progress.)
◦ rpm -Uvh <package_file.rpm>: Upgrades or installs a package. If
the package is already installed, it upgrades it. Otherwise, it
installs it. Example: rpm -Uvh mypackage-1.1-1.x86_64.rpm
◦ rpm -e <package_name>: Removes (erases) a package. Example:
rpm -e oldpackage
• Verification:
◦ rpm -Vv <package_name>: Verifies a package against its original
installation information. This checks file sizes, permissions,
checksums, etc. Useful for detecting modified files.
While YUM and RPM are central to Red Hat-based systems, other Linux
distributions use different package management systems:
Package
.rpm .deb .pkg.tar.zst
Format
(Pacman
Low-Level RPM DPKG
handles both)
Dependency
Yes Yes Yes
Resolution
• Key Features:
◦ Dependency Resolution: Automatically resolves and installs
dependencies required by a package.
◦ Repository Management: Works with repositories defined in
the /etc/apt/sources.list file and files within the /etc/apt/
sources.list.d/ directory. These files list the URLs of software
repositories.
◦ Automatic Upgrades: Facilitates easy upgrading of installed
software.
• Common Commands:
◦ sudo apt update: Refreshes the local package list. This fetches
information about available packages from the configured
repositories. Crucial to run before installing or upgrading.
◦ sudo apt upgrade: Upgrades all installed packages to their latest
versions available in the repositories.
◦ sudo apt full-upgrade: Similar to upgrade, but also handles
removing obsolete packages to satisfy dependency changes. More
comprehensive but can sometimes remove packages you might
want to keep, so review the changes before proceeding.
◦ sudo apt install <package_name>: Installs a package. Example:
sudo apt install firefox
◦ sudo apt remove <package_name>: Removes a package, but
keeps its configuration files. Example: sudo apt remove vlc
◦ sudo apt purge <package_name>: Removes a package and its
configuration files. Example: sudo apt purge libreoffice*
(removes all LibreOffice packages and their configs)
◦ sudo apt autoremove: Removes packages that were automatically
installed as dependencies and are no longer needed.
◦ sudo apt search <keyword>: Searches for packages matching a
keyword. Example: sudo apt search image editor
◦ apt show <package_name>: Displays information about a specific
package (version, dependencies, description, etc.). Example: apt
show gnome-terminal
◦ apt list --installed: Lists all installed packages.
DPKG is a low-level package manager. APT uses DPKG behind the scenes.
While you’ll typically use APT for most package management tasks,
understanding DPKG can be useful in certain situations.
• Key Features:
◦ Handles .deb files: Works directly with .deb package files
(Debian packages).
◦ Basic package operations: Install, remove, list, and query
individual packages.
• Common Commands:
◦ sudo dpkg -i <package_file.deb>: Installs a .deb package file.
Example: sudo dpkg -i mypackage_1.0_amd64.deb
◦ sudo dpkg -r <package_name>: Removes a package (but keeps
configuration files). Example: sudo dpkg -r mypackage
◦ sudo dpkg -P <package_name>: Purges a package (removes the
package and its configuration files). Example: sudo dpkg -P
mypackage
◦ dpkg -l: Lists all installed packages. (The -l is a lowercase L)
◦ dpkg -s <package_name>: Displays information about a package.
Example: dpkg -s gedit
◦ dpkg -L <package_name>: Lists all files installed by a package.
Example: dpkg -L firefox
◦ dpkg -S <file_path>: Searches for which package owns a
particular file. Example: /usr/bin/gedit
Dependency
Automatic Manual
Handling
Repository
Yes No
Management
Installing
individual .deb files,
Installing, updating,
troubleshooting
Typical Use Cases removing packages
package issues,
from repositories
querying package
information
Use APT for most everyday package management tasks (installing, updating,
removing software). Use DPKG when you need to work with individual .deb
files or for low-level package operations like querying specific package
details or troubleshooting broken installations. Almost always update your
package lists using sudo apt update before any APT operations.
This transcript discusses the differences between apt and apt-get, two
command-line package managers in Debian-based systems. While apt-get is
older and was the standard for a long time, apt is now generally preferred
for most users.
The transcript illustrates the differences using the example of installing the
Firefox package:
• Using apt:
• Using apt-get:
While both commands achieve the same result (installing Firefox), the apt
version generally provides more user-friendly feedback during the process.
• Using apt: apt search <package> Example: apt search telnet This
command uses the APT package manager to search for packages
related to the keyword telnet. It’s generally simpler and provides a
better user interface.
You can’t search directly with apt-get You must use apt-cache search
telnet command or other option instead which includes a lot of output
which could become messy.
Summary:
apt offers the functionality of the different apt tools under the same tool: *
apt * apt-get * apt-cache
All in all:
While both apt and apt-get work, apt is the recommended command for
most users due to its improved user experience and simplified command
structure. If you’re working with a newer Debian-based system, stick with
apt.