Repository_management
Chapter 31: Repository Management
Section titled “Chapter 31: Repository Management”Overview
Section titled “Overview”This chapter covers managing software repositories for different Linux distributions.
30.1 Repository Concepts
Section titled “30.1 Repository Concepts”Repository Types
Section titled “Repository Types” Repository Types+------------------------------------------------------------------+| || Main/Base Repository || +------------------------------------------------------------+ || | Core packages supported by distribution | || +------------------------------------------------------------+ || || Updates Repository || +------------------------------------------------------------+ || | Security updates and bug fixes | || +------------------------------------------------------------+ || || Third-Party Repositories || +------------------------------------------------------------+ || | Vendor-specific (nginx, docker, nodejs) | || | Community (EPEL, AUR, Community) | || +------------------------------------------------------------+ || || Testing/Unstable || +------------------------------------------------------------+ || | Pre-release packages | || +------------------------------------------------------------+ || |+------------------------------------------------------------------+30.2 Arch Linux Repositories
Section titled “30.2 Arch Linux Repositories”Official Repositories
Section titled “Official Repositories”[core]Include = /etc/pacman.d/mirrorlist
[extra]Include = /etc/pacman.d/mirrorlist
[multilib]Include = /etc/pacman.d/mirrorlist
[community]Include = /etc/pacman.d/mirrorlistArch User Repository (AUR)
Section titled “Arch User Repository (AUR)”# Using yay (AUR helper)yay -S package_name
# Manual AUR buildgit clone https://aur.archlinux.org/package_name.gitcd package_namemakepkg -si
# AUR utilitiesyay -Syu --aur # Upgrade AUR packagesyay -Qm # List explicitly installed AUR packagesCreating Local Repository
Section titled “Creating Local Repository”# Create repo directorysudo mkdir /opt/packagessudo cp *.pkg.tar.zst /opt/packages/
# Create databasecd /opt/packagesrepo-add custom.db.tar.gz *.pkg.tar.zst
# Add to pacman.conf[custom]Server = file:///opt/packages30.3 Debian/Ubuntu Repositories
Section titled “30.3 Debian/Ubuntu Repositories”Repository Types
Section titled “Repository Types”# main - Free software, supported by Debian# contrib - Free software, depends on non-free# non-free - Non-free software# restricted - Device drivers# universe - Community-maintained packages
# Debian release categories# stable - Current stable release# testing - Testing distribution# unstable - Rolling development (sid)# experimental - Pre-release testingAdding Repositories
Section titled “Adding Repositories”# Add repository (Ubuntu)sudo add-apt-repository ppa:nginx/stablesudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu focal main restricted"
# Add repository (Debian)echo "deb http://deb.debian.org/debian bookworm main" | sudo tee /etc/apt/sources.list.d/bookworm.listsudo apt updateRepository Priority (Pinning)
Section titled “Repository Priority (Pinning)”Package: *Pin: release a=stablePin-Priority: 900
Package: *Pin: release a=testingPin-Priority: 10030.4 RHEL/CentOS/Fedora Repositories
Section titled “30.4 RHEL/CentOS/Fedora Repositories”EPEL (Extra Packages for Enterprise Linux)
Section titled “EPEL (Extra Packages for Enterprise Linux)”# Install EPELsudo dnf install epel-releasesudo dnf update
# EPEL configurationcat /etc/yum.repos.d/epel.repoThird-Party Repositories
Section titled “Third-Party Repositories”# Nginxsudo yum-config-manager --add-repo https://nginx.org/packages/mainline/rhel/8/x86_64/
# Dockersudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# PostgreSQLsudo yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpmSubscription Manager (RHEL)
Section titled “Subscription Manager (RHEL)”# Register systemsudo subscription-manager register --username USER --password PASS --auto-attach
# List available repossudo subscription-manager repos --list
# Enable/disable repossudo subscription-manager repos --enable rhel-8-for-x86_64-baseos-rpmssudo subscription-manager repos --disable rhel-8-for-x86_64-baseos-rpms30.5 Mirrors Management
Section titled “30.5 Mirrors Management”Using Fastest Mirror
Section titled “Using Fastest Mirror”# Arch Linux - rankmirrorssudo pacman-mirrors --fasttrack
# Or manually ranksudo pacman-mirrors -i -c United_States
# Debian# Install netselect-aptsudo apt install netselect-aptsudo netselect -v -s 1 -t 20 ftp.de.debian.org debian.orgCreating Mirror List
Section titled “Creating Mirror List”# /etc/pacman.d/mirrorlist - Arch exampleServer = https://mirror.us.ArchLinux.org/$repo/os/$archServer = https://mirrors.kernel.org/archlinux/$repo/os/$archServer = https://mirror.0xsystems.com/archlinux/$repo/os/$arch30.6 Repository Security
Section titled “30.6 Repository Security”GPG Keys
Section titled “GPG Keys”# Arch - refresh keyssudo pacman-key --refresh-keys
# Debiansudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys GPG_KEYsudo apt-key del KEYID
# RHELsudo rpm --import /path/to/RPM-GPG-KEYPackage Signing
Section titled “Package Signing”# Verify package signaturerpm -K package.rpmdpkg-sig --verify package.deb
# Import key before adding repogpg --keyserver keyserver.ubuntu.com --recv-keys GPG_KEYgpg --export GPG_KEY | sudo apt-key add -30.7 Repository Caching
Section titled “30.7 Repository Caching”Proxy Cache
Section titled “Proxy Cache”# apt-cacher-ngsudo apt install apt-cacher-ng# Configure clientsAcquire::http::Proxy "http://server:3142";yum/dnf Cache
Section titled “yum/dnf Cache”# Clean cachesudo dnf clean all
# Keep cache for offline usesudo dnf cache --optimize30.8 Repository Synchronization
Section titled “30.8 Repository Synchronization”rsync Mirrors
Section titled “rsync Mirrors”# Basic rsync for local mirrorrsync -avSH --delete \ rsync://rsync.archlinux.org/ftp_tls \ /path/to/local/mirror/
# Schedule with cron# /etc/cron.d/mirror-sync0 2 * * * rsync -aSH --delete rsync://... /path/to/mirror/Summary
Section titled “Summary”In this chapter, you learned:
- ✅ Repository types and concepts
- ✅ Arch Linux AUR and custom repos
- ✅ Debian/Ubuntu repository management
- ✅ RHEL/CentOS repositories and EPEL
- ✅ Mirror management
- ✅ Repository security (GPG keys)
Next Chapter
Section titled “Next Chapter”Chapter 31: Linux Security Basics - SELinux, AppArmor
Last Updated: February 2026