Installing software on Linux is very different from downloading installers on Windows or macOS. Instead, almost every distribution ships with a package manager: a tool that downloads software from trusted online repositories, resolves dependencies automatically, and keeps everything up to date with a single command. In this lesson you will learn the two most common families of package managers: apt, used by Debian and Ubuntu, and yum/dnf, used by Red Hat, CentOS, Fedora and Amazon Linux.
A package is a compressed archive containing a program, its configuration files, and metadata describing what other packages it needs. The package manager reads that metadata and installs every dependency for you. This solves the classic problem of hunting down libraries by hand. Packages come from repositories, which are servers maintained by your distribution. Because repositories are cryptographically signed, you also get a strong security guarantee that the software has not been tampered with.
On Debian-based systems such as Ubuntu, the tool is apt. Before installing anything, refresh the local index of available packages, then install what you need:
sudo apt update # refresh the package index
sudo apt install htop # install a package
sudo apt upgrade # upgrade all installed packages
sudo apt remove htop # uninstall but keep config files
sudo apt purge htop # uninstall and delete config files
apt search monitor # search the repositories
apt show htop # view details about a packageNotice that read-only commands like search do not need sudo, while anything that changes the system does. Run apt update regularly; the index is only a snapshot, and installing from a stale index can fail with 404 errors.
Red Hat-based distributions use yum, or its modern successor dnf, which accepts the same syntax. The commands map almost one-to-one to apt:
sudo yum check-update # see what can be upgraded
sudo yum install htop # install a package
sudo yum update # upgrade everything
sudo yum remove htop # uninstall a package
yum search monitor # search repositories
yum info htop # show package detailsOne practical difference: yum refreshes its metadata automatically when needed, so there is no separate mandatory update step before installing.
Over time, downloaded package archives and orphaned dependencies accumulate. Both ecosystems provide housekeeping commands:
sudo apt autoremove # remove unused dependencies (Debian/Ubuntu)
sudo apt clean # clear the download cache
sudo yum autoremove # same idea on Red Hat systems
sudo yum clean allIf an apt operation is interrupted, you may see a locked database error. Wait for any running unattended upgrade to finish, then run sudo dpkg --configure -a to repair a half-finished installation.
Learn the one your servers actually run, but understand both. In cloud environments you will constantly bounce between Ubuntu images (apt) and Amazon Linux images (yum/dnf). The mental model is identical: update the index, install, upgrade, remove, clean. Once you know one, the other takes minutes to pick up. Avoid mixing in software installed manually from source when a package exists, because manual installs are invisible to the package manager and will not receive security updates.
In the next lesson, we will look at environment variables and the .bashrc file, and see how to customize your shell so it behaves exactly the way you want.