Ubuntu 18.04 yumコマンドインストール 時のエラー 解決法

# 目的

- yumを使えるようにインストールを行った際にエラーが出たときの解決法を知る。

# 実行環境

- OS  
Ubuntu18.04

# エラー概要

- コマンド`sudo apt install yum`を実行した際にエラーになる。

# 解決法概要

- コマンド`sudo apt-get update`の実行する。
- コマンド`sudo apt install yum`を実行する。

# 原因概要

- Ubuntuのupdateが必要になる。
- コマンド`sudo apt-get update`が必要になる。
- コマンド`sudo apt-get update`を実行し、エラーが出た方は[こちら](https://qiita.com/miriwo/items/bc2c0f18ee7d6f337ed0)

# エラー内容の詳細

- コマンド`sudo apt install yum`を実行した際に下記のエラーが出力された。
- エラー文は「E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/python2.7/libpython2.7_2.7.15-4ubuntu4~18.04_amd64.deb  404  Not Found [IP: 91.189.88.24 80]」と「E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?」

  ```shell
  shun@DESKTOP-AO64T0U:~$ sudo apt install yum
  [sudo] password for shun:
  Reading package lists... Done
  Building dependency tree
  Reading state information... Done
  The following packages were automatically installed and are no longer required:
  gyp libjs-async libjs-inherits libjs-node-uuid libjs-underscore libuv1-dev node-abbrev
  node-ansi node-ansi-color-table node-archy node-async node-balanced-match
  node-block-stream node-brace-expansion node-builtin-modules node-combined-stream
  node-concat-map node-cookie-jar node-delayed-stream node-forever-agent node-form-data
  node-fs.realpath node-fstream node-fstream-ignore node-github-url-from-git node-glob
  node-graceful-fs node-hosted-git-info node-inflight node-inherits node-ini
  node-is-builtin-module node-isexe node-json-stringify-safe node-lockfile node-lru-cache
  node-mime node-minimatch node-mkdirp node-mute-stream node-node-uuid node-nopt
  node-normalize-package-data node-npmlog node-once node-osenv node-path-is-absolute
  node-pseudomap node-qs node-read node-read-package-json node-request node-retry
  node-rimraf node-semver node-sha node-slide node-spdx-correct node-spdx-expression-parse
  node-spdx-license-ids node-tar node-tunnel-agent node-underscore
  node-validate-npm-package-license node-which node-wrappy node-yallist
  Use 'sudo apt autoremove' to remove them.
  The following additional packages will be installed:
  debugedit libarchive13 libdw1 liblua5.2-0 libnspr4 libnss3 libpython2.7 librpm8
  librpmbuild8 librpmio8 librpmsign8 libsqlite0 python-libxml2 python-lzma python-pycurl
  python-rpm python-sqlite python-sqlitecachec python-urlgrabber rpm rpm-common rpm2cpio
  Suggested packages:
  rpm-i18n lrzip libcurl4-gnutls-dev python-pycurl-dbg python-pycurl-doc python-sqlite-dbg
  alien elfutils rpmlint rpm2html
  The following NEW packages will be installed:
  debugedit libarchive13 libdw1 liblua5.2-0 libnspr4 libnss3 libpython2.7 librpm8
  librpmbuild8 librpmio8 librpmsign8 libsqlite0 python-libxml2 python-lzma python-pycurl
  python-rpm python-sqlite python-sqlitecachec python-urlgrabber rpm rpm-common rpm2cpio yum
  0 upgraded, 23 newly installed, 0 to remove and 2 not upgraded.
  Need to get 4396 kB of archives.
  After this operation, 17.2 MB of additional disk space will be used.
  Do you want to continue? [Y/n] Y
  Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libdw1 amd64 0.170-0.4ubuntu0.1 [203 kB]
  Get:2 http://archive.ubuntu.com/ubuntu bionic/main amd64 liblua5.2-0 amd64 5.2.4-1.1build1 [108 kB]
  Get:3 http://archive.ubuntu.com/ubuntu bionic/main amd64 libnspr4 amd64 2:4.18-1ubuntu1 [112 kB]
  Get:4 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libnss3 amd64 2:3.35-2ubuntu2.3 [1136 kB]
  Get:5 http://archive.ubuntu.com/ubuntu bionic/universe amd64 librpmio8 amd64 4.14.1+dfsg1-2 [74.6 kB]
  Get:6 http://archive.ubuntu.com/ubuntu bionic/universe amd64 debugedit amd64 4.14.1+dfsg1-2 [19.1 kB]
  Get:7 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libarchive13 amd64 3.2.2-3.1ubuntu0.3 [288 kB]
  Ign:8 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpython2.7 amd64 2.7.15-4ubuntu4~18.04
  Get:9 http://archive.ubuntu.com/ubuntu bionic/universe amd64 librpm8 amd64 4.14.1+dfsg1-2 [173 kB]
  Err:8 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 libpython2.7 amd64 2.7.15-4ubuntu4~18.04
  404  Not Found [IP: 91.189.88.24 80]
  Get:10 http://archive.ubuntu.com/ubuntu bionic/universe amd64 librpmbuild8 amd64 4.14.1+dfsg1-2 [70.5 kB]
  Get:11 http://archive.ubuntu.com/ubuntu bionic/universe amd64 librpmsign8 amd64 4.14.1+dfsg1-2 [8184 B]
  Get:12 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libsqlite0 amd64 2.8.17-14fakesync1 [160 kB]
  Get:13 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 python-libxml2 amd64 2.9.4+dfsg1-6.1ubuntu1.2 [141 kB]
  Get:14 http://archive.ubuntu.com/ubuntu bionic/universe amd64 python-lzma amd64 0.5.3-3 [27.9 kB]
  Get:15 http://archive.ubuntu.com/ubuntu bionic/universe amd64 python-sqlite amd64 1.0.1-12 [20.9 kB]
  Get:16 http://archive.ubuntu.com/ubuntu bionic/main amd64 python-pycurl amd64 7.43.0.1-0.2 [43.1 kB]
  Get:17 http://archive.ubuntu.com/ubuntu bionic/main amd64 python-urlgrabber all 3.10.2-1 [51.0 kB]
  Get:18 http://archive.ubuntu.com/ubuntu bionic/universe amd64 rpm-common amd64 4.14.1+dfsg1-2 [28.7 kB]
  Get:19 http://archive.ubuntu.com/ubuntu bionic/universe amd64 rpm2cpio amd64 4.14.1+dfsg1-2 [7988 B]
  Get:20 http://archive.ubuntu.com/ubuntu bionic/universe amd64 rpm amd64 4.14.1+dfsg1-2 [119 kB]
  Get:21 http://archive.ubuntu.com/ubuntu bionic/universe amd64 python-rpm amd64 4.14.1+dfsg1-2 [44.7 kB]
  Get:22 http://archive.ubuntu.com/ubuntu bionic/universe amd64 python-sqlitecachec amd64 1.1.4-1 [21.4 kB]
  Get:23 http://archive.ubuntu.com/ubuntu bionic/universe amd64 yum all 3.4.3-3 [486 kB]
  Fetched 3343 kB in 49s (68.1 kB/s)
  E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/python2.7/libpython2.7_2.7.15-4ubuntu4~18.04_amd64.deb  404  Not Found [IP
  91.189.88.24 80]
  E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
  ```

# 解決法詳細

- 先人の知恵によりUbuntuをupdateを行うことでコマンド`sudo apt install yum`が実行できることがわかった。

1. 下記コマンドを実行してUbuntuをupdateする。(実行後エラーが出た方は[こちら](https://qiita.com/miriwo/items/bc2c0f18ee7d6f337ed0))

  ```shell
  $ sudo apt-get update
  ```

1. 下記コマンドを実行してyumをインストールする。

  ```shell
  $ sudo apt install yum
  ```

1. 下記コマンドを実行してyumが正常インストールされたかを確認する。

  ```shell
  $ yum
  ```

1. 下記の様に出力されればコマンド`sudo apt install yum`が正常に実行できている。(長いので途中省略)

  ```shell
  shun@DESKTOP-AO64T0U:~$ yum
  You need to give some command
  Usage: yum [options] COMMAND
  List of Commands:
  check          Check for problems in the rpmdb
                ・
                ・
                ・
                        set value of $releasever in yum config and repo files  
  --setopt=SETOPTS      set arbitrary config and repo options
  Plugin Options:
  ```

# 付録

- コマンド`sudo apt install yum`実行時のすべてのログを下記に記載する。

```shell
[01:06:48]shun@shun-PC~$sudo apt install yum
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  debugedit libarchive13 libdw1 liblua5.2-0 libnspr4 libnss3 libpython2.7 libpython2.7-minimal libpython2.7-stdlib
  librpm8 librpmbuild8 librpmio8 librpmsign8 libsqlite0 python-libxml2 python-lzma python-pycurl python-rpm
  python-sqlite python-sqlitecachec python-urlgrabber python2.7 python2.7-minimal rpm rpm-common rpm2cpio
Suggested packages:
  rpm-i18n lrzip libcurl4-gnutls-dev python-pycurl-dbg python-pycurl-doc python-sqlite-dbg python2.7-doc
  binfmt-support alien elfutils rpmlint rpm2html
The following NEW packages will be installed:
  debugedit libarchive13 libdw1 liblua5.2-0 libnspr4 libnss3 libpython2.7 librpm8 librpmbuild8 librpmio8
  librpmsign8 libsqlite0 python-libxml2 python-lzma python-pycurl python-rpm python-sqlite python-sqlitecachec
  python-urlgrabber rpm rpm-common rpm2cpio yum
The following packages will be upgraded:
  libpython2.7-minimal libpython2.7-stdlib python2.7 python2.7-minimal
4 upgraded, 23 newly installed, 0 to remove and 60 not upgraded.
Need to get 8178 kB of archives.
After this operation, 17.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 python2.7 amd64 2.7.15-4ubuntu4~18.04.1 [239 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpython2.7-stdlib amd64 2.7.15-4ubuntu4~18.04.1 [1915 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 python2.7-minimal amd64 2.7.15-4ubuntu4~18.04.1 [1293 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpython2.7-minimal amd64 2.7.15-4ubuntu4~18.04.1 [336 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libdw1 amd64 0.170-0.4ubuntu0.1 [203 kB]           
Get:6 http://archive.ubuntu.com/ubuntu bionic/main amd64 liblua5.2-0 amd64 5.2.4-1.1build1 [108 kB]                 
Get:7 http://archive.ubuntu.com/ubuntu bionic/main amd64 libnspr4 amd64 2:4.18-1ubuntu1 [112 kB]                    
Get:8 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libnss3 amd64 2:3.35-2ubuntu2.3 [1136 kB]          
Get:9 http://archive.ubuntu.com/ubuntu bionic/universe amd64 librpmio8 amd64 4.14.1+dfsg1-2 [74.6 kB]               
Get:10 http://archive.ubuntu.com/ubuntu bionic/universe amd64 debugedit amd64 4.14.1+dfsg1-2 [19.1 kB]              
Get:11 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libarchive13 amd64 3.2.2-3.1ubuntu0.4 [288 kB]    
Get:12 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpython2.7 amd64 2.7.15-4ubuntu4~18.04.1 [1052 kB]
Get:13 http://archive.ubuntu.com/ubuntu bionic/universe amd64 librpm8 amd64 4.14.1+dfsg1-2 [173 kB]                 
Get:14 http://archive.ubuntu.com/ubuntu bionic/universe amd64 librpmbuild8 amd64 4.14.1+dfsg1-2 [70.5 kB]           
Get:15 http://archive.ubuntu.com/ubuntu bionic/universe amd64 librpmsign8 amd64 4.14.1+dfsg1-2 [8184 B]             
Get:16 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libsqlite0 amd64 2.8.17-14fakesync1 [160 kB]          
Get:17 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 python-libxml2 amd64 2.9.4+dfsg1-6.1ubuntu1.2 [141 kB]
Get:18 http://archive.ubuntu.com/ubuntu bionic/universe amd64 python-lzma amd64 0.5.3-3 [27.9 kB]                   
Get:19 http://archive.ubuntu.com/ubuntu bionic/universe amd64 python-sqlite amd64 1.0.1-12 [20.9 kB]                
Get:20 http://archive.ubuntu.com/ubuntu bionic/main amd64 python-pycurl amd64 7.43.0.1-0.2 [43.1 kB]                
Get:21 http://archive.ubuntu.com/ubuntu bionic/main amd64 python-urlgrabber all 3.10.2-1 [51.0 kB]                  
Get:22 http://archive.ubuntu.com/ubuntu bionic/universe amd64 rpm-common amd64 4.14.1+dfsg1-2 [28.7 kB]             
Get:23 http://archive.ubuntu.com/ubuntu bionic/universe amd64 rpm2cpio amd64 4.14.1+dfsg1-2 [7988 B]                
Get:24 http://archive.ubuntu.com/ubuntu bionic/universe amd64 rpm amd64 4.14.1+dfsg1-2 [119 kB]                     
Get:25 http://archive.ubuntu.com/ubuntu bionic/universe amd64 python-rpm amd64 4.14.1+dfsg1-2 [44.7 kB]             
Get:26 http://archive.ubuntu.com/ubuntu bionic/universe amd64 python-sqlitecachec amd64 1.1.4-1 [21.4 kB]           
Get:27 http://archive.ubuntu.com/ubuntu bionic/universe amd64 yum all 3.4.3-3 [486 kB]                              
Fetched 8178 kB in 55s (150 kB/s)                                                                                   
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "ja_JP.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
(Reading database ... 42052 files and directories currently installed.)
Preparing to unpack .../00-python2.7_2.7.15-4ubuntu4~18.04.1_amd64.deb ...
Unpacking python2.7 (2.7.15-4ubuntu4~18.04.1) over (2.7.15-4ubuntu4~18.04) ...
Preparing to unpack .../01-libpython2.7-stdlib_2.7.15-4ubuntu4~18.04.1_amd64.deb ...
Unpacking libpython2.7-stdlib:amd64 (2.7.15-4ubuntu4~18.04.1) over (2.7.15-4ubuntu4~18.04) ...
Preparing to unpack .../02-python2.7-minimal_2.7.15-4ubuntu4~18.04.1_amd64.deb ...
Unpacking python2.7-minimal (2.7.15-4ubuntu4~18.04.1) over (2.7.15-4ubuntu4~18.04) ...
Preparing to unpack .../03-libpython2.7-minimal_2.7.15-4ubuntu4~18.04.1_amd64.deb ...
Unpacking libpython2.7-minimal:amd64 (2.7.15-4ubuntu4~18.04.1) over (2.7.15-4ubuntu4~18.04) ...
Selecting previously unselected package libdw1:amd64.
Preparing to unpack .../04-libdw1_0.170-0.4ubuntu0.1_amd64.deb ...
Unpacking libdw1:amd64 (0.170-0.4ubuntu0.1) ...
Selecting previously unselected package liblua5.2-0:amd64.
Preparing to unpack .../05-liblua5.2-0_5.2.4-1.1build1_amd64.deb ...
Unpacking liblua5.2-0:amd64 (5.2.4-1.1build1) ...
Selecting previously unselected package libnspr4:amd64.
Preparing to unpack .../06-libnspr4_2%3a4.18-1ubuntu1_amd64.deb ...
Unpacking libnspr4:amd64 (2:4.18-1ubuntu1) ...
Selecting previously unselected package libnss3:amd64.
Preparing to unpack .../07-libnss3_2%3a3.35-2ubuntu2.3_amd64.deb ...
Unpacking libnss3:amd64 (2:3.35-2ubuntu2.3) ...
Selecting previously unselected package librpmio8.
Preparing to unpack .../08-librpmio8_4.14.1+dfsg1-2_amd64.deb ...
Unpacking librpmio8 (4.14.1+dfsg1-2) ...
Selecting previously unselected package debugedit.
Preparing to unpack .../09-debugedit_4.14.1+dfsg1-2_amd64.deb ...
Unpacking debugedit (4.14.1+dfsg1-2) ...
Selecting previously unselected package libarchive13:amd64.
Preparing to unpack .../10-libarchive13_3.2.2-3.1ubuntu0.4_amd64.deb ...
Unpacking libarchive13:amd64 (3.2.2-3.1ubuntu0.4) ...
Selecting previously unselected package libpython2.7:amd64.
Preparing to unpack .../11-libpython2.7_2.7.15-4ubuntu4~18.04.1_amd64.deb ...
Unpacking libpython2.7:amd64 (2.7.15-4ubuntu4~18.04.1) ...
Selecting previously unselected package librpm8.
Preparing to unpack .../12-librpm8_4.14.1+dfsg1-2_amd64.deb ...
Unpacking librpm8 (4.14.1+dfsg1-2) ...
Selecting previously unselected package librpmbuild8.
Preparing to unpack .../13-librpmbuild8_4.14.1+dfsg1-2_amd64.deb ...
Unpacking librpmbuild8 (4.14.1+dfsg1-2) ...
Selecting previously unselected package librpmsign8.
Preparing to unpack .../14-librpmsign8_4.14.1+dfsg1-2_amd64.deb ...
Unpacking librpmsign8 (4.14.1+dfsg1-2) ...
Selecting previously unselected package libsqlite0.
Preparing to unpack .../15-libsqlite0_2.8.17-14fakesync1_amd64.deb ...
Unpacking libsqlite0 (2.8.17-14fakesync1) ...
Selecting previously unselected package python-libxml2.
Preparing to unpack .../16-python-libxml2_2.9.4+dfsg1-6.1ubuntu1.2_amd64.deb ...
Unpacking python-libxml2 (2.9.4+dfsg1-6.1ubuntu1.2) ...
Selecting previously unselected package python-lzma.
Preparing to unpack .../17-python-lzma_0.5.3-3_amd64.deb ...
Unpacking python-lzma (0.5.3-3) ...
Selecting previously unselected package python-sqlite.
Preparing to unpack .../18-python-sqlite_1.0.1-12_amd64.deb ...
Unpacking python-sqlite (1.0.1-12) ...
Selecting previously unselected package python-pycurl.
Preparing to unpack .../19-python-pycurl_7.43.0.1-0.2_amd64.deb ...
Unpacking python-pycurl (7.43.0.1-0.2) ...
Selecting previously unselected package python-urlgrabber.
Preparing to unpack .../20-python-urlgrabber_3.10.2-1_all.deb ...
Unpacking python-urlgrabber (3.10.2-1) ...
Selecting previously unselected package rpm-common.
Preparing to unpack .../21-rpm-common_4.14.1+dfsg1-2_amd64.deb ...
Unpacking rpm-common (4.14.1+dfsg1-2) ...
Selecting previously unselected package rpm2cpio.
Preparing to unpack .../22-rpm2cpio_4.14.1+dfsg1-2_amd64.deb ...
Unpacking rpm2cpio (4.14.1+dfsg1-2) ...
Selecting previously unselected package rpm.
Preparing to unpack .../23-rpm_4.14.1+dfsg1-2_amd64.deb ...
Unpacking rpm (4.14.1+dfsg1-2) ...
Selecting previously unselected package python-rpm.
Preparing to unpack .../24-python-rpm_4.14.1+dfsg1-2_amd64.deb ...
Unpacking python-rpm (4.14.1+dfsg1-2) ...
Selecting previously unselected package python-sqlitecachec.
Preparing to unpack .../25-python-sqlitecachec_1.1.4-1_amd64.deb ...
Unpacking python-sqlitecachec (1.1.4-1) ...
Selecting previously unselected package yum.
Preparing to unpack .../26-yum_3.4.3-3_all.deb ...
Unpacking yum (3.4.3-3) ...
Setting up python-lzma (0.5.3-3) ...
Setting up libdw1:amd64 (0.170-0.4ubuntu0.1) ...
Setting up python-sqlitecachec (1.1.4-1) ...
Setting up libarchive13:amd64 (3.2.2-3.1ubuntu0.4) ...
Setting up python-pycurl (7.43.0.1-0.2) ...
Setting up libnspr4:amd64 (2:4.18-1ubuntu1) ...
Setting up python-urlgrabber (3.10.2-1) ...
Setting up liblua5.2-0:amd64 (5.2.4-1.1build1) ...
Setting up libpython2.7-minimal:amd64 (2.7.15-4ubuntu4~18.04.1) ...
Setting up libsqlite0 (2.8.17-14fakesync1) ...
Setting up libpython2.7-stdlib:amd64 (2.7.15-4ubuntu4~18.04.1) ...
Setting up python2.7-minimal (2.7.15-4ubuntu4~18.04.1) ...
Setting up python2.7 (2.7.15-4ubuntu4~18.04.1) ...
Setting up libnss3:amd64 (2:3.35-2ubuntu2.3) ...
Setting up python-sqlite (1.0.1-12) ...
Setting up libpython2.7:amd64 (2.7.15-4ubuntu4~18.04.1) ...
Setting up python-libxml2 (2.9.4+dfsg1-6.1ubuntu1.2) ...
Setting up librpmio8 (4.14.1+dfsg1-2) ...
Setting up debugedit (4.14.1+dfsg1-2) ...
Setting up librpm8 (4.14.1+dfsg1-2) ...
Setting up rpm-common (4.14.1+dfsg1-2) ...
Setting up librpmsign8 (4.14.1+dfsg1-2) ...
Setting up librpmbuild8 (4.14.1+dfsg1-2) ...
Setting up rpm2cpio (4.14.1+dfsg1-2) ...
Setting up python-rpm (4.14.1+dfsg1-2) ...
Setting up rpm (4.14.1+dfsg1-2) ...
Setting up yum (3.4.3-3) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for mime-support (3.60ubuntu1) ...
```