Installing software by manually downloading and compiling source code is slow and error-prone. Linux distributions solve this with package managers — tools that download, install, update, and remove software while automatically handling dependencies.
apt — Debian and Ubuntu
apt (Advanced Package Tool) is the standard package manager for Ubuntu and all Debian-based distros. It installs .deb packages from official repositories.
# Update package index (always do this first)
sudo apt update
# Install a package
sudo apt install nginx
sudo apt install git curl wget vim
# Remove a package
sudo apt remove nginx
sudo apt purge nginx # remove + delete config files
# Update installed packages
sudo apt upgrade
sudo apt dist-upgrade # also handles dependency changes
# Search for packages
apt search "text editor"
apt show nginx # details about a package
# List installed packages
apt list --installed
apt list --installed | grep nginx
# Clean up
sudo apt autoremove # remove unused dependencies
sudo apt clean # clear download cache
dnf — RHEL, Fedora, AlmaLinux, Rocky Linux
dnf (Dandified YUM) replaced yum on modern Red Hat-based distros. It installs .rpm packages.
sudo dnf install nginx
sudo dnf remove nginx
sudo dnf update
sudo dnf search nginx
sudo dnf info nginx
sudo dnf list installed
sudo dnf autoremove
On older RHEL/CentOS 7 systems, replace dnf with yum.
apk — Alpine Linux
apk is the minimal package manager used on Alpine Linux, the standard base image for Docker containers.
apk update
apk add nginx curl bash
apk del nginx
apk search nginx
apk info nginx
Repositories
Software comes from repositories (repos) — trusted servers maintained by the distro or third parties. Repository configurations are stored in:
/etc/apt/sources.listand/etc/apt/sources.list.d/on Debian/Ubuntu/etc/yum.repos.d/on RHEL/Fedora
Adding a third-party repo (example: Docker on Ubuntu):
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt update
sudo apt install docker-ce
snap and flatpak
Universal package formats that bundle applications with their dependencies:
# snap (Ubuntu, most distros)
sudo snap install code --classic # install VS Code
snap list
sudo snap remove code
# flatpak (available on most distros)
flatpak install flathub org.gimp.GIMP
flatpak list
Installing from Source
When a package isn't in the repos, you may compile from source:
sudo apt install build-essential # install compiler toolchain
./configure --prefix=/usr/local
make
sudo make install
Prefer packages from official repos over source builds — they receive security updates automatically.
Auditing Installed Software
apt list --installed # Debian/Ubuntu
rpm -qa # RHEL/Fedora
rpm -qi nginx # detailed info about installed RPM
dpkg -l nginx # detailed info about installed .deb
which nginx # find path to a command
whereis nginx # find binary, man page, source
The next lesson covers Linux networking — how to check IP configuration, test connectivity, and understand key network tools.