⬇️ Installing and Removing Packages
Debian-based systems (like Ubuntu) have two main tools for package management: apt and dpkg. Think of them as two levels of helpers: one high-level, one low-level.
a. apt – The High-Level Helper
apt is like your personal shopping assistant.
It handles everything automatically:
- Finds packages in the repo →
- Downloads them →
- Installs dependencies →
- Updates packages →
Common commands:
- sudo apt update → Refresh the list of available packages (like checking the store's stock).
- sudo apt install package_name → Install a package.
- sudo apt remove package_name → Remove a package.
- sudo apt upgrade → Update all installed packages to the latest version.
Analogy:
You tell the assistant "I want a blender," and it grabs the blender plus all the attachments from the store.
b. dpkg – The Low-Level Tool
dpkg is like handling the products yourself.
It installs .deb files directly from your computer.
Doesn't automatically fetch dependencies. You have to handle them manually.
Common commands:
- sudo dpkg -i package_file.deb → Install a local .deb package.
- sudo dpkg -r package_name → Remove a package.
- dpkg -l → List installed packages.
Analogy:
You bring the blender home and try to assemble it yourself. If something is missing, you have to go back to the store to get the parts.
c. When to Use Which
- Use apt for most tasks → safer, automatic, easier.
- Use dpkg when you download a package manually (like from a website) → .
Real-life analogy
💡 Quick Analogy Recap:
apt = shopping assistant (automatic, easy, safe)
dpkg = DIY shopper (manual, needs extra attention)
We're ready to move to 4️⃣ RedHat/CentOS Package Tools (yum, dnf, rpm).
Shall I continue?