yum工具的使用
yum工具的使用
yum仓库管理
1. yum本地仓库
挂载镜像
[root@lnh ~]# cd /etc/yum.repos.d/
[root@lnh yum.repos.d]# ls
CentOS-Stream-AppStream.repo CentOS-Stream-RealTime.repo
CentOS-Stream-BaseOS.repo epel-modular.repo
CentOS-Stream-Debuginfo.repo epel-playground.repo
CentOS-Stream-Extras.repo epel.repo
CentOS-Stream-HighAvailability.repo epel-testing-modular.repo
CentOS-Stream-Media.repo epel-testing.repo
CentOS-Stream-PowerTools.repo
[root@lnh yum.repos.d]# rm -rf *
[root@lnh yum.repos.d]# ls
[root@lnh yum.repos.d]#
//因为我们用的是centos8.5,所以有这些本地仓库,如果是redhat就没有,我们需要删除这些仓库然后进行创建
[root@lnh yum.repos.d]# vim xbz.repo
[root@lnh yum.repos.d]# ls
xbz.repo
[root@lnh yum.repos.d]# 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
//配置本地仓库 复制快捷键5yy p
[root@lnh yum.repos.d]# mount /dev/cdrom /mnt/
mount: /mnt: /dev/sr0 already mounted on /mnt.
//挂载镜像,此处我已经挂载了
[root@lnh yum.repos.d]# dnf clean all
13 files removed
//清空yum本地缓存,此处用yum也可以但是用dnf可以解决它的一些依赖关系更好一些
[root@lnh yum.repos.d]# dnf list all
.....
xterm-resize.x86_64 331-1.el8 AppStream
xz-devel.i686 5.2.4-3.el8 BaseOS
xz-devel.x86_64 5.2.4-3.el8 BaseOS
xz-libs.i686 5.2.4-3.el8 BaseOS
yajl.i686 2.1.0-10.el8 AppStream
yajl.x86_64 2.1.0-10.el8 AppStream
yelp.x86_64 2:3.28.1-3.el8 AppStream
yelp-libs.i686 2:3.28.1-3.el8 AppStream
yelp-libs.x86_64 2:3.28.1-3.el8 AppStream
yelp-tools.noarch 3.28.0-3.el8 AppStream
yelp-xsl.noarch 3.28.0-2.el8 AppStream
yp-tools.x86_64 4.2.3-1.el8 AppStream
ypbind.x86_64 3:2.5-2.el8 AppStream
ypserv.x86_64 4.0-6.20170331git5bfba76.el8 AppStream
yum-utils.noarch 4.0.18-1.el8 BaseOS
.....
//检验yum地仓库
2. yum网络仓库
官方的网络yum仓库在国外
我们可以使用国内的yum仓库:
阿里云yum仓库(https://developer.aliyun.com/mirror/)
epel源
(https://developer.aliyun.com/mirror/)
163yum仓库
(http://mirrors.163.com/)
清华大学yum仓库
(https://mirrors.tuna.tsinghua.edu.cn/)
[root@lnh yum.repos.d]# ls
xbz.repo
[root@lnh yum.repos.d]# rm -rf *
[root@lnh yum.repos.d]# ls
[root@lnh yum.repos.d]#
//因为本地仓库和网络仓库不可以共存所以我们先删除本地仓库
[root@lnh yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
--2022-07-09 00:59:38-- https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 58.49.248.231, 58.49.248.232, 119.96.204.211, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|58.49.248.231|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2495 (2.4K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’
/etc/yum.repos.d/Ce 100%[================>] 2.44K --.-KB/s in 0s
2022-07-09 00:59:38 (25.2 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2495/2495]
//在阿里云里面下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
[root@lnh yum.repos.d]# yum makecache
CentOS-8.5.2111 - Base - mirrors.aliyun.com 19 MB/s | 4.6 MB 00:00
CentOS-8.5.2111 - Extras - mirrors.aliyun.co 90 kB/s | 10 kB 00:00
CentOS-8.5.2111 - AppStream - mirrors.aliyun 16 MB/s | 8.4 MB 00:00
Metadata cache created.
//运行 yum makecache 生成缓存
[root@lnh yum.repos.d]# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
[root@lnh yum.repos.d]#
//非阿里云ECS用户会出现 Couldn't resolve host 'mirrors.cloud.aliyuncs.com' 信息,不影响使用。用户也可自行修改相关配置
[root@lnh yum.repos.d]# ls
CentOS-Base.repo
//这个就是yum网络仓库
[root@lnh yum.repos.d]# dnf list all
...
yajl.x86_64 2.1.0-10.el8 AppStream
yelp.x86_64 2:3.28.1-3.el8 AppStream
yelp-libs.i686 2:3.28.1-3.el8 AppStream
yelp-libs.x86_64 2:3.28.1-3.el8 AppStream
yelp-tools.noarch 3.28.0-3.el8 AppStream
yelp-xsl.noarch 3.28.0-2.el8 AppStream
...
//检验一下是否配置成功
3. yum管理命令
常用的options:
安装,卸载
[root@lnh ~]# dnf -y install vim
Last metadata expiration check: 0:07:41 ago on Sat 09 Jul 2022 01:04:12 AM CST.
Dependencies resolved.
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
vim-enhanced x86_64 2:8.0.1763-16.el8 AppStream 1.4 M
Installing dependencies:
gpm-libs x86_64 1.20.7-17.el8 AppStream 39 k
vim-common x86_64 2:8.0.1763-16.el8 AppStream 6.3 M
vim-filesystem noarch 2:8.0.1763-16.el8 AppStream 49 k
Transaction Summary
=============================================================================
Install 4 Packages
Total download size: 7.8 M
Installed size: 30 M
Downloading Packages:
(1/4): gpm-libs-1.20.7-17.el8.x86_64.rpm 947 kB/s | 39 kB 00:00
(2/4): vim-filesystem-8.0.1763-16.el8.noarch 2.6 MB/s | 49 kB 00:00
(3/4): vim-enhanced-8.0.1763-16.el8.x86_64.r 4.4 MB/s | 1.4 MB 00:00
(4/4): vim-common-8.0.1763-16.el8.x86_64.rpm 13 MB/s | 6.3 MB 00:00
-----------------------------------------------------------------------------
Total 16 MB/s | 7.8 MB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : vim-filesystem-2:8.0.1763-16.el8.noarch 1/4
Installing : vim-common-2:8.0.1763-16.el8.x86_64 2/4
Installing : gpm-libs-1.20.7-17.el8.x86_64 3/4
Running scriptlet: gpm-libs-1.20.7-17.el8.x86_64 3/4
Installing : vim-enhanced-2:8.0.1763-16.el8.x86_64 4/4
Running scriptlet: vim-enhanced-2:8.0.1763-16.el8.x86_64 4/4
Running scriptlet: vim-common-2:8.0.1763-16.el8.x86_64 4/4
Verifying : gpm-libs-1.20.7-17.el8.x86_64 1/4
Verifying : vim-common-2:8.0.1763-16.el8.x86_64 2/4
Verifying : vim-enhanced-2:8.0.1763-16.el8.x86_64 3/4
Verifying : vim-filesystem-2:8.0.1763-16.el8.noarch 4/4
Installed products updated.
Installed:
gpm-libs-1.20.7-17.el8.x86_64
vim-common-2:8.0.1763-16.el8.x86_64
vim-enhanced-2:8.0.1763-16.el8.x86_64
vim-filesystem-2:8.0.1763-16.el8.noarch
Complete!
//此处install表示安装 -y表示自动回复yes进行安装
[root@lnh ~]# dnf -y remove vim
Dependencies resolved.
=============================================================================
Package Arch Version Repository Size
=============================================================================
Removing:
vim-enhanced x86_64 2:8.0.1763-16.el8_5.12 @appstream 2.9 M
Removing unused dependencies:
gpm-libs x86_64 1.20.7-17.el8 @appstream 28 k
vim-common x86_64 2:8.0.1763-16.el8_5.12 @appstream 27 M
vim-filesystem noarch 2:8.0.1763-16.el8_5.12 @appstream 40
Transaction Summary
=============================================================================
Remove 4 Packages
Freed space: 30 M
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Erasing : vim-enhanced-2:8.0.1763-16.el8_5.12.x86_64 1/4
Erasing : vim-common-2:8.0.1763-16.el8_5.12.x86_64 2/4
Erasing : vim-filesystem-2:8.0.1763-16.el8_5.12.noarch 3/4
Erasing : gpm-libs-1.20.7-17.el8.x86_64 4/4
Running scriptlet: gpm-libs-1.20.7-17.el8.x86_64 4/4
Verifying : gpm-libs-1.20.7-17.el8.x86_64 1/4
Verifying : vim-common-2:8.0.1763-16.el8_5.12.x86_64 2/4
Verifying : vim-enhanced-2:8.0.1763-16.el8_5.12.x86_64 3/4
Verifying : vim-filesystem-2:8.0.1763-16.el8_5.12.noarch 4/4
Installed products updated.
Removed:
gpm-libs-1.20.7-17.el8.x86_64
vim-common-2:8.0.1763-16.el8_5.12.x86_64
vim-enhanced-2:8.0.1763-16.el8_5.12.x86_64
vim-filesystem-2:8.0.1763-16.el8_5.12.noarch
Complete!
//remove是卸载的意思
[root@lnh ~]# dnf -y install --nogpgcheck wget
Last metadata expiration check: 0:16:54 ago on Sat 09 Jul 2022 01:11:55 AM CST.
Dependencies resolved.
=============================================================================
Package Architecture Version Repository Size
=============================================================================
Installing:
wget x86_64 1.19.5-10.el8 AppStream 734 k
Transaction Summary
=============================================================================
Install 1 Package
Total download size: 734 k
Installed size: 2.8 M
Downloading Packages:
wget-1.19.5-10.el8.x86_64.rpm 5.1 MB/s | 734 kB 00:00
-----------------------------------------------------------------------------
Total 5.0 MB/s | 734 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : wget-1.19.5-10.el8.x86_64 1/1
Running scriptlet: wget-1.19.5-10.el8.x86_64 1/1
Verifying : wget-1.19.5-10.el8.x86_64 1/1
Installed products updated.
Installed:
wget-1.19.5-10.el8.x86_64
Complete!
//不检查合法性进行下载
[root@lnh ~]# dnf -q install wget
Is this ok [y/N]: y
[root@lnh ~]#
//安装的时候不显示安装信息,一般不推荐使用因为看不出是否安装成功
--disablerepo=repoidglob //临时禁用此处指定的repo
--enablerepo=repoidglob //临时启用此处指定的repo
--noplugins //禁用所有插件
常用的command:
[root@lnh ~]# cd /etc/yum.repos.d/
[root@lnh yum.repos.d]# yum list all
...
yum-utils.noarch 4.0.21-3.el8 base
zenity.x86_64 3.28.1-1.el8 AppStream
zlib.i686 1.2.11-17.el8 base
zlib-devel.i686 1.2.11-17.el8 base
zlib-devel.x86_64 1.2.11-17.el8 base
zsh.x86_64 5.5.1-6.el8_1.2 base
...
//列出仓库里面的东西相当于清单
[root@lnh yum.repos.d]# dnf list available
...
xsane.x86_64 0.999-30.el8 AppStream
xsane-common.x86_64 0.999-30.el8 AppStream
xsane-gimp.x86_64 0.999-30.el8 AppStream
xterm.x86_64 331-1.el8_3.2 AppStream
xterm-resize.x86_64 331-1.el8_3.2 AppStream
xz-devel.i686 5.2.4-3.el8 base
...
//列出仓库中有的,但尚未安装的所有可用的包
[root@lnh yum.repos.d]# dnf list installed
Installed Packages
NetworkManager.x86_64 1:1.30.0-0.3.el8 @anaconda
NetworkManager-libnm.x86_64 1:1.30.0-0.3.el8 @anaconda
NetworkManager-team.x86_64 1:1.30.0-0.3.el8 @anaconda
NetworkManager-tui.x86_64 1:1.30.0-0.3.el8 @anaconda
acl.x86_64 2.2.53-1.el8 @anaconda
adwaita-cursor-theme.noarch 3.28.0-2.el8 @anaconda
adwaita-icon-theme.noarch 3.28.0-2.el8 @anaconda
at-spi2-atk.x86_64 2.26.2-1.el8 @anaconda
at-spi2-core.x86_64 2.28.0-1.el8 @anaconda
atk.x86_64 2.28.1-1.el8 @anaconda
audit.x86_64 3.0-0.17.20191104git1c2f876.el8 @anaconda
audit-libs.x86_64 3.0-0.17.20191104git1c2f876.el8 @anaconda
authselect.x86_64 1.2.2-1.el8 @anaconda
authselect-libs.x86_64 1.2.2-1.el8 @anaconda
...
//列出已经安装的包
[root@lnh yum.repos.d]# dnf list updates
Last metadata expiration check: 0:25:44 ago on Sat 09 Jul 2022 01:11:55 AM CST.
Available Upgrades
NetworkManager.x86_64 1:1.32.10-4.el8 base
NetworkManager-libnm.x86_64 1:1.32.10-4.el8 base
NetworkManager-team.x86_64 1:1.32.10-4.el8 base
NetworkManager-tui.x86_64 1:1.32.10-4.el8 base
authselect.x86_64 1.2.2-3.el8 base
authselect-libs.x86_64 1.2.2-3.el8 base
bash.x86_64 4.4.20-2.el8 base
bind-export-libs.x86_64 32:9.11.26-6.el8 base
brotli.x86_64 1.0.6-3.el8 base
ca-certificates.noarch 2021.2.50-80.0.el8_4 base
centos-gpg-keys.noarch 1:8-3.el8 base
centos-stream-repos.noarch 8-3.el8 extras
chkconfig.x86_64 1.19.1-1.el8 base
coreutils.x86_64 8.30-12.el8 base
//列出可升级的包,并且已经指定了可以升级到上面版本
[root@lnh yum.repos.d]# dnf clean packages
0 files removed
//清理缓存的包
headers 清理头部文件
metadata 清理元数据
dbcache 清理数据库
[root@lnh ~]# dnf repolist all
repo id repo name status
AppStream CentOS-8.5.2111 - AppStream - mirrors.aliyun.com enabled
PowerTools CentOS-8.5.2111 - PowerTools - mirrors.aliyun.com disabled
base CentOS-8.5.2111 - Base - mirrors.aliyun.com enabled
centosplus CentOS-8.5.2111 - Plus - mirrors.aliyun.com disabled
extras CentOS-8.5.2111 - Extras - mirrors.aliyun.com enabled
//显示列表的信息
[root@lnh ~]# dnf repolist enabled
repo id repo name
AppStream CentOS-8.5.2111 - AppStream - mirrors.aliyun.com
base CentOS-8.5.2111 - Base - mirrors.aliyun.com
extras CentOS-8.5.2111 - Extras - mirrors.aliyun.com
//显示默认是enabled
[root@lnh ~]# dnf repolist disabled
repo id repo name
PowerTools CentOS-8.5.2111 - PowerTools - mirrors.aliyun.com
centosplus CentOS-8.5.2111 - Plus - mirrors.aliyun.com
//显示禁用的
升级,查询
[root@lnh ~]# dnf list all |grep curl
curl.x86_64 7.61.1-17.el8 @anaconda
libcurl.x86_64 7.61.1-17.el8 @anaconda
curl.x86_64 7.61.1-22.el8 base
libcurl.i686 7.61.1-22.el8 base
libcurl.x86_64 7.61.1-22.el8 base
libcurl-devel.i686 7.61.1-22.el8 base
libcurl-devel.x86_64 7.61.1-22.el8 base
libcurl-minimal.i686 7.61.1-22.el8 base
libcurl-minimal.x86_64 7.61.1-22.el8 base
nbdkit-curl-plugin.x86_64 1.16.2-4.module_el8.5.0+746+bbd5d70c AppStream
python3-pycurl.x86_64 7.43.0.2-4.el8 AppStream
qemu-kvm-block-curl.x86_64 15:4.2.0-59.module_el8.5.0+1063+c9b9feff.1 AppStream
//列出curl的包
[root@lnh ~]# dnf list updates
Last metadata expiration check: 0:54:08 ago on Sat 09 Jul 2022 01:11:55 AM CST.
Available Upgrades
NetworkManager.x86_64 1:1.32.10-4.el8 base
NetworkManager-libnm.x86_64 1:1.32.10-4.el8 base
NetworkManager-team.x86_64 1:1.32.10-4.el8 base
NetworkManager-tui.x86_64 1:1.32.10-4.el8 base
authselect.x86_64 1.2.2-3.el8 base
authselect-libs.x86_64 1.2.2-3.el8 base
bind-export-libs.x86_64 32:9.11.26-6.el8 base
ca-certificates.noarch 2021.2.50-80.0.el8_4 base
centos-gpg-keys.noarch 1:8-3.el8 base
...
//列出可升级的包
[root@lnh ~]# dnf list all | grep man-db
man-db.x86_64 2.7.6.1-17.el8 @anaconda
man-db.x86_64 2.7.6.1-18.el8 base
man-db-cron.noarch 2.7.6.1-18.el8 base
//列出man-db的包
[root@lnh ~]# dnf -y update man-db
Last metadata expiration check: 1:01:31 ago on Sat 09 Jul 2022 01:11:55 AM CST.
Dependencies resolved.
============================================================================
Package Architecture Version Repository Size
============================================================================
Upgrading:
man-db x86_64 2.7.6.1-18.el8 base 887 k
Transaction Summary
============================================================================
Upgrade 1 Package
Total size: 887 k
Downloading Packages:
[SKIPPED] man-db-2.7.6.1-18.el8.x86_64.rpm: Already downloaded
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: man-db-2.7.6.1-18.el8.x86_64 1/1
Running scriptlet: man-db-2.7.6.1-18.el8.x86_64 1/2
Upgrading : man-db-2.7.6.1-18.el8.x86_64 1/2
Running scriptlet: man-db-2.7.6.1-18.el8.x86_64 1/2
Cleanup : man-db-2.7.6.1-17.el8.x86_64 2/2
Running scriptlet: man-db-2.7.6.1-17.el8.x86_64 2/2
Running scriptlet: man-db-2.7.6.1-18.el8.x86_64 2/2
Verifying : man-db-2.7.6.1-18.el8.x86_64 1/2
Verifying : man-db-2.7.6.1-17.el8.x86_64 2/2
Installed products updated.
Upgraded:
man-db-2.7.6.1-18.el8.x86_64
Complete!
//对其进行升级
[root@lnh ~]# dnf info man-db
Last metadata expiration check: 1:03:01 ago on Sat 09 Jul 2022 01:11:55 AM CST.
Installed Packages
Name : man-db
Version : 2.7.6.1
Release : 18.el8
Architecture : x86_64
Size : 1.9 M
Source : man-db-2.7.6.1-18.el8.src.rpm
Repository : @System
From repo : base
Summary : Tools for searching and reading man pages
URL : http://www.nongnu.org/man-db/
License : GPLv2+ and GPLv3+
Description : The man-db package includes five tools for browsing
: man-pages: man, whatis, apropos, manpath and lexgrog. man
: formats and displays manual pages. whatis searches the manual
: page names. apropos searches the manual page names and
: descriptions. manpath determines search path for manual
: pages. lexgrog directly reads header information in manual
: pages.
//列出软件包的信息相当于rpm包里面的用rpm -qi 包查看信息
与历史记录相关的命令
[root@lnh ~]# dnf history
ID | Command line | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
21 | -y update man-db | 2022-07-09 02:13 | Upgrade | 1 <
20 | update | 2022-07-09 01:53 | I, U | 261 >#
19 | -q install wget | 2022-07-09 01:30 | Install | 1
18 | -y remove wget | 2022-07-09 01:29 | Removed | 1
17 | -y install --nogpgcheck | 2022-07-09 01:28 | Install | 1
16 | -y remove wget | 2022-07-09 01:28 | Removed | 1
15 | -y install vim | 2022-07-09 01:11 | Install | 4
14 | -y remove vim | 2022-07-09 01:10 | Removed | 4 <
13 | -y install sudo | 2022-07-04 15:36 | Upgrade | 1 >
12 | -y install iotop | 2022-07-04 05:35 | Install | 1
11 | -y install htop | 2022-07-04 04:57 | Install | 1
10 | -y install psmisc | 2022-07-03 22:03 | Install | 1
9 | -y install tar | 2022-06-30 08:58 | Install | 1
8 | -y install zip | 2022-06-30 04:45 | Install | 1
7 | -y install unzip | 2022-06-30 02:17 | Install | 1
6 | -y install bzip2 | 2022-06-30 02:15 | Install | 1
5 | -y install tree | 2022-06-28 04:31 | Install | 1
4 | -y install bash-completi | 2022-06-27 22:10 | Install | 5
3 | -y install epel-release | 2022-06-27 22:09 | Install | 1
2 | -y install vim | 2022-06-27 21:17 | Install | 4
1 | | 2022-06-27 21:06 | Install | 425 EE
//最后一个空白处表示我们刚刚安装系统时的
其他的但是系统安装好后用下载命令进行下载安装包的记录
[root@lnh ~]# dnf history info 2
Transaction ID : 2
Begin time : Mon 27 Jun 2022 09:17:23 PM CST
Begin rpmdb : 423:cac03573ad9f7d066e36879b5909fe1b1f0fff31
End time : Mon 27 Jun 2022 09:17:28 PM CST (5 seconds)
End rpmdb : 427:8e6c64e107fb4b38d247b4e55187de6b5ea05370
User : root <root>
Return-Code : Success
Releasever : 8
Command Line : -y install vim
Comment :
Packages Altered:
Install gpm-libs-1.20.7-17.el8.x86_64 @appstream
Install vim-common-2:8.0.1763-16.el8_5.12.x86_64 @appstream
Install vim-enhanced-2:8.0.1763-16.el8_5.12.x86_64 @appstream
Install vim-filesystem-2:8.0.1763-16.el8_5.12.noarch @appstream
//查询历史执行yum命令2的详细信息
[root@lnh ~]# dnf history undo 20
//撤销历史执行过yum命令里面第20个
grouplist,groups mark install
[root@lnh ~]# dnf grouplist
Last metadata expiration check: 1:33:17 ago on Sat 09 Jul 2022 01:11:55 AM CST.
Available Environment Groups:
Server with GUI
Server
Workstation
Custom Operating System
Virtualization Host
Installed Environment Groups:
Minimal Install
Available Groups:
Legacy UNIX Compatibility
Container Management
Development Tools
.NET Core Development
Graphical Administration Tools
Headless Management
Network Servers
RPM Development Tools
Scientific Support
Security Tools
Smart Card Support
System Tools
//列出可用的组包或者
[root@lnh ~]# dnf groups mark install -y "System Tools"
Last metadata expiration check: 1:37:35 ago on Sat 09 Jul 2022 01:11:55 AM CST.
Dependencies resolved.
===================================================================================================================================================================
Package Architecture Version Repository Size
===================================================================================================================================================================
Installing Groups:
System Tools
Transaction Summary
===================================================================================================================================================================
Complete!
//将"System Tools"标记为安装组包。表面上感觉它很快就安装好了,实际上它在后台进行安装,所以看起来安装速度快。
[root@lnh ~]# dnf grouplist -y
Last metadata expiration check: 1:42:32 ago on Sat 09 Jul 2022 01:11:55 AM CST.
Available Environment Groups:
Server with GUI
Server
Workstation
Custom Operating System
Virtualization Host
Installed Environment Groups:
Minimal Install
Installed Groups:
System Tools
Available Groups:
Legacy UNIX Compatibility
Container Management
Development Tools
.NET Core Development
Graphical Administration Tools
Headless Management
Network Servers
RPM Development Tools
Scientific Support
Security Tools
Smart Card Support
//查看已经安装的组包
reinstall 重新安装
[root@lnh ~]# dnf list installed | grep wget
wget.x86_64 1.19.5-10.el8 @AppStream
//重新安装
[root@lnh ~]# rpm -qc wget
/etc/wgetrc
//查看安装wget产生了哪些配置文件
[root@lnh ~]# rm -f /etc/wgetrc
[root@lnh ~]# ls /etc/ |grep wgetrc
[root@lnh ~]#
//误删除了这个
[root@lnh ~]# dnf -y reinstall wget
Last metadata expiration check: 2:01:45 ago on Sat 09 Jul 2022 01:11:55 AM CST.
Dependencies resolved.
============================================================================
Package Architecture Version Repository Size
============================================================================
Reinstalling:
wget x86_64 1.19.5-10.el8 AppStream 734 k
Transaction Summary
============================================================================
Total download size: 734 k
Installed size: 2.8 M
Downloading Packages:
wget-1.19.5-10.el8.x86_64.rpm 5.9 MB/s | 734 kB 00:00
----------------------------------------------------------------------------
Total 5.8 MB/s | 734 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Reinstalling : wget-1.19.5-10.el8.x86_64 1/2
Running scriptlet: wget-1.19.5-10.el8.x86_64 1/2
Running scriptlet: wget-1.19.5-10.el8.x86_64 2/2
Cleanup : wget-1.19.5-10.el8.x86_64 2/2
Running scriptlet: wget-1.19.5-10.el8.x86_64 2/2
Verifying : wget-1.19.5-10.el8.x86_64 1/2
Verifying : wget-1.19.5-10.el8.x86_64 2/2
Installed products updated.
Reinstalled:
wget-1.19.5-10.el8.x86_64
Complete!
//重新下载
[root@lnh ~]# ls /etc/ |grep wgetrc
wgetrc
//发现又生成了一份配置文件
下载但不安装
将其rpm包安装到指定的目录中
[root@lnh ~]# dnf -y install --downloadonly --downloaddir /tushanbu/ zshd
Last metadata expiration check: 2:28:26 ago on Sat 09 Jul 2022 01:11:55 AM CST.
No match for argument: zshd
Error: Unable to find a match: zshd
[root@lnh ~]# dnf -y install --downloadonly --downloaddir /tushanbu/ zstd
Last metadata expiration check: 2:28:38 ago on Sat 09 Jul 2022 01:11:55 AM CST.
Dependencies resolved.
============================================================================
Package Architecture Version Repository Size
============================================================================
Installing:
zstd x86_64 1.4.4-1.el8 AppStream 393 k
Transaction Summary
============================================================================
Install 1 Package
Total download size: 393 k
Installed size: 1.5 M
DNF will only download packages for the transaction.
Downloading Packages:
zstd-1.4.4-1.el8.x86_64.rpm 111 kB/s | 393 kB 00:03
----------------------------------------------------------------------------
Total 111 kB/s | 393 kB 00:03
Complete!
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
//将zstd安装需要的rpm包全部下载到tushanbu这个目录里面,但是zstd没有进行安装(此处是在本地rpm包里面进行下载的,网络上下载的也和这个差不多)
[root@lnh tushanbu]# ls
zstd-1.4.4-1.el8.x86_64.rpm
//可以查看到这个rpm包