DevOps
Linux
Package Management

Package Management

In Linux, you rarely download .exe files from websites. Instead, software is managed through Packages and installed via Package Managers from central Repositories.

1. Core Concepts

What is a Package?

A package is a compressed archive containing all the files, metadata, and instructions needed to install a software project.

  • .deb: Used by Debian and Ubuntu.
  • .rpm: Used by RedHat, CentOS, and Fedora.

How Repositories Work

A repository is a server that hosts thousands of packages. Your package manager (the client) connects to these repositories (the servers) to search for and download software.


2. APT (Advanced Package Tool)

Standard for Debian, Ubuntu, and Linux Mint.

CommandAction
sudo apt updateUpdate the local list of available packages (Sync with server).
sudo apt upgradeUpgrade all installed packages to their newest versions.
sudo apt install <pkg>Install a new software package.
sudo apt remove <pkg>Remove a package (keeps config files).
sudo apt purge <pkg>Remove a package and its configuration files.
apt search <keyword>Search for a package in the repositories.

3. YUM / DNF

Standard for RedHat, CentOS, Fedora, and Amazon Linux.

CommandAction
sudo yum install <pkg>Install a new package.
sudo yum updateUpdate all packages.
sudo yum remove <pkg>Remove a package.
yum search <keyword>Search for a package.

Summary Comparison

FeatureDebian / UbuntuRedHat / CentOS
Package Extension.deb.rpm
Low-level Tooldpkgrpm
High-level Toolapt / apt-getyum / dnf

[!IMPORTANT] Update First! Always run sudo apt update before installing a new package to ensure you are getting the latest version available on the server.