Chapter 3: Linux Basic Commands
3.7 Package managers
Think of a package manager like the Play Store on your mobile – you ask for an app and it downloads it from a trusted store, along with all the dependencies it needs. But technically, a package manager fetches signed packages from configured repositories and resolves dependencies. Look, the commands differ a little by distribution:
पॅकेज मॅनेजरला मोबाइलमधल्या Play Store सारखं समजा – ॲप मागितलं की तो trusted स्टोअरमधून डाउनलोड करतो, आणि त्याला लागणारे सगळे dependencies सुद्धा. पण टेक्निकली, पॅकेज मॅनेजर configured repositories मधून signed packages आणतो आणि dependencies resolve करतो. बघा, कमांड्स डिस्ट्रिब्युशनप्रमाणे थोड्या वेगळ्या आहेत:
पैकेज मैनेजर को मोबाइल के Play Store जैसा समझो – ऐप माँगा तो वो trusted स्टोर से डाउनलोड करता है, और उसके लिए ज़रूरी सारी dependencies भी. लेकिन टेक्निकली, पैकेज मैनेजर configured repositories से signed packages लाता है और dependencies resolve करता है. देखो, कमांड्स डिस्ट्रीब्यूशन के हिसाब से थोड़ी अलग हैं:
A package manager downloads software from trusted repositories, installs dependencies automatically, and handles updates.
| Task | Ubuntu / Debian (apt) |
Amazon Linux 2023, Amazon Linux 2, CentOS Stream 9 (yum) |
|---|---|---|
| Refresh package list | sudo apt update |
(automatic) sudo yum makecache |
| Upgrade all | sudo apt upgrade -y |
sudo yum update -y |
| Install | sudo apt install -y nginx |
sudo yum install -y nginx* |
| Remove | sudo apt remove nginx (purge removes config too) |
sudo yum remove nginx |
| Search | apt search php |
yum search php |
| Info | apt show nginx |
yum info nginx |
| List installed | apt list --installed |
yum list installed |
| Which package gives a file | dpkg -S /usr/sbin/nginx |
yum provides /usr/sbin/nginx |
| Clean cache | sudo apt autoremove && sudo apt clean |
sudo yum clean all |
| Package file format | .deb (dpkg -i) |
.rpm (rpm -i) |
* On Amazon Linux 2, some packages come from amazon-linux-extras (e.g. sudo amazon-linux-extras install nginx1). Amazon Linux 2023 has no amazon-linux-extras; everything is in the regular repositories.
yum or dnf? Kalji karu naka
In this book I use yum on Amazon Linux and CentOS because it works everywhere in the Red Hat family. On newer systems (Amazon Linux 2023, CentOS Stream 9, RHEL 9) yum is simply an alias that actually runs dnf, the newer package manager — so when you see dnf install ... in online guides, it is the same thing. Same options, same repositories.
CentOS Stream: enable EPEL for extra packages
Some tools (e.g. htop, certbot) come from the EPEL repository: sudo yum install -y epel-release on CentOS Stream 9.
Ravindra Bagale's Tip
Many students type apt install on Amazon Linux and get command not found. First look at cat /etc/os-release: Amazon Linux/CentOS = sudo yum, Ubuntu = sudo apt. And if an online guide shows dnf, don't worry – on AL2023 yum does the same job.
Ravindra Bagale's Tip – मराठी
बरेच students Amazon Linux वर apt install type करतात आणि command not found येतं. आधी cat /etc/os-release बघा: Amazon Linux/CentOS = sudo yum, Ubuntu = sudo apt. आणि online guide मध्ये dnf दिसला तर घाबरू नका – AL2023 वर yum तेच काम करतो.
Ravindra Bagale's Tip – हिंदी
बहुत से students Amazon Linux पर apt install type करते हैं और command not found आता है. पहले cat /etc/os-release देखो: Amazon Linux/CentOS = sudo yum, Ubuntu = sudo apt. और online guide में dnf दिखे तो घबराओ मत – AL2023 पर yum वही काम करता है.
Lab
Chala, tumchya Amazon Linux 2023 instance var sudo yum install -y tree kara, mag yum info tree aani yum list installed | grep tree chalva. Shevti sudo yum remove -y tree karun tree command aata chalat nahi he check kara.
Got it? First identify the OS, then choose the package manager. Now let's move on to processes.
समजलं का? आधी OS ओळखा, मग पॅकेज मॅनेजर निवडा. आता पुढे जाऊया प्रोसेसेसकडे.
समझ आया? पहले OS पहचानो, फिर पैकेज मैनेजर चुनो. अब आगे चलते हैं प्रोसेसेस की तरफ़.