Skip to main content
junior
beginner
Linux

Linux Package Management

Question

How do you install and manage software packages in Linux? What's the difference between apt and yum?

Answer

Package managers handle software installation, updates, and dependencies. apt (Debian/Ubuntu) and yum/dnf (RHEL/CentOS/Fedora) are the main ones. apt uses .deb packages, yum uses .rpm. Basic commands: apt update && apt install package, yum install package. Both resolve dependencies automatically.

Why This Matters

Understanding package management is essential for setting up servers, installing dependencies, and maintaining system security through updates. Different distributions use different package managers, so knowing both apt and yum families is valuable.

Code Examples

apt commands (Debian/Ubuntu)

bash

yum/dnf commands (RHEL/CentOS)

bash
Common Mistakes
  • Forgetting to run apt update before installing new packages
  • Running apt upgrade in production without testing first
  • Not understanding that apt and yum are for different distros
Follow-up Questions
Interviewers often ask these as follow-up questions
  • What are PPAs and how do you add third-party repositories?
  • How would you pin a package to a specific version?
  • What's the difference between apt and apt-get?
Tags
linux
apt
yum
package-management
sysadmin