Skip to content

Linux Package Management

Mattscreative edited this page Dec 5, 2025 · 4 revisions

Linux Package Management Guide

Complete beginner-friendly guide to package management on Linux, covering Arch Linux, CachyOS, and other distributions using pacman, AUR helpers, and package repositories.


Table of Contents

  1. Understanding Package Management
  2. Pacman Basics (Arch/CachyOS)
  3. Installing Packages
  4. Removing Packages
  5. Updating System
  6. Searching Packages
  7. Arch User Repository (AUR)
  8. AUR Helpers
  9. Other Distribution Package Managers
  10. Troubleshooting

Understanding Package Management

What is Package Management?

Package management is the process of installing, updating, and removing software on your system.

What is a package?

  • Package: A compressed archive containing software and its files
  • Contains: Program files, configuration files, documentation, dependencies
  • Purpose: Makes installing software easy and organized

Why package management matters:

  • Easy installation: Install software with one command
  • Dependency handling: Automatically installs required libraries
  • Updates: Easy to update all software at once
  • Removal: Cleanly removes software and its files
  • Security: Packages are verified and signed

Pacman Basics (Arch/CachyOS)

What is Pacman?

pacman (Package Manager) is the official package manager for Arch Linux, CachyOS, and other Arch-based distributions.

What it does:

  • Installs, updates, and removes packages
  • Manages dependencies automatically
  • Syncs with package repositories
  • Verifies package integrity

Basic Syntax

General format:

pacman [options] [package(s)]

Common options:

  • -S: Sync (install/update)
  • -R: Remove
  • -U: Upgrade (from file)
  • -Q: Query (local database)
  • -Syu: Sync, update, upgrade

Installing Packages

Install Single Package

Basic installation:

# Install a package
sudo pacman -S package-name

# Example: Install Firefox
sudo pacman -S firefox

What happens:

  1. Downloads package
  2. Resolves dependencies
  3. Installs package
  4. Updates package database

Install Multiple Packages

Install several packages:

# Install multiple packages
sudo pacman -S package1 package2 package3

# Example
sudo pacman -S firefox vim git

Install from Group

Install package groups:

# List groups
pacman -Sg

# Install group
sudo pacman -S gnome

Removing Packages

Remove Package

Basic removal:

# Remove package
sudo pacman -R package-name

# Remove with dependencies
sudo pacman -Rs package-name

# Remove with config files
sudo pacman -Rns package-name

Remove Orphans

Remove unused packages:

# List orphans
pacman -Qdt

# Remove orphans
sudo pacman -Rns $(pacman -Qdtq)

Updating System

Update Package Database

Refresh package list:

# Update database and upgrade (recommended method)
# Note: Always use -Syu together to avoid dependency issues
sudo pacman -Syu

What -Syu does:

  • -S: Sync (install/update packages)
  • -y: Refresh package database (download latest package lists)
  • -u: Upgrade installed packages (update to newer versions)

Note: Always use -Syu together. Using -Sy without -u can cause dependency issues.

Check for Updates

Check what will be updated:

# Check updates
pacman -Qu

Searching Packages

Search Repositories

Search for packages:

# Search by name
pacman -Ss package-name

# Example
pacman -Ss firefox

Search Installed

Search installed packages:

# Search installed
pacman -Qs package-name

Arch User Repository (AUR)

What is AUR?

AUR (Arch User Repository) is a community-driven repository for Arch-based distributions.

Features:

  • Community-maintained packages
  • Not in official repositories
  • Built from source
  • User-contributed

Installing from AUR

Manual installation:

# Clone AUR package
git clone https://aur.archlinux.org/package-name.git
cd package-name

# Build and install
makepkg -si

AUR Helpers

yay

Install yay:

# Install yay
sudo pacman -S yay

# Or from AUR
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si

Use yay:

# Install from AUR
yay -S package-name

# Update AUR packages
yay -Sua

# Update everything
yay -Syu

paru

Install paru:

# Install paru
yay -S paru

# Or from AUR
git clone https://aur.archlinux.org/paru.git
cd paru
makepkg -si

Use paru:

# Install from AUR
paru -S package-name

# Update AUR packages
paru -Sua

Other Distribution Package Managers

Debian/Ubuntu (apt)

Basic commands:

# Update
sudo apt update
sudo apt upgrade

# Install
sudo apt install package-name

# Remove
sudo apt remove package-name

Fedora (dnf)

Basic commands:

# Update
sudo dnf update

# Install
sudo dnf install package-name

# Remove
sudo dnf remove package-name

openSUSE (zypper)

Basic commands:

# Update
sudo zypper update

# Install
sudo zypper install package-name

# Remove
sudo zypper remove package-name

Troubleshooting

Package Conflicts

Resolve conflicts:

# Check conflicts
pacman -Qkk

# Force reinstall
sudo pacman -S package-name --overwrite "*"

Broken Dependencies

Fix dependencies:

# Check dependencies
pacman -Dk

# Fix broken packages
sudo pacman -Syu

Cache Issues

Clear cache:

# Check cache size
du -sh /var/cache/pacman/pkg

# Clean cache
sudo pacman -Sc

# Clean all cache
sudo pacman -Scc

Summary

This guide covered package management for Arch Linux, CachyOS, and other distributions, including pacman, AUR, and troubleshooting.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.

Clone this wiki locally