A package manager in linux is a collection of software tools that automates the process of installing, upgrading, configuring, and removing software packages from a computer’s operating system. It simplifies the management of software by handling dependencies (other software that a program needs to run) that needs to be installed before the actual program can run, ensuring that all necessary components are present and compatible.
Think of it like an app store for your Linux system, but often with more granular control and a focus on system-level software. Instead of manually downloading and compiling source code (which can be complex and time-consuming), you use a package manager to fetch pre-compiled software packages from repositories (centralized servers hosting software).
Different Linux distributions use different package managers. While they all serve the same fundamental purpose, their commands and underlying mechanisms vary. Here are the fundamental commands for different distributions:
Debian-Based (Ubuntu, Debian, Mint)
Package Management
- Update package lists:
sudo apt update
- Upgrade installed packages:
sudo apt upgrade
- Install a package:
sudo apt install <package>
- Remove a package:
sudo apt remove <package>
- Search for packages:
apt search <term>
Manual .deb Package Handling
- Install a local .deb file:
sudo dpkg -i <file.deb>
- List installed packages:
dpkg -l
RedHat-Based (Fedora, CentOS, RHEL)
YUM (Older Systems)
- Install a package:
sudo yum install <package>
- Update all packages:
sudo yum update
DNF (Newer Systems)
- Install a package:
sudo dnf install <package>
- Update all packages:
sudo dnf update
Manual .rpm Package Handling
- Install a local .rpm file:
sudo rpm -i <file.rpm>
- List installed packages:
rpm -qa
Arch-Based (Arch, Manjaro)
Package Management
- Install a package:
sudo pacman -S <package>
- Update all packages:
sudo pacman -Syu
- Remove a package:
sudo pacman -R <package>
- Search for packages:
pacman -Ss <term>
- List installed packages:
pacman -Q
Cheat Sheet Table
Task | Debian/Ubuntu | RedHat/Fedora (YUM) | RedHat/Fedora (DNF) | Arch Linux |
---|---|---|---|---|
Update Packages | sudo apt update | sudo yum update | sudo dnf update | sudo pacman -Syu |
Install Package | sudo apt install <pkg> | sudo yum install <pkg> | sudo dnf install <pkg> | sudo pacman -S <pkg> |
Remove Package | sudo apt remove <pkg> | sudo yum remove <pkg> | sudo dnf remove <pkg> | sudo pacman -R <pkg> |
Search Packages | apt search <term> | yum search <term> | dnf search <term> | pacman -Ss <term> |
List Installed | dpkg -l | rpm -qa | rpm -qa |
Note: Most commands require root privileges, typically run with sudo
for non-root users.
Leave a Reply