Managing Programs in Linux: Installation, Update, and Removal¶
In Linux, software is distributed as packages, stored in official and third‑party repositories. The installation, updating, and removal of packages are managed by specialized tools — package managers.
The choice of manager depends on the distribution:
| Distribution | Package Manager | Package Format |
|---|---|---|
| Debian, Ubuntu (and derivatives) | apt / apt-get, apt-cache | .deb |
| RHEL, CentOS 7 and earlier, BitrixOS | yum | .rpm |
| RHEL 8+, CentOS Stream, Rocky Linux, AlmaLinux | dnf (successor to yum) | .rpm |
Note
In modern Ubuntu/Debian, it is preferable to use *****apt****** — a simplified and convenient interface that combines the functions of apt-get and apt-cache.
In newer RPM systems, dnf commands are similar to yum, but faster and more reliable.
Note
Most commands require superuser privileges — use sudo.
-
Updating the package list
Before installing or updating, always refresh the local metadata cache:
System Command Debian / Ubuntu sudo apt updateCentOS 7 / BitrixOS sudo yum check-updateRHEL 8+ / CentOS Stream sudo dnf check-update(or simplysudo dnf upgrade --refresh)Note
apt update≠apt upgrade!
updateonly updates lists,
upgradeupdates installed packages. -
Searching for packages
If you don't know the exact name, search by keywords:
System Command Debian / Ubuntu apt search keywordCentOS / RHEL (yum/dnf) yum search keyworddnf search keywordExample:
-
Viewing package information
Find the version, description, dependencies, and size before installation:
System Command Debian / Ubuntu apt show package_nameCentOS / RHEL yum info package_namednf info package_nameExample:
-
Installing packages
Basic installation:
Debian/Ubuntu
CentOS 7 / BitrixOSRHEL 8+, CentOS Stream
Installing multiple packages:
Installing a specific version:
Debian/Ubuntu
yum/dnf (specified with a hyphen)
-
Updating packages
Update all installed packages to the latest versions:
System Command Debian / Ubuntu sudo apt upgrade
or_sudo apt full-upgrade_— to handle dependencies with removal/replacement of packagesCentOS 7 / BitrixOS sudo yum updateRHEL 8+ / CentOS Stream sudo dnf upgrade -
Removing packages
Remove a package while preserving configuration files:
Debian/Ubuntu
yum/dnfFull removal (including configs):
Automatic dependency cleanup
Removes packages that were installed only as dependencies but are no longer required:
Additionally: clearing the cache of downloaded packages
Information
Useful alternatives
| Task | Command |
|---|---|
| Check if a package is installed | dpkg -l | grep package_name (Debian)rpm -q package_name (RPM) |
| See what files a package contains | dpkg -L package_namerpm -ql package_name |
| Find which package owns a file | dpkg -S /path/to/filerpm -qf /path/to/file |