-
-
Notifications
You must be signed in to change notification settings - Fork 2
Linux Package Management
Complete beginner-friendly guide to package management on Linux, covering Arch Linux, CachyOS, and other distributions using pacman, AUR helpers, and package repositories.
- Understanding Package Management
- Pacman Basics (Arch/CachyOS)
- Installing Packages
- Removing Packages
- Updating System
- Searching Packages
- Arch User Repository (AUR)
- AUR Helpers
- Other Distribution Package Managers
- Troubleshooting
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 (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
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
Basic installation:
# Install a package
sudo pacman -S package-name
# Example: Install Firefox
sudo pacman -S firefoxWhat happens:
- Downloads package
- Resolves dependencies
- Installs package
- Updates package database
Install several packages:
# Install multiple packages
sudo pacman -S package1 package2 package3
# Example
sudo pacman -S firefox vim gitInstall package groups:
# List groups
pacman -Sg
# Install group
sudo pacman -S gnomeBasic removal:
# Remove package
sudo pacman -R package-name
# Remove with dependencies
sudo pacman -Rs package-name
# Remove with config files
sudo pacman -Rns package-nameRemove unused packages:
# List orphans
pacman -Qdt
# Remove orphans
sudo pacman -Rns $(pacman -Qdtq)Refresh package list:
# Update database and upgrade (recommended method)
# Note: Always use -Syu together to avoid dependency issues
sudo pacman -SyuWhat -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 what will be updated:
# Check updates
pacman -QuSearch for packages:
# Search by name
pacman -Ss package-name
# Example
pacman -Ss firefoxSearch installed packages:
# Search installed
pacman -Qs package-nameAUR (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
Manual installation:
# Clone AUR package
git clone https://aur.archlinux.org/package-name.git
cd package-name
# Build and install
makepkg -siInstall yay:
# Install yay
sudo pacman -S yay
# Or from AUR
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -siUse yay:
# Install from AUR
yay -S package-name
# Update AUR packages
yay -Sua
# Update everything
yay -SyuInstall paru:
# Install paru
yay -S paru
# Or from AUR
git clone https://aur.archlinux.org/paru.git
cd paru
makepkg -siUse paru:
# Install from AUR
paru -S package-name
# Update AUR packages
paru -SuaBasic commands:
# Update
sudo apt update
sudo apt upgrade
# Install
sudo apt install package-name
# Remove
sudo apt remove package-nameBasic commands:
# Update
sudo dnf update
# Install
sudo dnf install package-name
# Remove
sudo dnf remove package-nameBasic commands:
# Update
sudo zypper update
# Install
sudo zypper install package-name
# Remove
sudo zypper remove package-nameResolve conflicts:
# Check conflicts
pacman -Qkk
# Force reinstall
sudo pacman -S package-name --overwrite "*"Fix dependencies:
# Check dependencies
pacman -Dk
# Fix broken packages
sudo pacman -SyuClear cache:
# Check cache size
du -sh /var/cache/pacman/pkg
# Clean cache
sudo pacman -Sc
# Clean all cache
sudo pacman -SccThis guide covered package management for Arch Linux, CachyOS, and other distributions, including pacman, AUR, and troubleshooting.
- Repository Configuration - Repository setup
- Package Cleaning - Package maintenance
- ArchWiki Pacman: https://wiki.archlinux.org/title/Pacman
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.