Operations 22 min read

Master yum: Local & Remote Repository Setup and Essential Package Commands

This guide walks through mounting an ISO to create a local yum repository, configuring popular Chinese mirrors for remote repos, and demonstrates core yum/dnf commands for installing, removing, updating, listing, grouping, reinstalling, and downloading packages, plus how to view and undo command history on CentOS 8.5 systems.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master yum: Local & Remote Repository Setup and Essential Package Commands

yum repository management

1. yum local repository

Mount the installation image and create a custom repository file in /etc/yum.repos.d/ with appropriate baseurl, gpgcheck, and enabled settings.

# cd /etc/yum.repos.d/
# ls
# rm -rf *
# vim xbz.repo
# cat xbz.repo
[BaseOS]
name=111
baseurl=file:///mnt/BaseOS
gpgcheck=0
enabled=1
[AppStream]
name=222
baseurl=file:///mnt/AppStream
gpgcheck=0
enabled=1
# mount /dev/cdrom /mnt/
# dnf clean all
# dnf list all
# dnf makecache
# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo

2. yum network repository

Replace the default remote repository with domestic mirrors such as Aliyun, 163, and Tsinghua to improve download speed.

# rm -rf *
# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
# yum makecache
# dnf repolist all
# dnf repolist enabled
# dnf repolist disabled

3. yum management commands

Common options for installing and removing packages, illustrated with vim, wget, and man-db.

# dnf -y install vim
# dnf -y remove vim
# dnf -y install --nogpgcheck wget
# dnf -y install wget
# dnf -q install wget
# dnf -y update man-db
# dnf info man-db
# dnf history
# dnf history info 2
# dnf history undo 20

Additional useful commands include listing all packages, available updates, cleaning caches, and querying repository information.

# dnf list all | grep curl
# dnf list updates
# dnf list installed
# dnf list available
# dnf list updates | grep man-db
# dnf list all | grep man-db
# dnf list all | grep wget
# dnf list installed | grep wget
# rpm -qc wget
# dnf -y reinstall wget
# dnf -y install --downloadonly --downloaddir /tushanbu/ zstd
# dnf grouplist
# dnf groups mark install -y "System Tools"
# dnf grouplist -y

These commands cover package installation, removal, upgrades, history inspection, group management, reinstalling, and downloading packages without installing them.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxRepositorypackage managementdnfyum
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.