yum工具的使用

来源:https://www.cnblogs.com/tushanbu/archive/2022/07/11/16468202.html
-Advertisement-
Play Games

yum工具的使用 yum倉庫管理 ###1. yum本地倉庫 掛載鏡像 [root@lnh ~]# cd /etc/yum.repos.d/ [root@lnh yum.repos.d]# ls CentOS-Stream-AppStream.repo CentOS-Stream-RealTime. ...


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包

您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 1.super和this的區別 super調用的是父類的屬性或方法,this是調用當前類的屬性或者方法。 (1)super和this關於屬性的調用 (2)super和this關於方法的調用 (3)代表的對象不同: this:代表本身調用者這個對象 super:代表父類對象的引用 (4)使用前提條件不 ...
  • Java面向對象(三) 六、面向對象特征之一:封裝性 6.1 封裝性的引入: 當我們創建一個類的對象以後,我們可以通過"對象.屬性"的方式,對對象的屬性進行賦值。這裡,賦值操作要受到屬性的數據類型和存儲範圍的制約。除此之外,沒有其他制約條件。 但是在實際問題中,我們往往需要給屬性賦值加入額外的限制條 ...
  • 1.繼承的概念 繼承的本質是一批類的抽象,從而實現對現實世界更好的建模,比如老師,學生,這些類都可抽象為人這個類。 對於父類私有的屬性,子類如果想要調用可以使用封裝思想中的get、set方法來調用。 2.查看繼承關係的快捷鍵 control + h或者crtl + h 如下圖 3.Object類 O ...
  • 1.封裝的概念 (1)程式的設計需要“高內聚,低耦合”,高內聚就是類的內部數據操作細節自己完成,不允許外部干涉;低耦合僅暴露少量的方法給外部使用。 點擊查看代碼 package com.Tang.oop.demo04; import com.Tang.oop.demo03.Person; publi ...
  • Python設計模式-創建型:單例模式和工廠模式家族 知識點: 單例模式概念及一般實現 單例模式的裝飾器實現 簡單工廠模式 抽象工廠模式 單例模式(singleton) 所謂單例模式,也就是說不管什麼時候我們要確保只有一個對象實例存在。 很多情況下,整個系統中只需要存在一個對象,所有的信息都從這個對 ...
  • 為大家介紹在CentOS操作系統中安裝docker的過程,linux其他發行版本安裝docker方法可以參考官方提供的安裝教程 一、前置要求 首先確定你是CentOS7及以上版本,按照官方文檔說明目前安裝docker ce最低的操作系統版本要求就是CentOS7,CentOS6不再被支持。(2022 ...
  • 目錄 一.簡介 二.效果演示 三.源碼下載 四.猜你喜歡 零基礎 OpenGL (ES) 學習路線推薦 : OpenGL (ES) 學習目錄 >> OpenGL ES 基礎 零基礎 OpenGL (ES) 學習路線推薦 : OpenGL (ES) 學習目錄 >> OpenGL ES 轉場 零基礎 O ...
  • 第三回 萬文疑謀生思緒 璃月港口見清玉 雲溪愣了下,在他的認知中,神之眼正常而言不會有黑色的存在,就像在實數的體系內不會有i一樣,他搖了搖頭。而紀存初的眼中有閃過一次迷茫和失望,很快恢復過來,笑道:“算了,反正也只是個坊間傳說而已,對了,小子,有興趣入我萬文集舍麽?” 話題跳轉的如此之快,讓雲溪有點 ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...