GNU/Linux >> Linux の 問題 >  >> Cent OS

Linuxの基本:Linuxパッケージ管理用の30のYUMコマンド例

Yellowdog Updater 、Modified(yum)は、Redhatベースのオペレーティングシステムのオープンソースパッケージ管理ユーティリティです。 Yumは、パッケージのインストール、削除、および更新中に、依存するパッケージの自動インストールを処理します。

YumはRedhatPackage Managerを使用しています (RPM)およびyumリポジトリ(RPMパッケージのコレクション)からソフトウェアパッケージをインストールできます。これは、ローカルまたはネットワーク接続を介してアクセスできます。

読む CentOS 7 /RHEL7でローカル/ネットワークYUMリポジトリを作成する方法

ここでは、Linux( CentOS )でパッケージを管理するためのYUMコマンドの例を見ていきます。 / RHEL / Fedora

1。 YUMを使用してパッケージをインストールする

RPMパッケージをインストールするには、次のコマンドを使用できます。スペースで区切って複数のパッケージ名を指定できます。

# yum install vsftpd

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:3.0.2-22.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================
 Package              Arch                 Version                       Repository          Size
==================================================================================================
Installing:
 vsftpd               x86_64               3.0.2-22.el7                  base               169 k

Transaction Summary
==================================================================================================
Install  1 Package

Total download size: 169 k
Installed size: 348 k
Is this ok [y/d/N]: y
Downloading packages:
vsftpd-3.0.2-22.el7.x86_64.rpm                                             | 169 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : vsftpd-3.0.2-22.el7.x86_64                                                     1/1
  Verifying  : vsftpd-3.0.2-22.el7.x86_64                                                     1/1

Installed:
  vsftpd.x86_64 0:3.0.2-22.el7

Complete!
yumコマンドに-yフラグを追加すると、それ以上の確認なしにパッケージがインストール/削除/再インストールされます。

2。 YUMを含むパッケージを削除する

パッケージを削除するには、次のコマンドを実行します。スペースで区切って複数のパッケージ名を指定できます。

# yum remove vsftpd

Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:3.0.2-22.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================
 Package              Arch                 Version                      Repository           Size
==================================================================================================
Removing:
 vsftpd               x86_64               3.0.2-22.el7                 @base               348 k

Transaction Summary
==================================================================================================
Remove  1 Package

Installed size: 348 k
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : vsftpd-3.0.2-22.el7.x86_64                                                     1/1
  Verifying  : vsftpd-3.0.2-22.el7.x86_64                                                     1/1

Removed:
  vsftpd.x86_64 0:3.0.2-22.el7

Complete!

3。 YUMでパッケージを更新する

パッケージを最新バージョンに更新するには、次のコマンドを実行します。スペースで区切って複数のパッケージ名を指定できます。

#  yum update sudo

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
Resolving Dependencies
--> Running transaction check
---> Package sudo.x86_64 0:1.8.19p2-10.el7 will be updated
---> Package sudo.x86_64 0:1.8.19p2-11.el7_4 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================
 Package           Arch                Version                         Repository            Size
==================================================================================================
Updating:
 sudo              x86_64              1.8.19p2-11.el7_4               updates              1.1 M

Transaction Summary
==================================================================================================
Upgrade  1 Package

Total download size: 1.1 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
sudo-1.8.19p2-11.el7_4.x86_64.rpm                                          | 1.1 MB  00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : sudo-1.8.19p2-11.el7_4.x86_64                                                  1/2
  Cleanup    : sudo-1.8.19p2-10.el7.x86_64                                                    2/2
  Verifying  : sudo-1.8.19p2-11.el7_4.x86_64                                                  1/2
  Verifying  : sudo-1.8.19p2-10.el7.x86_64                                                    2/2

Updated:
  sudo.x86_64 0:1.8.19p2-11.el7_4

Complete!

4。 YUMを使用してパッケージをダウングレードする

yumコマンドを使用してパッケージをダウングレードするには、次のコマンドを実行します。このコマンドは、パッケージを以前のバージョンに戻します。

リポジトリに前述のパッケージの以前のバージョンがある場合にのみ機能します。

例:前の例で更新したばかりのsudoパッケージをダウングレードしましょう。

# yum downgrade sudo

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
Resolving Dependencies
--> Running transaction check
---> Package sudo.x86_64 0:1.8.19p2-10.el7 will be a downgrade
---> Package sudo.x86_64 0:1.8.19p2-11.el7_4 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================
 Package            Arch                 Version                         Repository          Size
==================================================================================================
Downgrading:
 sudo               x86_64               1.8.19p2-10.el7                 base               1.1 M

Transaction Summary
==================================================================================================
Downgrade  1 Package

Total download size: 1.1 M
Is this ok [y/d/N]: y
Downloading packages:
sudo-1.8.19p2-10.el7.x86_64.rpm                                            | 1.1 MB  00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : sudo-1.8.19p2-10.el7.x86_64                                                    1/2
  Cleanup    : sudo-1.8.19p2-11.el7_4.x86_64                                                  2/2
  Verifying  : sudo-1.8.19p2-10.el7.x86_64                                                    1/2
  Verifying  : sudo-1.8.19p2-11.el7_4.x86_64                                                  2/2

Removed:
  sudo.x86_64 0:1.8.19p2-11.el7_4

Installed:
  sudo.x86_64 0:1.8.19p2-10.el7

Complete!

5。 YUMを使用してパッケージを再インストールする

次のコマンドを使用してRPMを再インストールし、インストールの問題を解決できます。

# yum reinstall sudo

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
Resolving Dependencies
--> Running transaction check
---> Package sudo.x86_64 0:1.8.19p2-10.el7 will be reinstalled
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================
 Package            Arch                 Version                         Repository          Size
==================================================================================================
Reinstalling:
 sudo               x86_64               1.8.19p2-10.el7                 base               1.1 M

Transaction Summary
==================================================================================================
Reinstall  1 Package

Total download size: 1.1 M
Installed size: 3.9 M
Is this ok [y/d/N]: y
Downloading packages:
sudo-1.8.19p2-10.el7.x86_64.rpm                                            | 1.1 MB  00:00:09
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : sudo-1.8.19p2-10.el7.x86_64                                                    1/1
  Verifying  : sudo-1.8.19p2-10.el7.x86_64                                                    1/1

Installed:
  sudo.x86_64 0:1.8.19p2-10.el7

Complete!

6。 YUMを使用してパッケージを一覧表示する

パッケージ名を知っていますか?次に、以下のコマンドを使用して、パッケージがすでにインストールされているか、システムで使用可能かどうかを確認します。

出力には、パッケージのインストール元のリポジトリ名が含まれます。まだインストールされていない場合、出力には、パッケージをインストールできるリポジトリの名前が含まれます。

インストール済みパッケージ:

# yum list tar

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
Installed Packages
tar.x86_64                                 2:1.26-32.el7                                 @anaconda

利用可能なパッケージ:

# yum list httpd

Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
Available Packages
httpd.x86_64                             2.4.6-67.el7.centos.6                             updates

7。インストールされているすべてのパッケージをYUMで一覧表示します

システムにインストールされているパッケージのリストを取得したい場合があります。以下のコマンドを使用してください。

yum list installed | less

8。利用可能なすべてのパッケージをYUMで一覧表示する

以下のyumコマンドを使用して、システムで使用可能なすべてのパッケージのリストを取得できます。

yum list available | less

9。 YUMを使用してパッケージを検索/検索する

パッケージ名を忘れましたか?以下のコマンドを使用して、パッケージを検索できます。このコマンドは、指定されたフレーズを含むパッケージをリストするだけです。

# yum search telnet

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
====================================== N/S matched: telnet =======================================
perl-Net-Telnet.noarch : Net-Telnet Perl module
telnet.x86_64 : The client program for the Telnet remote login protocol
telnet-server.x86_64 : The server program for the Telnet remote login protocol
tn5250.i686 : 5250 Telnet protocol and Terminal
tn5250.x86_64 : 5250 Telnet protocol and Terminal

10。 YUMを含むファイルを提供するパッケージを検索する

このコマンドは、ファイルを提供するパッケージを見つけるのに役立ちます。例:dateコマンドを提供するパッケージを見つけましょう。

# yum provides date

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
coreutils-8.22-18.el7.x86_64 : A set of basic GNU tools commonly used in shell scripts
Repo        : base
Matched from:
Filename    : /usr/bin/date



coreutils-8.22-18.el7.x86_64 : A set of basic GNU tools commonly used in shell scripts
Repo        : @anaconda
Matched from:
Filename    : /usr/bin/date

11。 YUMを含むパッケージに関する情報を取得する

特定のパッケージについて詳しく知るには、次のコマンドを使用してください。

# yum info tar

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
Installed Packages
Name        : tar
Arch        : x86_64
Epoch       : 2
Version     : 1.26
Release     : 32.el7
Size        : 2.7 M
Repo        : installed
From repo   : anaconda
Summary     : A GNU file archiving program
URL         : http://www.gnu.org/software/tar/
License     : GPLv3+
Description : The GNU tar program saves many files together in one archive and can
            : restore individual files (or all of the files) from that archive. Tar
            : can also be used to add supplemental files to an archive and to update
            : or list files in the archive. Tar includes multivolume support,
            : automatic archive compression/decompression, the ability to perform
            : remote archives, and the ability to perform incremental and full
            : backups.
            :
            : If you want to use tar for remote backups, you also need to install
            : the rmt package on the remote box.

12。 YUMでパッケージをダウンロード

場合によっては、リポジトリの作成のように、YUMコマンドを使用してインストールせずにrpmパッケージをダウンロードする必要があります。以下のコマンドは、FTPサーバーパッケージを/tmpディレクトリにダウンロードします。

# yum install vsftpd --downloadonly --downloaddir=/tmp

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:3.0.2-22.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================
 Package              Arch                 Version                       Repository          Size
==================================================================================================
Installing:
 vsftpd               x86_64               3.0.2-22.el7                  base               169 k

Transaction Summary
==================================================================================================
Install  1 Package

Total download size: 169 k
Installed size: 348 k
Background downloading packages, then exiting:
vsftpd-3.0.2-22.el7.x86_64.rpm                                             | 169 kB  00:00:01
exiting because "Download Only" specified

パッケージがダウンロードされているかどうかを確認します。

# ls -al /tmp | grep vsftpd

-rw-r--r--.  1 root root 173060 Aug 10 16:13 vsftpd-3.0.2-22.el7.x86_64.rpm

13。 YUMで更新を確認する

システムを安全に保つために更新が必要なすべてのパッケージを知りたい場合は、以下のコマンドを使用してください。

# yum check-update

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * epel: epel.mirror.net.in
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net

NetworkManager.x86_64                          1:1.8.0-11.el7_4                          updates
NetworkManager-libnm.x86_64                    1:1.8.0-11.el7_4                          updates
NetworkManager-team.x86_64                     1:1.8.0-11.el7_4                          updates
NetworkManager-tui.x86_64                      1:1.8.0-11.el7_4                          updates
.     .     .
.     .     .
xmlsec1-openssl.x86_64                         1.2.20-7.el7_4                            updates
Obsoleting Packages
grub2.x86_64                                   1:2.02-0.65.el7.centos.2                  updates
    grub2.x86_64                               1:2.02-0.64.el7.centos                    @anaconda
grub2-tools.x86_64                             1:2.02-0.65.el7.centos.2                  updates
    grub2-tools.x86_64                         1:2.02-0.64.el7.centos                    @anaconda
grub2-tools-extra.x86_64                       1:2.02-0.65.el7.centos.2                  updates
    grub2-tools.x86_64                         1:2.02-0.64.el7.centos                    @anaconda
grub2-tools-minimal.x86_64                     1:2.02-0.65.el7.centos.2                  updates
    grub2-tools.x86_64                         1:2.02-0.64.el7.centos                    @anaconda

14。 YUMでシステムを更新する

インストールされているすべてのパッケージを一度に更新したり、システムをオペレーティングシステムの新しいリリースにアップグレードしたりするには、次のコマンドを使用できます。

yum update

15。 YUMによる更新からパッケージを除外する

パッケージが更新されないようにしたい場合があります。そのためには、以下のコマンドを使用できます。複数のパッケージをカンマで区切って指定できます。

yum update --exclude kernel

16。 YUMで履歴の詳細を取得する

このステップまで、yumコマンドを何度も実行していた可能性があります。以下のコマンドを使用すると、インストール、消去、更新などのアクションを含む、成功したyumコマンド実行の履歴データを表示できます。

# yum history

Loaded plugins: fastestmirror
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     9 | root               | 2017-12-03 09:01 | Install        |    1
     8 | root               | 2017-12-03 08:21 | Reinstall      |    1
     7 | root               | 2017-12-03 08:09 | Downgrade      |    1
     6 | root               | 2017-12-03 08:09 | Update         |    1
     5 | root               | 2017-12-03 08:07 | Update         |    2
     4 | root               | 2017-12-03 08:02 | Erase          |    1
     3 | root               | 2017-12-03 08:00 | Install        |    1
     2 | root               | 2017-11-23 10:40 | Install        |    1
     1 | System            | 2017-11-21 21:11 | Install        |  311
history list

IDはyumトランザクションごとに一意であり、次のいくつかの例で役立ちます。

17。情報yumの履歴を確認する

特定のyumコマンドの実行中に何が起こったかを知るには、yumhistoryinfoコマンドを使用できます。

例:yumの実行中に発生した変更を見てみましょう(ID9)。

# yum history info 9

Loaded plugins: fastestmirror
Transaction ID : 9
Begin time     : Sun Dec  3 09:01:14 2017
Begin rpmdb    : 312:6bf3ea07cb67a6d39ce9c212f5afa384fb4b6daa
End time       :                          (0 seconds)
End rpmdb      : 313:b71df284ffdb6a3c0f809b15dfb8db623954acc5
User           : root 
Return-Code    : Success
Command Line   : install epel-release
Transaction performed with:
    Installed     rpm-4.11.3-25.el7.x86_64                      @anaconda
    Installed     yum-3.4.3-154.el7.centos.noarch               @anaconda
    Installed     yum-plugin-fastestmirror-1.1.31-42.el7.noarch @anaconda
Packages Altered:
    Install epel-release-7-9.noarch @extras
history info

18。 yum履歴を含むパッケージを元に戻す

このコマンドを使用すると、特定のyumコマンドの実行で発生した変更を元に戻すことができます。

例:前の手順で、epel-releaseというパッケージがID 9の間にインストールされたことがわかります。インストール全体をyumで元に戻します(パッケージを削除します)。

# yum history undo 9

Loaded plugins: fastestmirror
Undoing transaction 9, from Sun Dec  3 09:01:14 2017
    Install epel-release-7-9.noarch @extras
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-9 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================
 Package                    Arch                 Version              Repository             Size
==================================================================================================
Removing:
 epel-release               noarch               7-9                  @extras                24 k

Transaction Summary
==================================================================================================
Remove  1 Package

Installed size: 24 k
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : epel-release-7-9.noarch                                                        1/1
  Verifying  : epel-release-7-9.noarch                                                        1/1

Removed:
  epel-release.noarch 0:7-9

Complete!

19。 yumhistoryで元に戻す

このコマンドは、特定のyumコマンドの実行で発生した復帰(削除されたパッケージのインストール–ステップ19)を元に戻します。

# yum history redo 9

Loaded plugins: fastestmirror
Repeating transaction 9, from Sun Dec  3 09:01:14 2017
    Install epel-release-7-9.noarch @extras
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-9 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================
 Package                     Arch                  Version            Repository             Size
==================================================================================================
Installing:
 epel-release                noarch                7-9                extras                 14 k

Transaction Summary
==================================================================================================
Install  1 Package

Total download size: 14 k
Installed size: 24 k
Is this ok [y/d/N]: y
Downloading packages:
epel-release-7-9.noarch.rpm                                                |  14 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : epel-release-7-9.noarch                                                        1/1
  Verifying  : epel-release-7-9.noarch                                                        1/1

Installed:
  epel-release.noarch 0:7-9

Complete!

20。 YUMを使用してYUMリポジトリを一覧表示する

マシンに設定されているリポジトリのリストを取得したい。以下のコマンドを使用します。このコマンドは、有効なリポジトリのみを一覧表示します。

# yum repolist

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * epel: epel.mirror.net.in
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
repo id                        repo name                                                    status
base/7/x86_64                  CentOS-7 - Base                                               9,591
epel/x86_64                    Extra Packages for Enterprise Linux 7 - x86_64               12,126
extras/7/x86_64                CentOS-7 - Extras                                               283
updates/7/x86_64               CentOS-7 - Updates                                            1,134
repolist: 23,134

21。 YUMを使用してすべてのYUMリポジトリを一覧表示する

すべてのオプションでyumを使用すると、無効になっているリポジトリを含む、システムに構成されているすべてのリポジトリのリストが表示されます。

# yum repolist all

repo id                       repo name                                            status
C7.0.1406-base/x86_64         CentOS-7.0.1406 - Base                               disabled
C7.0.1406-centosplus/x86_64   CentOS-7.0.1406 - CentOSPlus                         disabled
.     .     .
.     .     .
epel/x86_64                   Extra Packages for Enterprise Linux 7 - x86_64       enabled: 12,126
epel-debuginfo/x86_64         Extra Packages for Enterprise Linux 7 - x86_64 - Deb disabled
epel-source/x86_64            Extra Packages for Enterprise Linux 7 - x86_64 - Sou disabled
epel-testing/x86_64           Extra Packages for Enterprise Linux 7 - Testing - x8 disabled
epel-testing-debuginfo/x86_64 Extra Packages for Enterprise Linux 7 - Testing - x8 disabled
epel-testing-source/x86_64    Extra Packages for Enterprise Linux 7 - Testing - x8 disabled
extras/7/x86_64               CentOS-7 - Extras                                    enabled:    283
extras-source/7               CentOS-7 - Extras Sources                            disabled
fasttrack/7/x86_64            CentOS-7 - fasttrack                                 disabled
updates/7/x86_64              CentOS-7 - Updates                                   enabled:  1,134
updates-source/7              CentOS-7 - Updates Sources                           disabled
repolist: 23,134

22。無効になっているリポジトリをYUMで一覧表示する

無効なオプションを指定してyumを使用すると、システム上の無効なyumリポジトリのみを一覧表示できます。

# yum repolist disabled

Loaded plugins: fastestmirror
repo id                        repo name
C7.0.1406-base/x86_64          CentOS-7.0.1406 - Base
C7.0.1406-centosplus/x86_64    CentOS-7.0.1406 - CentOSPlus
C7.0.1406-extras/x86_64        CentOS-7.0.1406 - Extras
C7.0.1406-fasttrack/x86_64     CentOS-7.0.1406 - CentOSPlus
C7.0.1406-updates/x86_64       CentOS-7.0.1406 - Updates
.     .     .
.     .     .
fasttrack/7/x86_64             CentOS-7 - fasttrack
updates-source/7               CentOS-7 - Updates Sources
repolist: 0

23。 YUMでリポジトリを有効にする

とりあえず特定のリポジトリを有効にしてrpmパッケージをインストールすることもできます。

例:無効状態にあるepel-testingリポジトリからパッケージをインストールするには(13番目のステップの出力を参照)、コマンドは次のようになります。

yum install unifont --enablerepo=epel-testing

24。 YUMでリポジトリを有効にする

場合によっては、複数のリポジトリに同じパッケージがあります。重複を避けるために、以下のコマンドを使用して、他のすべてのリポジトリを無効にすることで特定のリポジトリを有効にすることができます。

yumlistまたはyumsearchコマンドを使用して、パッケージが使用可能なリポジトリーを確認します。

yum install httpd --disablerepo=* --enablerepo=base

25。 YUMを使用してパッケージグループを一覧表示する

以下のコマンドは、システムで使用可能なグループと環境を一覧表示します。

# yum grouplist

Loaded plugins: fastestmirror
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * epel: epel.mirror.net.in
Available Environment Groups:
   Minimal Install
   Compute Node
   Infrastructure Server
   File and Print Server
   Cinnamon Desktop
   MATE Desktop
   Basic Web Server
   Virtualization Host
   Server with GUI
   GNOME Desktop
   KDE Plasma Workspaces
   Development and Creative Workstation
Available Groups:
   CIFS file server
   Compatibility Libraries
.     .     .
.     .     .
   Virtualization
   Web-Based Enterprise Management
   Xfce
   iSCSI Storage Client
Done

26。 YUMを使用してパッケージのグループをインストールする

グループにパッケージをインストールすると、システムが特定の状態に構成されます。例:「Serverwith GUI」グループをインストールすると、システムにグラフィカルインターフェイス(デスクトップ)が追加されます。

yum groupinstall "Server with GUI"

27。 YUMを使用してメタキャッシュを生成する

現在有効になっているyumリポジトリーのすべてのメタデータ(パッケージなど)をダウンロードして使用できるようにします。このコマンドは、パッケージインストールのトランザクションを高速化するのに役立ちます。

# yum makecache

Loaded plugins: fastestmirror
base                                                                       | 3.6 kB  00:00:00
epel/x86_64/metalink                                                       | 5.0 kB  00:00:00
extras                                                                     | 3.4 kB  00:00:00
updates                                                                    | 3.4 kB  00:00:00
(1/8): extras/7/x86_64/prestodelta                                         |  51 kB  00:00:00
(2/8): extras/7/x86_64/other_db                                            |  87 kB  00:00:00
(3/8): epel/x86_64/prestodelta                                             |  807 B  00:00:01
(4/8): updates/7/x86_64/other_db                                           | 362 kB  00:00:02
(5/8): base/7/x86_64/other_db                                              | 2.5 MB  00:00:04
(6/8): epel/x86_64/filelists_db                                            | 9.9 MB  00:00:14
(7/8): epel/x86_64/other_db                                                | 2.9 MB  00:00:16
(8/8): updates/7/x86_64/prestodelta                                        | 428 kB  00:01:02
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
Metadata Cache Created

28。 YUMでキャッシュをクリアする

YUMは/var/ cache / yum /ディレクトリにキャッシュを作成します。エラーが発生したり、ディスク容量を増やしたりした場合は、これをクリアする必要があります。

yum clean all

29。 YUMシェル

YUMには、前の手順で示したすべてのタスクを実行できる独自の対話型シェルプロンプトがあります。以下の例は、YUMシェルを使用してパッケージをインストールする方法を示しています。

# yum shell

Loaded plugins: fastestmirror
> install vsftpd
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * epel: kartolo.sby.datautama.net.id
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
> run
--> Running transaction check
---> Package vsftpd.x86_64 0:3.0.2-22.el7 will be installed
--> Finished Dependency Resolution

==================================================================================================
 Package              Arch                 Version                       Repository          Size
==================================================================================================
Installing:
 vsftpd               x86_64               3.0.2-22.el7                  base               169 k

Transaction Summary
==================================================================================================
Install  1 Package

Total download size: 169 k
Installed size: 348 k
Is this ok [y/d/N]: y
Downloading packages:
vsftpd-3.0.2-22.el7.x86_64.rpm                                             | 169 kB  00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : vsftpd-3.0.2-22.el7.x86_64                                                     1/1
  Verifying  : vsftpd-3.0.2-22.el7.x86_64                                                     1/1

Installed:
  vsftpd.x86_64 0:3.0.2-22.el7

Finished Transaction
> exit
Leaving Shell

30. Get help with YUM

You can get more information about YUM using the below commands.

yum --help

それで全部です。 Post your valuable commands


Cent OS
  1. 初心者向けのLinuxkillallコマンド(8例)

  2. yumupdateコマンドの15以上の例

  3. Linux でのパッケージ管理のための 15 の aptitude コマンドの例

  1. Linuxでのdpkgコマンドと例

  2. Linuxユーザー向けの12のIPコマンド例

  3. Linux での yum コマンドの例

  1. 初心者向けのLinuxdirコマンド(10例)

  2. 初心者向けのLinuxrmコマンドの説明(8例)

  3. 初心者向けのLinuxlnコマンドチュートリアル(5つの例)