CentOS6でfishインストールに失敗したときの対処

# オフィシャル通りにインストールしてもエラーが発生する

[公式のインストールドキュメント](https://software.opensuse.org/download.html?project=shells%3Afish%3Arelease%3A2&package=fish) どおりに操作してもエラーが発生してインストールできまない。

```
# cd /etc/yum.repos.d/
# wget https://download.opensuse.org/repositories/shells:fish:release:2/CentOS_6/shells:fish:release:2.repo
# yum install fish
```

エラーは以下の通り

```
Fehler:  Multilib version problems found. This often means that the root
        cause is something else and multilib version checking is just
        pointing out that there is a problem. Eg.:

          1. You have an upgrade for libstdc++ which is missing some
             dependency that another package requires. Yum is trying to
             solve this by installing an older version of libstdc++ of the
             different architecture. If you exclude the bad architecture
             yum will tell you what the root cause is (which package
             requires what). You can try redoing the upgrade with
             --exclude libstdc++.otherarch ... this should give you an error
             message showing the root cause of the problem.

          2. You have multiple architectures of libstdc++ installed, but
             yum can only see an upgrade for one of those arcitectures.
             If you don't want/need both architectures anymore then you
             can remove the one with the missing update and everything
             will work.

          3. You have duplicate versions of libstdc++ installed already.
             You can use "yum check" to get yum show these errors.

        ...you can also use --setopt=protected_multilib=false to remove
        this checking, however this is almost never the correct thing to
        do as something else is very likely to go wrong (often causing
        much more problems).

        Protected multilib versions: libstdc++-4.4.7-23.el6.i686 != libstdc++-4.4.7-11.el6.x86_64
Fehler: Protected multilib versions: libgcc-4.4.7-23.el6.i686 != libgcc-4.4.7-11.el6.x86_64
```

どうやら `libstdc++` と `libgcc` のパッケージが重複してインストールされているらしい。

# yum check でパッケージの問題を探す

メッセージどおりに `$ yum check` を実行する。

```
# yum check
Geladene Plugins: fastestmirror
cpp-4.4.7-23.el6.x86_64 is a duplicate with cpp-4.4.7-11.el6.x86_64
1:dbus-libs-1.2.24-9.el6.x86_64 is a duplicate with 1:dbus-libs-1.2.24-7.el6_3.x86_64
gcc-4.4.7-23.el6.x86_64 is a duplicate with gcc-4.4.7-11.el6.x86_64
gmp-4.3.1-13.el6.x86_64 is a duplicate with gmp-4.3.1-7.el6_2.2.x86_64
libgcc-4.4.7-23.el6.x86_64 is a duplicate with libgcc-4.4.7-11.el6.x86_64
libgcrypt-1.4.5-12.el6_8.x86_64 is a duplicate with libgcrypt-1.4.5-11.el6_4.x86_64
libgomp-4.4.7-23.el6.x86_64 is a duplicate with libgomp-4.4.7-11.el6.x86_64
libstdc++-4.4.7-23.el6.x86_64 is a duplicate with libstdc++-4.4.7-11.el6.x86_64
libxml2-2.7.6-21.el6_8.1.x86_64 is a duplicate with libxml2-2.7.6-14.el6_5.2.x86_64
Fehler: check all
```

いくつかのパッケージに重複があるようだ。

# 重複問題を解決する

これらを解消するには前者のパッケージを削除すれば良い。
一旦このリストをテキストファイルに保存する。

```
# yum check > duplication
```

1行目と最後の行が不要なのでエディタなどで削除してパッケージのリストにして準備OK。

```
# cat duplication
cpp-4.4.7-23.el6.x86_64 is a duplicate with cpp-4.4.7-11.el6.x86_64
1:dbus-libs-1.2.24-9.el6.x86_64 is a duplicate with 1:dbus-libs-1.2.24-7.el6_3.x86_64
gcc-4.4.7-23.el6.x86_64 is a duplicate with gcc-4.4.7-11.el6.x86_64
gmp-4.3.1-13.el6.x86_64 is a duplicate with gmp-4.3.1-7.el6_2.2.x86_64
libgcc-4.4.7-23.el6.x86_64 is a duplicate with libgcc-4.4.7-11.el6.x86_64
libgcrypt-1.4.5-12.el6_8.x86_64 is a duplicate with libgcrypt-1.4.5-11.el6_4.x86_64
libgomp-4.4.7-23.el6.x86_64 is a duplicate with libgomp-4.4.7-11.el6.x86_64
libstdc++-4.4.7-23.el6.x86_64 is a duplicate with libstdc++-4.4.7-11.el6.x86_64
libxml2-2.7.6-21.el6_8.1.x86_64 is a duplicate with libxml2-2.7.6-14.el6_5.2.x86_64
```

あとはワンライナーで前者のパッケージだけを消していけば良い。

```
# yum remove $(cat dup | awk '{print $1'} | xargs )
```

これで重複が解消されるのでfishがインストールできるようになった。