Install, Remove, Update & Configure Packages in CentOS, Ubuntu & Linux
☰ In this chapter, you will learn
- What are the different types of package manager?
- What are the
apt
,dnf
, andyum
package manager and how to use it? - What are the dpkg and rpm package managers?
The package manager within a Linux distribution is a crucial feature that empowers users to effortlessly install, remove, update, upgrade, or configure applications. Various Linux distributions employ distinct package managers; for instance, Ubuntu utilizes apt
, while CentOS relies on yum
, each tailored to the specific needs of its distribution.
In this tutorial, we will explore various types of package managers and their respective uses.
apt and apt-get Package Manager - Ubuntu/Debian/Kali/Linux-Mint
The Advanced Packaging Tool (apt) is a widely used package management tool with Ubuntu, Debian, Kali, and Linux Mint operating systems. It's handy for tasks like installing, removing, updating, or configuring .deb (Debian) packages.
You can operate this package manager using the apt
and apt-get
command line option as follows:
1. apt & apt-get Command Options
1. Install a package:
apt
sudo apt install package_name
apt-get
sudo apt-get install package_name
2. Remove a package:
apt
sudo apt remove package_name
apt-get
sudo apt-get remove package_name
3. Remove package with its configuration file
apt
sudo apt purge package_name
apt-get
sudo apt-get purge package_name
4. Update Package Lists:
apt
sudo apt update
apt-get
sudo apt-get update
5. Upgrade Installed Packages
apt
sudo apt upgrade
apt-get
sudo apt-get upgrade
6. Full System Upgrade:
apt
sudo apt dist-upgrade
apt-get
sudo apt-get dist-upgrade
7. Search for a Package:
apt
sudo apt search search_term
apt-get
sudo apt-cache search search_term
8. Show Package Information:
apt
sudo apt show package_name
apt-get
sudo apt-cache show package_name
9. List Installed Packages:
apt
sudo apt list --installed
10. Clean Package Cache:
apt
sudo apt clean
apt-get
sudo apt-get clean
11. Autoremove Unused Packages:
apt
sudo apt autoremove
apt-get
sudo apt-get autoremove
2. yum Package Manager
The yum
package manager is used for installing, removing, and managing packages in Red Hat based OS such as RHEL, CentOS, and Fedora. This tool is used for managing .rpm packages.
yum Command Options
# | Uses | yum |
---|---|---|
1 | Install a package |
|
2 | Remove a Package: |
|
3 | Update Installed Packages: |
|
4 | Search for a Package: |
|
5 | List Installed Packages: |
|
6 | Show Package Information: |
|
7 | Clean Package Cache: |
|
3. dnf Package Manager
The dnf
stands for "Dandified yum". It is the more advanced version of yum and provides a more modern and improved package management experience compared to yum
.
dnf Command Options
# | Uses | dnf |
---|---|---|
1 | Install a package |
|
2 | Remove a Package: |
|
3 | Upgrade Installed Packages: |
|
4 | Search for a Package: |
|
5 | List Installed Packages: |
|
6 | Show Package Information: |
|
7 | Clean Package Cache: |
|
8 | Check for updates: |
|
9 | List Repositories: |
|
4. ZYPPER Package Manager
zypper
is the package management tool used in openSUSE and SUSE Linux Enterprise. Here are some common command line options for zypper
:
zypper Command Options
# | Uses | zypper |
---|---|---|
1 | Install a package |
|
2 | Remove a Package: |
|
3 | Update Installed Packages: |
|
4 | Search for a Package: |
|
5 | List Installed Packages: |
|
6 | Show Package Information: |
|
7 | Clean Package Cache: |
|
8 | Refresh Package Manager |
|
9 | List Repositories: |
|