本文档风哥主要介绍dnf group命令的使用,包括dnf group命令的概念、dnf group命令语法、dnf group命令常用选项、dnf group基础操作详解、dnf group高级使用技巧、DNF软件包组管理自动化、服务器环境软件包组安装实战案例、桌面环境软件包组安装实战案例、DNF软件包组管理故障排查与解决等内容,参考Red Hat Enterprise Linux 10官方文档,适合Linux运维人员在学习和测试中使用,如果要应用于生产环境则需要自行确认。
Part01-基础概念与理论知识
1.1 dnf group命令的概念
dnf group命令是DNF软件包管理器中用于管理软件包组的命令。软件包组是一组相关的软件包的集合,可以一起安装、更新或卸载。dnf group命令可以列出可用的软件包组、安装软件包组、卸载软件包组、查看软件包组信息等。更多视频教程www.fgedu.net.cn
- 管理软件包组
- 批量安装相关软件包
- 简化软件包管理
- 支持软件包组信息查看
- 支持软件包组依赖管理
1.2 dnf group命令语法
dnf group命令语法:
- 列出软件包组:dnf group list
- 安装软件包组:dnf group install 组名
- 卸载软件包组:dnf group remove 组名
- 查看软件包组信息:dnf group info 组名
- 列出已安装软件包组:dnf group list installed
1.3 dnf group命令常用选项
dnf group命令常用选项:
- list:列出软件包组
- install:安装软件包组
- remove:卸载软件包组
- info:查看软件包组信息
- installed:列出已安装软件包组
- available:列出可用软件包组
- hidden:列出隐藏软件包组
- ids:显示软件包组ID
Part02-生产环境规划与建议
2.1 DNF软件包组管理在生产环境的规划
DNF软件包组管理在生产环境的规划要点:
– 服务器环境使用软件包组
– 桌面环境使用软件包组
– 开发环境使用软件包组
– 定期更新软件包组
– 监控软件包组状态
# DNF软件包组管理注意事项
– 了解软件包组内容
– 检查软件包组依赖
– 验证软件包组兼容性
– 选择合适的软件包组
– 定期更新软件包组
2.2 DNF软件包组管理最佳实践
DNF软件包组管理最佳实践:
- 了解内容:了解软件包组内容
- 检查依赖:检查软件包组依赖
- 验证兼容性:验证软件包组兼容性
- 选择合适:选择合适的软件包组
- 定期更新:定期更新软件包组
2.3 DNF软件包组管理安全配置建议
DNF软件包组管理安全配置建议:
- 最小权限:使用sudo执行命令
- 审计日志:启用DNF审计日志
- 备份:安装前备份系统
- 验证:安装后验证系统功能
- 回滚方案:准备回滚方案
Part03-生产环境项目实施方案
3.1 dnf group基础操作详解
3.1.1 列出软件包组
# dnf group list
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:01 ago on Thu Mar 31 10:00:00 2026.
Available Environment Groups:
Minimal Install
Server with GUI
Workstation
Custom Operating System
Available Groups:
Console Internet Tools
Development Tools
Headless Management
Legacy UNIX Compatibility
Network Servers
Scientific Support
Security Tools
Smart Card Support
System Tools
Installed Groups:
Core
Installed Environment Groups:
Minimal Install
3.1.2 查看软件包组信息
# dnf group info “Development Tools”
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:01 ago on Thu Mar 31 10:00:00 2026.
Group: Development Tools
Description: A basic development environment.
Mandatory Packages:
autoconf
automake
binutils
bison
flex
gcc
gcc-c++
gdb
glibc-devel
libtool
make
patch
pkgconf
pkgconf-m4
pkgconf-pkg-config
redhat-rpm-config
rpm-build
rpm-sign
strace
Optional Packages:
byacc
cscope
ctags
diffstat
doxygen
elfutils
git
indent
intltool
patchutils
rcs
subversion
swig
systemtap
Default Packages:
cmake
cvs
gettext
perl-CPAN
perl-Error
perl-Git
rsync
3.1.3 安装软件包组
# dnf group install -y “Development Tools”
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:01 ago on Thu Mar 31 10:00:00 2026.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing Groups:
Development Tools
Installing:
autoconf noarch 2.69-38.el9 appstream 708 k
automake noarch 1.16.1-8.el9 appstream 714 k
binutils x86_64 2.35.2-37.el9 baseos 5.8 M
bison x86_64 3.7.4-5.el9 appstream 1.0 M
flex x86_64 2.6.4-8.el9 appstream 338 k
gcc x86_64 11.3.1-4.3.el9_2 appstream 32 M
gcc-c++ x86_64 11.3.1-4.3.el9_2 appstream 13 M
gdb x86_64 10.2-9.el9 appstream 4.0 M
glibc-devel x86_64 2.34-60.el9_2 baseos 2.4 M
libtool x86_64 2.4.6-45.el9 appstream 588 k
make x86_64 1:4.3-7.el9 baseos 587 k
patch x86_64 2.7.6-16.el9 appstream 128 k
pkgconf x86_64 1.7.3-10.el9 baseos 41 k
pkgconf-m4 noarch 1.7.3-10.el9 baseos 14 k
pkgconf-pkg-config x86_64 1.7.3-10.el9 baseos 40 k
redhat-rpm-config noarch 199-1.el9 appstream 67 k
rpm-build x86_64 4.16.1.3-25.el9 baseos 126 k
rpm-sign x86_64 4.16.1.3-25.el9 baseos 84 k
strace x86_64 5.18-2.el9 appstream 414 k
Transaction Summary
================================================================================
Install 19 Packages
Total download size: 62.8 M
Installed size: 248 M
Downloading Packages:
(1/19): pkgconf-pkg-config-1.7.3-10.el9.x86_64.rpm 41 kB/s | 41 kB 00:00
(2/19): pkgconf-m4-1.7.3-10.el9.noarch.rpm 14 kB/s | 14 kB 00:00
(3/19): pkgconf-1.7.3-10.el9.x86_64.rpm 41 kB/s | 41 kB 00:00
…
(19/19): gcc-11.3.1-4.3.el9_2.x86_64.rpm 32 MB/s | 32 MB 00:00
——————————————————————————–
Total 62.8 MB/s | 62.8 MB 00:00
Running transaction check
Transaction test succeeded
Running transaction
Preparing : 1/1
Installing : pkgconf-m4-1.7.3-10.el9.noarch 1/19
Installing : pkgconf-pkg-config-1.7.3-10.el9.x86_64 2/19
Installing : pkgconf-1.7.3-10.el9.x86_64 3/19
…
Installing : gcc-11.3.1-4.3.el9_2.x86_64 19/19
Running scriptlet: gcc-11.3.1-4.3.el9_2.x86_64 19/19
Verifying : pkgconf-m4-1.7.3-10.el9.noarch 1/19
Verifying : pkgconf-pkg-config-1.7.3-10.el9.x86_64 2/19
Verifying : pkgconf-1.7.3-10.el9.x86_64 3/19
…
Verifying : gcc-11.3.1-4.3.el9_2.x86_64 19/19
Installed:
autoconf-2.69-38.el9.noarch
automake-1.16.1-8.el9.noarch
binutils-2.35.2-37.el9.x86_64
bison-3.7.4-5.el9.x86_64
flex-2.6.4-8.el9.x86_64
gcc-11.3.1-4.3.el9_2.x86_64
gcc-c++-11.3.1-4.3.el9_2.x86_64
gdb-10.2-9.el9.x86_64
glibc-devel-2.34-60.el9_2.x86_64
libtool-2.4.6-45.el9.x86_64
make-4.3-7.el9.x86_64
patch-2.7.6-16.el9.x86_64
pkgconf-1.7.3-10.el9.x86_64
pkgconf-m4-1.7.3-10.el9.noarch
pkgconf-pkg-config-1.7.3-10.el9.x86_64
redhat-rpm-config-199-1.el9.noarch
rpm-build-4.16.1.3-25.el9.x86_64
rpm-sign-4.16.1.3-25.el9.x86_64
strace-5.18-2.el9.x86_64
Complete!
3.1.4 卸载软件包组
# dnf group remove “Development Tools”
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:01 ago on Thu Mar 31 10:00:00 2026.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Removing Groups:
Development Tools
Removing:
autoconf noarch 2.69-38.el9 @appstream 708 k
automake noarch 1.16.1-8.el9 @appstream 714 k
binutils x86_64 2.35.2-37.el9 @baseos 5.8 M
bison x86_64 3.7.4-5.el9 @appstream 1.0 M
flex x86_64 2.6.4-8.el9 @appstream 338 k
gcc x86_64 11.3.1-4.3.el9_2 @appstream 32 M
gcc-c++ x86_64 11.3.1-4.3.el9_2 @appstream 13 M
gdb x86_64 10.2-9.el9 @appstream 4.0 M
glibc-devel x86_64 2.34-60.el9_2 @baseos 2.4 M
libtool x86_64 2.4.6-45.el9 @appstream 588 k
make x86_64 1:4.3-7.el9 @baseos 587 k
patch x86_64 2.7.6-16.el9 @appstream 128 k
pkgconf x86_64 1.7.3-10.el9 @baseos 41 k
pkgconf-m4 noarch 1.7.3-10.el9 @baseos 14 k
pkgconf-pkg-config x86_64 1.7.3-10.el9 @baseos 40 k
redhat-rpm-config noarch 199-1.el9 @appstream 67 k
rpm-build x86_64 4.16.1.3-25.el9 @baseos 126 k
rpm-sign x86_64 4.16.1.3-25.el9 @baseos 84 k
strace x86_64 5.18-2.el9 @appstream 414 k
Transaction Summary
================================================================================
Remove 19 Packages
Freed space: 248 M
Is this ok [y/N]: y
Running transaction check
Transaction test succeeded
Running transaction
Preparing : 1/1
Removing : autoconf-2.69-38.el9.noarch 1/19
Removing : automake-1.16.1-8.el9.noarch 2/19
Removing : binutils-2.35.2-37.el9.x86_64 3/19
…
Removing : gcc-11.3.1-4.3.el9_2.x86_64 19/19
Verifying : autoconf-2.69-38.el9.noarch 1/19
Verifying : automake-1.16.1-8.el9.noarch 2/19
Verifying : binutils-2.35.2-37.el9.x86_64 3/19
…
Verifying : gcc-11.3.1-4.3.el9_2.x86_64 19/19
Removed:
autoconf-2.69-38.el9.noarch
automake-1.16.1-8.el9.noarch
binutils-2.35.2-37.el9.x86_64
bison-3.7.4-5.el9.x86_64
flex-2.6.4-8.el9.x86_64
gcc-11.3.1-4.3.el9_2.x86_64
gcc-c++-11.3.1-4.3.el9_2.x86_64
gdb-10.2-9.el9.x86_64
glibc-devel-2.34-60.el9_2.x86_64
libtool-2.4.6-45.el9.x86_64
make-4.3-7.el9.x86_64
patch-2.7.6-16.el9.x86_64
pkgconf-1.7.3-10.el9.x86_64
pkgconf-m4-1.7.3-10.el9.noarch
pkgconf-pkg-config-1.7.3-10.el9.x86_64
redhat-rpm-config-199-1.el9.noarch
rpm-build-4.16.1.3-25.el9.x86_64
rpm-sign-4.16.1.3-25.el9.x86_64
strace-5.18-2.el9.x86_64
Complete!
3.2 dnf group高级使用技巧
3.2.1 列出已安装软件包组
# dnf group list installed
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:01 ago on Thu Mar 31 10:00:00 2026.
Installed Groups:
Core
Installed Environment Groups:
Minimal Install
3.2.2 列出可用软件包组
# dnf group list available
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:01 ago on Thu Mar 31 10:00:00 2026.
Available Environment Groups:
Minimal Install
Server with GUI
Workstation
Custom Operating System
Available Groups:
Console Internet Tools
Development Tools
Headless Management
Legacy UNIX Compatibility
Network Servers
Scientific Support
Security Tools
Smart Card Support
System Tools
3.3 DNF软件包组管理自动化
3.3.1 自动安装软件包组
# cat > /usr/local/bin/group-install.sh << 'EOF' #!/bin/bash # 软件包组安装脚本 if [ -z "$1" ]; then echo "Usage: $0
exit 1
fi
echo “=== Installing group: $1 ===”
dnf group info “$1”
echo “”
read -p “Do you want to install this group? (y/n): ” answer
if [ “$answer” = “y” ]; then
dnf group install -y “$1”
echo “=== Group $1 installed successfully ===”
else
echo “=== Installation cancelled ===”
fi
EOF
# 设置脚本执行权限
# chmod +x /usr/local/bin/group-install.sh
# 使用脚本安装软件包组
# /usr/local/bin/group-install.sh “Development Tools”
=== Installing group: Development Tools ===
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:01 ago on Thu Mar 31 10:00:00 2026.
Group: Development Tools
Description: A basic development environment.
Mandatory Packages:
autoconf
automake
binutils
bison
flex
gcc
gcc-c++
gdb
glibc-devel
libtool
make
patch
pkgconf
pkgconf-m4
pkgconf-pkg-config
redhat-rpm-config
rpm-build
rpm-sign
strace
Do you want to install this group? (y/n): y
Updating Subscription Management repositories.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing Groups:
Development Tools
Installing:
autoconf noarch 2.69-38.el9 appstream 708 k
automake noarch 1.16.1-8.el9 appstream 714 k
binutils x86_64 2.35.2-37.el9 baseos 5.8 M
bison x86_64 3.7.4-5.el9 appstream 1.0 M
flex x86_64 2.6.4-8.el9 appstream 338 k
gcc x86_64 11.3.1-4.3.el9_2 appstream 32 M
gcc-c++ x86_64 11.3.1-4.3.el9_2 appstream 13 M
gdb x86_64 10.2-9.el9 appstream 4.0 M
glibc-devel x86_64 2.34-60.el9_2 baseos 2.4 M
libtool x86_64 2.4.6-45.el9 appstream 588 k
make x86_64 1:4.3-7.el9 baseos 587 k
patch x86_64 2.7.6-16.el9 appstream 128 k
pkgconf x86_64 1.7.3-10.el9 baseos 41 k
pkgconf-m4 noarch 1.7.3-10.el9 baseos 14 k
pkgconf-pkg-config x86_64 1.7.3-10.el9 baseos 40 k
redhat-rpm-config noarch 199-1.el9 appstream 67 k
rpm-build x86_64 4.16.1.3-25.el9 baseos 126 k
rpm-sign x86_64 4.16.1.3-25.el9 baseos 84 k
strace x86_64 5.18-2.el9 appstream 414 k
Transaction Summary
================================================================================
Install 19 Packages
Total download size: 62.8 M
Installed size: 248 M
Downloading Packages:
(1/19): pkgconf-pkg-config-1.7.3-10.el9.x86_64.rpm 41 kB/s | 41 kB 00:00
(2/19): pkgconf-m4-1.7.3-10.el9.noarch.rpm 14 kB/s | 14 kB 00:00
(3/19): pkgconf-1.7.3-10.el9.x86_64.rpm 41 kB/s | 41 kB 00:00
…
(19/19): gcc-11.3.1-4.3.el9_2.x86_64.rpm 32 MB/s | 32 MB 00:00
——————————————————————————–
Total 62.8 MB/s | 62.8 MB 00:00
Running transaction check
Transaction test succeeded
Running transaction
Preparing : 1/1
Installing : pkgconf-m4-1.7.3-10.el9.noarch 1/19
Installing : pkgconf-pkg-config-1.7.3-10.el9.x86_64 2/19
Installing : pkgconf-1.7.3-10.el9.x86_64 3/19
…
Installing : gcc-11.3.1-4.3.el9_2.x86_64 19/19
Running scriptlet: gcc-11.3.1-4.3.el9_2.x86_64 19/19
Verifying : pkgconf-m4-1.7.3-10.el9.noarch 1/19
Verifying : pkgconf-pkg-config-1.7.3-10.el9.x86_64 2/19
Verifying : pkgconf-1.7.3-10.el9.x86_64 3/19
…
Verifying : gcc-11.3.1-4.3.el9_2.x86_64 19/19
Installed:
autoconf-2.69-38.el9.noarch
automake-1.16.1-8.el9.noarch
binutils-2.35.2-37.el9.x86_64
bison-3.7.4-5.el9.x86_64
flex-2.6.4-8.el9.x86_64
gcc-11.3.1-4.3.el9_2.x86_64
gcc-c++-11.3.1-4.3.el9_2.x86_64
gdb-10.2-9.el9.x86_64
glibc-devel-2.34-60.el9_2.x86_64
libtool-2.4.6-45.el9.x86_64
make-4.3-7.el9.x86_64
patch-2.7.6-16.el9.x86_64
pkgconf-1.7.3-10.el9.x86_64
pkgconf-m4-1.7.3-10.el9.noarch
pkgconf-pkg-config-1.7.3-10.el9.x86_64
redhat-rpm-config-199-1.el9.noarch
rpm-build-4.16.1.3-25.el9.x86_64
rpm-sign-4.16.1.3-25.el9.x86_64
strace-5.18-2.el9.x86_64
Complete!
=== Group Development Tools installed successfully ===
Part04-生产案例与实战讲解
4.1 服务器环境软件包组安装实战案例
4.1.1 安装服务器环境软件包组
# dnf group list
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:01 ago on Thu Mar 31 10:00:00 2026.
Available Environment Groups:
Minimal Install
Server with GUI
Workstation
Custom Operating System
Available Groups:
Console Internet Tools
Development Tools
Headless Management
Legacy UNIX Compatibility
Network Servers
Scientific Support
Security Tools
Smart Card Support
System Tools
Installed Groups:
Core
Installed Environment Groups:
Minimal Install
# 2. 查看Network Servers软件包组信息
# dnf group info “Network Servers”
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:01 ago on Thu Mar 31 10:00:00 2026.
Group: Network Servers
Description: Common network servers (DNS, DHCP, etc.)
Mandatory Packages:
dhcp-server
bind
bind-utils
Optional Packages:
dnsmasq
krb5-server
openldap-servers
ypbind
ypserv
Default Packages:
None
# 3. 安装Network Servers软件包组
# dnf group install -y “Network Servers”
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:01 ago on Thu Mar 31 10:00:00 2026.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing Groups:
Network Servers
Installing:
bind x86_64 32:9.16.23-1.el9 appstream 2.8 M
bind-utils x86_64 32:9.16.23-1.el9 appstream 1.2 M
dhcp-server x86_64 12:4.4.2-17.el9 appstream 1.0 M
Transaction Summary
================================================================================
Install 3 Packages
Total download size: 5.0 M
Installed size: 12.8 M
Downloading Packages:
(1/3): bind-utils-9.16.23-1.el9.x86_64.rpm 1.2 MB/s | 1.2 MB 00:00
(2/3): dhcp-server-4.4.2-17.el9.x86_64.rpm 1.0 MB/s | 1.0 MB 00:00
(3/3): bind-9.16.23-1.el9.x86_64.rpm 2.8 MB/s | 2.8 MB 00:00
——————————————————————————–
Total 5.0 MB/s | 5.0 MB 00:00
Running transaction check
Transaction test succeeded
Running transaction
Preparing : 1/1
Installing : bind-utils-32:9.16.23-1.el9.x86_64 1/3
Installing : bind-32:9.16.23-1.el9.x86_64 2/3
Installing : dhcp-server-12:4.4.2-17.el9.x86_64 3/3
Running scriptlet: dhcp-server-12:4.4.2-17.el9.x86_64 3/3
Verifying : bind-utils-32:9.16.23-1.el9.x86_64 1/3
Verifying : bind-32:9.16.23-1.el9.x86_64 2/3
Verifying : dhcp-server-12:4.4.2-17.el9.x86_64 3/3
Installed:
bind-32:9.16.23-1.el9.x86_64
bind-utils-32:9.16.23-1.el9.x86_64
dhcp-server-12:4.4.2-17.el9.x86_64
Complete!
# 4. 验证软件包组已安装
# dnf group list installed
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:01 ago on Thu Mar 31 10:00:00 2026.
Installed Groups:
Core
Network Servers
Installed Environment Groups:
Minimal Install
4.2 桌面环境软件包组安装实战案例
4.2.1 安装桌面环境软件包组
# dnf group list
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:01 ago on Thu Mar 31 10:00:00 2026.
Available Environment Groups:
Minimal Install
Server with GUI
Workstation
Custom Operating System
Available Groups:
Console Internet Tools
Development Tools
Headless Management
Legacy UNIX Compatibility
Network Servers
Scientific Support
Security Tools
Smart Card Support
System Tools
Installed Groups:
Core
Installed Environment Groups:
Minimal Install
# 2. 查看Server with GUI环境组信息
# dnf group info “Server with GUI”
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:01 ago on Thu Mar 31 10:00:00 2026.
Environment Group: Server with GUI
Description: An integrated, easy-to-manage server with a GUI.
Mandatory Groups:
Core
Server
Optional Groups:
Console Internet Tools
Development Tools
Headless Management
Legacy UNIX Compatibility
Network Servers
Scientific Support
Security Tools
Smart Card Support
System Tools
# 3. 安装Server with GUI环境组
# dnf group install -y “Server with GUI”
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:01 ago on Thu Mar 31 10:00:00 2026.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing Groups:
Server with GUI
Installing:
gnome-session-xsession x86_64 40.0-5.el9 appstream 22 k
gnome-shell x86_64 40.0-5.el9 appstream 1.8 M
gnome-shell-extensions noarch 40.0-5.el9 appstream 5.2 M
xorg-x11-server-Xorg x86_64 1.20.11-17.el9 appstream 1.8 M
Transaction Summary
================================================================================
Install 4 Packages
Total download size: 8.8 M
Installed size: 35.2 M
Downloading Packages:
(1/4): gnome-session-xsession-40.0-5.el9.x86_64.rpm 22 kB/s | 22 kB 00:00
(2/4): xorg-x11-server-Xorg-1.20.11-17.el9.x86_64.rpm 1.8 MB/s | 1.8 MB 00:00
(3/4): gnome-shell-40.0-5.el9.x86_64.rpm 1.8 MB/s | 1.8 MB 00:00
(4/4): gnome-shell-extensions-40.0-5.el9.noarch.rpm 5.2 MB/s | 5.2 MB 00:00
——————————————————————————–
Total 8.8 MB/s | 8.8 MB 00:00
Running transaction check
Transaction test succeeded
Running transaction
Preparing : 1/1
Installing : gnome-session-xsession-40.0-5.el9.x86_64 1/4
Installing : xorg-x11-server-Xorg-1.20.11-17.el9.x86_64 2/4
Installing : gnome-shell-40.0-5.el9.x86_64 3/4
Installing : gnome-shell-extensions-40.0-5.el9.noarch 4/4
Running scriptlet: gnome-shell-extensions-40.0-5.el9.noarch 4/4
Verifying : gnome-session-xsession-40.0-5.el9.x86_64 1/4
Verifying : xorg-x11-server-Xorg-1.20.11-17.el9.x86_64 2/4
Verifying : gnome-shell-40.0-5.el9.x86_64 3/4
Verifying : gnome-shell-extensions-40.0-5.el9.noarch 4/4
Installed:
gnome-session-xsession-40.0-5.el9.x86_64
gnome-shell-40.0-5.el9.x86_64
gnome-shell-extensions-40.0-5.el9.noarch
xorg-x11-server-Xorg-1.20.11-17.el9.x86_64
Complete!
# 4. 验证环境组已安装
# dnf group list installed
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:01 ago on Thu Mar 31 10:00:00 2026.
Installed Groups:
Core
Network Servers
Installed Environment Groups:
Server with GUI
4.3 DNF软件包组管理故障排查与解决
4.3.1 软件包组安装失败
# 分析步骤:
# 1. 查看错误信息
# dnf group install “Development Tools”
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:01 ago on Thu Mar 31 10:00:00 2026.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing Groups:
Development Tools
Installing:
autoconf noarch 2.69-38.el9 appstream 708 k
automake noarch 1.16.1-8.el9 appstream 714 k
binutils x86_64 2.35.2-37.el9 baseos 5.8 M
bison x86_64 3.7.4-5.el9 appstream 1.0 M
flex x86_64 2.6.4-8.el9 appstream 338 k
gcc x86_64 11.3.1-4.3.el9_2 appstream 32 M
gcc-c++ x86_64 11.3.1-4.3.el9_2 appstream 13 M
gdb x86_64 10.2-9.el9 appstream 4.0 M
glibc-devel x86_64 2.34-60.el9_2 baseos 2.4 M
libtool x86_64 2.4.6-45.el9 appstream 588 k
make x86_64 1:4.3-7.el9 baseos 587 k
patch x86_64 2.7.6-16.el9 appstream 128 k
pkgconf x86_64 1.7.3-10.el9 baseos 41 k
pkgconf-m4 noarch 1.7.3-10.el9 baseos 14 k
pkgconf-pkg-config x86_64 1.7.3-10.el9 baseos 40 k
redhat-rpm-config noarch 199-1.el9 appstream 67 k
rpm-build x86_64 4.16.1.3-25.el9 baseos 126 k
rpm-sign x86_64 4.16.1.3-25.el9 baseos 84 k
strace x86_64 5.18-2.el9 appstream 414 k
Transaction Summary
================================================================================
Install 19 Packages
Total download size: 62.8 M
Installed size: 248 M
Is this ok [y/N]: y
Downloading Packages:
(1/19): pkgconf-pkg-config-1.7.3-10.el9.x86_64.rpm 41 kB/s | 41 kB 00:00
(2/19): pkgconf-m4-1.7.3-10.el9.noarch.rpm 14 kB/s | 14 kB 00:00
(3/19): pkgconf-1.7.3-10.el9.x86_64.rpm 41 kB/s | 41 kB 00:00
Error: Failed to synchronize cache for repo ‘appstream’
# 2. 清理DNF缓存
# dnf clean all
Updating Subscription Management repositories.
0 files removed
# 3. 重新生成DNF缓存
# dnf makecache
Updating Subscription Management repositories.
Metadata cache created.
# 4. 重新安装软件包组
# dnf group install -y “Development Tools”
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:01 ago on Thu Mar 31 10:00:00 2026.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing Groups:
Development Tools
Installing:
autoconf noarch 2.69-38.el9 appstream 708 k
automake noarch 1.16.1-8.el9 appstream 714 k
binutils x86_64 2.35.2-37.el9 baseos 5.8 M
bison x86_64 3.7.4-5.el9 appstream 1.0 M
flex x86_64 2.6.4-8.el9 appstream 338 k
gcc x86_64 11.3.1-4.3.el9_2 appstream 32 M
gcc-c++ x86_64 11.3.1-4.3.el9_2 appstream 13 M
gdb x86_64 10.2-9.el9 appstream 4.0 M
glibc-devel x86_64 2.34-60.el9_2 baseos 2.4 M
libtool x86_64 2.4.6-45.el9 appstream 588 k
make x86_64 1:4.3-7.el9 baseos 587 k
patch x86_64 2.7.6-16.el9 appstream 128 k
pkgconf x86_64 1.7.3-10.el9 baseos 41 k
pkgconf-m4 noarch 1.7.3-10.el9 baseos 14 k
pkgconf-pkg-config x86_64 1.7.3-10.el9 baseos 40 k
redhat-rpm-config noarch 199-1.el9 appstream 67 k
rpm-build x86_64 4.16.1.3-25.el9 baseos 126 k
rpm-sign x86_64 4.16.1.3-25.el9 baseos 84 k
strace x86_64 5.18-2.el9 appstream 414 k
Transaction Summary
================================================================================
Install 19 Packages
Total download size: 62.8 M
Installed size: 248 M
Downloading Packages:
(1/19): pkgconf-pkg-config-1.7.3-10.el9.x86_64.rpm 41 kB/s | 41 kB 00:00
(2/19): pkgconf-m4-1.7.3-10.el9.noarch.rpm 14 kB/s | 14 kB 00:00
(3/19): pkgconf-1.7.3-10.el9.x86_64.rpm 41 kB/s | 41 kB 00:00
…
(19/19): gcc-11.3.1-4.3.el9_2.x86_64.rpm 32 MB/s | 32 MB 00:00
——————————————————————————–
Total 62.8 MB/s | 62.8 MB 00:00
Running transaction check
Transaction test succeeded
Running transaction
Preparing : 1/1
Installing : pkgconf-m4-1.7.3-10.el9.noarch 1/19
Installing : pkgconf-pkg-config-1.7.3-10.el9.x86_64 2/19
Installing : pkgconf-1.7.3-10.el9.x86_64 3/19
…
Installing : gcc-11.3.1-4.3.el9_2.x86_64 19/19
Running scriptlet: gcc-11.3.1-4.3.el9_2.x86_64 19/19
Verifying : pkgconf-m4-1.7.3-10.el9.noarch 1/19
Verifying : pkgconf-pkg-config-1.7.3-10.el9.x86_64 2/19
Verifying : pkgconf-1.7.3-10.el9.x86_64 3/19
…
Verifying : gcc-11.3.1-4.3.el9_2.x86_64 19/19
Installed:
autoconf-2.69-38.el9.noarch
automake-1.16.1-8.el9.noarch
binutils-2.35.2-37.el9.x86_64
bison-3.7.4-5.el9.x86_64
flex-2.6.4-8.el9.x86_64
gcc-11.3.1-4.3.el9_2.x86_64
gcc-c++-11.3.1-4.3.el9_2.x86_64
gdb-10.2-9.el9.x86_64
glibc-devel-2.34-60.el9_2.x86_64
libtool-2.4.6-45.el9.x86_64
make-4.3-7.el9.x86_64
patch-2.7.6-16.el9.x86_64
pkgconf-1.7.3-10.el9.x86_64
pkgconf-m4-1.7.3-10.el9.noarch
pkgconf-pkg-config-1.7.3-10.el9.x86_64
redhat-rpm-config-199-1.el9.noarch
rpm-build-4.16.1.3-25.el9.x86_64
rpm-sign-4.16.1.3-25.el9.x86_64
strace-5.18-2.el9.x86_64
Complete!
# 5. 预防措施
# – 定期清理DNF缓存
# – 检查网络连接
# – 验证存储库配置
Part05-风哥经验总结与分享
5.1 DNF软件包组管理经验总结
DNF软件包组管理经验总结:
- 了解内容:了解软件包组内容
- 检查依赖:检查软件包组依赖
- 验证兼容性:验证软件包组兼容性
- 选择合适:选择合适的软件包组
- 定期更新:定期更新软件包组
5.2 DNF软件包组管理检查清单
DNF软件包组管理检查清单:
- 安装前:了解软件包组内容、检查依赖
- 安装时:选择合适的软件包组
- 安装后:验证软件包组已安装
- 更新:定期更新软件包组
- 卸载:确认卸载软件包组
- 故障排查:检查网络连接、重新生成缓存
5.3 DNF软件包组管理相关工具推荐
DNF软件包组管理相关工具推荐:
- dnf:DNF软件包管理器
- rpm:RPM包管理器
- repoquery:软件包查询工具
- yum-utils:YUM工具集
- dnf-utils:DNF工具集
本文由风哥教程整理发布,仅用于学习测试使用,转载注明出处:http://www.fgedu.net.cn/10327.html
