Skip to content

Lesson 07 — Linux Package Management

Imagine you’ve just deployed a new Ubuntu server in AWS.

Your manager asks you to install:

  • NGINX
  • Docker
  • Git
  • Python
  • Terraform

Unlike Windows, Linux doesn’t usually require downloading software from websites.

Instead, Linux uses Package Managers that automatically download, install, update, verify, and remove software from trusted repositories.

Package management is one of the first skills every Linux Administrator, Cloud Engineer, DevOps Engineer, and Cybersecurity Professional must master.

Whether you’re installing Docker on Ubuntu, updating Apache on Red Hat, or deploying Kubernetes tools, package managers make software management simple and secure.


After completing this lesson, you will be able to:

  • Explain what package management is.
  • Understand Linux repositories.
  • Learn different Linux package formats.
  • Use APT, DNF, and YUM.
  • Install, update, remove, and search software.
  • Understand package dependencies.
  • Apply enterprise software management best practices.

Package Management is the process of installing, updating, configuring, and removing software on a Linux system.

Instead of manually downloading software from websites, Linux retrieves software from trusted repositories.

Package managers automatically:

  • Download software
  • Install dependencies
  • Verify integrity
  • Configure packages
  • Apply updates
  • Remove software

Without package managers:

  • Software installation would be manual.
  • Dependencies would be difficult to track.
  • Updates would consume significant time.
  • Systems would become inconsistent.

Package managers ensure software is installed safely and consistently.


A Package is a compressed file containing everything needed to install an application.

It typically includes:

  • Executable files
  • Libraries
  • Configuration files
  • Documentation
  • Installation scripts

Examples:

nginx
docker
git
vim
python3

Different Linux distributions use different package formats.

Distribution Package Format
Ubuntu .deb
Debian .deb
Red Hat Enterprise Linux .rpm
Rocky Linux .rpm
AlmaLinux .rpm
Fedora .rpm
SUSE Linux .rpm

A Repository is an online collection of trusted software packages.

Example:

Linux Server
Repository
Download Package
Install

Repositories are maintained by Linux distribution vendors and trusted organizations.


Different Linux distributions use different package managers.

Distribution Package Manager
Ubuntu APT
Debian APT
Red Hat Enterprise Linux DNF
Rocky Linux DNF
AlmaLinux DNF
CentOS YUM / DNF
Fedora DNF

APT is used by Debian-based systems.

Examples:

  • Ubuntu
  • Debian
  • Linux Mint

APT is one of the most popular Linux package managers.


Before installing software, update the package index.

Terminal window
sudo apt update

This downloads the latest package information from repositories.


Install available updates.

Terminal window
sudo apt upgrade

Upgrade all packages, including dependencies.

Terminal window
sudo apt full-upgrade

Keeping systems updated improves security and stability.


Install Git.

Terminal window
sudo apt install git

Install Docker.

Terminal window
sudo apt install docker.io

Install NGINX.

Terminal window
sudo apt install nginx

APT automatically installs required dependencies.


Search repositories.

Terminal window
apt search nginx

Display package details.

Terminal window
apt show nginx

Remove a package.

Terminal window
sudo apt remove nginx

Remove package and configuration files.

Terminal window
sudo apt purge nginx

Remove unused dependencies.

Terminal window
sudo apt autoremove

Clear downloaded package cache.

Terminal window
sudo apt clean

These commands help reclaim disk space.


DNF is the default package manager for Red Hat-based systems.

Examples:

  • RHEL
  • Rocky Linux
  • AlmaLinux
  • Fedora

Update package information.

Terminal window
sudo dnf check-update

Install software.

Terminal window
sudo dnf install nginx

Upgrade all packages.

Terminal window
sudo dnf upgrade

Remove a package.

Terminal window
sudo dnf remove nginx

Older Red Hat systems use YUM.

Example:

Terminal window
sudo yum install httpd

Most modern systems now use DNF, but many administrators still encounter YUM in legacy environments.


Snap is a universal package format developed by Canonical.

Install a package.

Terminal window
sudo snap install code --classic

View installed Snap packages.

Terminal window
snap list

Update all Snap packages.

Terminal window
sudo snap refresh

Flatpak is another universal package manager.

Install a package.

Terminal window
flatpak install flathub org.gimp.GIMP

List installed packages.

Terminal window
flatpak list

Flatpak is commonly used for desktop applications.


Many applications require additional software to function.

Example:

Docker
containerd
iptables
Libraries

Package managers automatically install required dependencies.


Ubuntu:

Terminal window
apt list --installed

Red Hat:

Terminal window
dnf list installed

These commands help administrators audit installed software.


Display package information.

Ubuntu:

Terminal window
dpkg -l

Red Hat:

Terminal window
rpm -qa

Cloud Engineers frequently install:

  • Docker
  • Kubernetes Tools
  • AWS CLI
  • Azure CLI
  • Google Cloud SDK
  • NGINX
  • Apache
  • Git

Package managers simplify deployment and automation.


DevOps Engineers automate software installation using:

  • Bash Scripts
  • Ansible
  • Terraform
  • Cloud-Init
  • CI/CD Pipelines

Example:

Terminal window
sudo apt update
sudo apt install -y docker.io git curl

Automation ensures consistent server builds.


Security teams use package managers to:

  • Install security tools
  • Patch vulnerabilities
  • Update operating systems
  • Remove vulnerable software
  • Verify installed packages

Keeping software updated is one of the most effective security practices.


Ubuntu

Update repositories:

Terminal window
sudo apt update

Upgrade packages:

Terminal window
sudo apt upgrade

Install software:

Terminal window
sudo apt install package-name

Remove software:

Terminal window
sudo apt remove package-name

Search packages:

Terminal window
apt search package-name

Red Hat

Install package:

Terminal window
sudo dnf install package-name

Update system:

Terminal window
sudo dnf upgrade

Remove package:

Terminal window
sudo dnf remove package-name

A Cloud Engineer provisions a new Ubuntu server.

Launch EC2 Instance
Update Packages
Install Git
Install Docker
Install NGINX
Install AWS CLI
Deploy Application

This process is performed on thousands of Linux servers every day.


As a Linux administrator:

  • Update repositories before installing software.
  • Keep systems fully patched.
  • Install software only from trusted repositories.
  • Remove unused packages.
  • Regularly clean package caches.
  • Automate installations where possible.
  • Test updates before deploying to production.
  • Document installed software.

Proper package management improves security, reliability, and operational efficiency.


After completing this lesson, you should understand:

  • What package management is.
  • Linux repositories.
  • Package formats (.deb and .rpm).
  • APT, DNF, and YUM.
  • Installing, updating, and removing software.
  • Package dependencies.
  • Enterprise package management best practices.

Linux Package Management simplifies software installation and maintenance by using trusted repositories and automated dependency management.

Whether you’re deploying cloud infrastructure, managing enterprise servers, building CI/CD pipelines, or maintaining secure Linux systems, package managers are essential tools you’ll use throughout your career.

Mastering package management prepares you for advanced Linux administration, DevOps automation, Kubernetes deployments, and cloud engineering.


➡️ Lesson 08 — Linux Services & Systemd

In the next lesson, you’ll learn how Linux manages background services using systemd, understand service units and targets, and use commands like systemctl to start, stop, restart, enable, and troubleshoot enterprise Linux services.