How to Manage Packages with apt and yum in Linux


 Introduction


Package managers are essential tools in Linux that allow you to install, update, and remove software easily. Two of the most common package managers are apt (used in Debian-based distributions like Ubuntu) and yum (used in Red Hat-based distributions like CentOS). In this guide, we will learn how to manage software packages using these tools.


Step 1: Update Package Index


Before installing or upgrading packages, always update the package index:


For apt (Debian/Ubuntu):


sudo apt update


For yum (CentOS/RedHat):


sudo yum check-update


Step 2: Install a Package


To install a package, use:


For apt:


sudo apt install packagename


For yum:


sudo yum install packagename


➡️ Replace packagename with the name of the software you want to install.


Step 3: Remove a Package


To uninstall software:


For apt:


sudo apt remove packagename


For yum:


sudo yum remove packagename


Step 4: Upgrade Installed Packages


To upgrade all installed packages:


For apt:


sudo apt upgrade


For yum:


sudo yum update


Step 5: Search for a Package


To find available packages:


For apt:


apt search keyword


For yum:


yum search keyword


Conclusion

Knowing how to use package managers like apt and yum is vital for Linux system administration. They simplify software installation, upgrades, and removal, making system management more efficient.

Comments