LoginSignup
9
8

More than 5 years have passed since last update.

よくわからないままyumを使っていたのでyumについて調べた

Last updated at Posted at 2018-06-02

とりあえずyum installでパッケージをインストールできるんでしょぐらいな認識で使ってたのですが、
教えてもらう機会があったので、追加で調べたりもしてまとめました。

yumとは

Yellowdog Updater Modifiedの略で、RedHat系ディストリビューション(CentOSやFedoraなど)で利用されるパッケージ管理ツールのことです。

apt-getとかaptはDebian系ディストリビューション(Ubuntuなど)で利用されています。

パッケージ/リポジトリとは

yum / rpm / パッケージ / リポジトリ とは

Linux/Unix における パッケージ とは、ある機能を持ったプログラムの集合です。 レポジトリ とは、パッケージが保存されている場所です。 サーバシステムにおけるレポジトリとは、公開されているネットワーク上のどこかにおかれていることを指す場合が多いです。

仕組み

yum install でパッケージを指定すると、なぜそのパッケージがインストールできるのか?どこから持ってきてんの?って感じだったのですが、下記のディレクトリにリポジトリがあります。
こちらのリポジトリを参照して、指定されたパッケージが存在するかを確認しています。

(amazon linux)
$ ll /etc/yum.repos.d/
合計 28
-rw-r--r-- 1 root root  676  2月 27  2016 amzn-main.repo
-rw-r--r-- 1 root root  328  2月 27  2016 amzn-nosrc.repo
-rw-r--r-- 1 root root  694  2月 27  2016 amzn-preview.repo
-rw-r--r-- 1 root root  694  2月 27  2016 amzn-updates.repo
-rw-r--r-- 1 root root 1056  3月  1  2013 epel-testing.repo
-rw-r--r-- 1 root root  957  3月  1  2013 epel.repo

以前、yumが入っていない環境にyumをinstallしたのですが、yumコマンドは実行できるものの、参照するリポジトリが空だったため、どのパッケージもinstallできませんでした。

(先ほどと違う環境です)
$ $ ll /etc/yum/repos.d
total 12
drwxr-xr-x 2 root root 4096 Jun  1 12:28 ./
drwxr-xr-x 5 root root 4096 Jun  1 12:11 ../

その場合は、下記のようにinstall時に参照されるリポジトリを追加する必要があります。(12,509個のパッケージがインストールできる状態)

$ wget http://ftp.riken.jp/Linux/fedora/epel/RPM-GPG-KEY-EPEL-6

$ ll /etc/yum/repos.d
total 12
drwxr-xr-x 2 root root 4096 Jun  1 12:28 ./
drwxr-xr-x 5 root root 4096 Jun  1 12:11 ../
-rw-r--r-- 1 root root  141 Jun  1 12:28 epel.repo

$ vim /etc/yum/repos.d/epel.repo
[epel]
name=EPEL RPM Repository for Red Hat Enterprise Linux
baseurl=http://ftp.riken.jp/Linux/fedora/epel/6/$basearch/
gpgcheck=1
# enabledを1に変更して、常時利用する
enabled=1

$ yum repolist all
repo id                                repo name                                                                        status
epel                                   EPEL RPM Repository for Red Hat Enterprise Linux                                 enabled: 12,509
repolist: 12,509

rpmからdnfに移行してきている

wikipediaにまとまっているのが一番わかりやすいなと思いました。
wikipedia DNF (ソフトウェア)
yumはpython3には対応しておらず、python2でしか動かないらしいですね。

9
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
8