複数のパッケージをyumインストールするには、すべての成功が必要です。

複数のパッケージをyumインストールするには、すべての成功が必要です。

yum installcentos 7(docker)では、いくつかのパッケージが見つからなくても、複数のパッケージを含むコマンドが成功することがわかります。これはスクリプトにとってひどいことです:-(

golang(EPELリポジトリを追加していないため、この例では見つかりません。)

[root@1ec73c6c476b /]# yum install golang nano
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: centos.interhost.net.il
 * extras: centos.interhost.net.il
 * updates: centos.interhost.net.il
No package golang available.
Resolving Dependencies
--> Running transaction check
---> Package nano.x86_64 0:2.3.1-10.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================================================
 Package                                    Arch                                         Version                                             Repository                                  Size
==============================================================================================================================================================================================
Installing:
 nano                                       x86_64                                       2.3.1-10.el7                                        base                                       440 k

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

Total download size: 440 k
Installed size: 1.6 M
Is this ok [y/d/N]: y
Downloading packages:
nano-2.3.1-10.el7.x86_64.rpm                                                                                                                                           | 440 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : nano-2.3.1-10.el7.x86_64                                                                                                                                                   1/1 
  Verifying  : nano-2.3.1-10.el7.x86_64                                                                                                                                                   1/1 

Installed:
  nano.x86_64 0:2.3.1-10.el7                                                                                                                                                                  

Complete!

[root@1ec73c6c476b /]# echo $?
0

指定されたパッケージがすべて失われた場合にのみ0で終了します。

[root@1ec73c6c476b /]# yum install foo
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: centos.interhost.net.il
 * extras: centos.interhost.net.il
 * updates: centos.interhost.net.il
No package foo available.
Error: Nothing to do

[root@1ec73c6c476b /]# yum install golang foo
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: centos.interhost.net.il
 * extras: centos.interhost.net.il
 * updates: centos.interhost.net.il
No package golang available.
No package foo available.
Error: Nothing to do

~によるとhttps://access.redhat.com/solutions/321603、この変更ログによると、後者の動作はRHEL 6の新機能です。https://github.com/rpm-software-management/yum/blob/master/ChangeLog#L3749-L3762

...もしみんなパッケージが「見つかりません」、yumは「Nothing to do」メッセージをエラーに変換します(1、atmを返します)。 ...したがって:

  1. yum install -y a b && echo worked
    次の場合、「作業中」と表示されます。誰でもaまたはbはyumが完了した後にインストールされますが、両方を同時にインストールしてみてください。
  2. yum install a && yum install b && echo worked
    両方がインストールされている場合(aが利用できない場合、bはインストールを試みません)、「動作しました」というメッセージが表示されます。

しかし、おそらくシングルは(?)yum install a bよりも高速で複雑な場合でしょう。yum install a && yum install b

Q:1回のyum呼び出しで複数のパッケージをインストールするために必要なフラグ/設定はありますか?みんな成功をお探しですか?

ベストアンサー1

yum構成オプションをskip_missing_names_on_installfalseに設定すると、この問題は解決され、yum単一のコマンドを使用して複数のパッケージをインストールできますが、パッケージのうちの欠落がある場合はまだ失敗します。

おすすめ記事