Linuxコマンド【 yum 】パッケージの操作・管理を行う

当ページのリンクには広告が含まれています。

スポンサーリンク

yumコマンドは、パッケージの操作・管理を行うコマンドです。

yumコマンド

書式

yum [オプション] [コマンド] [パッケージ]

yumコマンドは、Yellow Dog Linuxのディストリビューション(CentOSやFedora)のパッケージ管理システムであるYum(Yellowdog Updater Modified)を利用してパッケージを操作・管理するコマンドです。

DebianやUbuntuのパッケージ管理には「apt-getコマンド」を利用します。

スイッチ

info パッケージ指定したパッケージの詳細情報を表示します。
listインストール可能なパッケージ情報を表示します。
install パッケージ指定したパッケージをインストールします。
update パッケージ指定したパッケージをアップデートします。パッケージを指定せずにコマンドを実行した場合は、インストールされている全てのパッケージがアップデートされます。
remove パッケージ指定したパッケージを削除します。
erase パッケージ指定したパッケージを削除します。removeと同義。
search 文字列指定した文字列を含むパッケージ一覧を表示します。

使用例

システムにインストールされている全てのパッケージを更新します。最も頻繁に使うコマンドのひとつです。

# yum update

システムにインストールされているパッケージを表示します。表示結果をパイプ(|)に渡して、moreコマンドを実行すると便利です(閲覧しやすいです)!

# yum list installed | more
Loaded plugins: fastestmirror
Installed Packages
ConsoleKit.x86_64       0.4.1-3.el6     @base                                   
ConsoleKit-libs.x86_64  0.4.1-3.el6     @base                                   
GConf2.x86_64           2.28.0-6.el6    @base                                   
MAKEDEV.x86_64          3.24-6.el6      @anaconda-CentOS-201303020151.x86_64/6.4
ORBit2.x86_64           2.14.17-3.2.el6_3
                                        @base                                   
acl.x86_64              2.2.49-6.el6    @anaconda-CentOS-201303020151.x86_64/6.4
aic94xx-firmware.noarch 30-2.el6        @anaconda-CentOS-201303020151.x86_64/6.4
alsa-lib.x86_64         1.0.22-3.el6    @base                                   
atk.x86_64              1.28.0-2.el6    @base                                   
atmel-firmware.noarch   1.3-7.el6       @anaconda-CentOS-201303020151.x86_64/6.4
attr.x86_64             2.4.44-7.el6    @anaconda-CentOS-201303020151.x86_64/6.4
audit.x86_64            2.2-2.el6       @anaconda-CentOS-201303020151.x86_64/6.4
audit-libs.x86_64       2.2-2.el6       @anaconda-CentOS-201303020151.x86_64/6.4
… 略 …

パッケージ「emacs」を検索してみます。「emacs」という文字列を含むパッケージが表示されるので、その中から必要なパッケージをさがします。パッケージ名の右側にそのパッケージについての簡単な説明が記載されているので、その情報も参考にしましょう。

# yum search emacs
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.riken.jp
 * extras: ftp.riken.jp
 * updates: ftp.riken.jp
========================================== N/S Matched: emacs ==========================================
emacs.x86_64 : GNU Emacs text editor
emacs-a2ps.x86_64 : Emacs bindings for a2ps files
emacs-a2ps-el.x86_64 : Elisp source files for emacs-a2ps under GNU Emacs
emacs-anthy.noarch : Compiled elisp files to run Anthy under GNU Emacs
emacs-anthy-el.noarch : Elisp source files for Anthy under GNU Emacs
emacs-auctex.noarch : Enhanced TeX modes for Emacs
… 略 …

パッケージ「emacs」の詳細情報をみてみましょう。

# yum info emacs
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.riken.jp
 * extras: ftp.riken.jp
 * updates: ftp.riken.jp
Available Packages
Name        : emacs
Arch        : x86_64
Epoch       : 1
Version     : 23.1
Release     : 21.el6_2.3
Size        : 2.2 M
Repo        : base
Summary     : GNU Emacs text editor
URL         : http://www.gnu.org/software/emacs/
License     : GPLv3+
Description : Emacs is a powerful, customizable, self-documenting, modeless text
            : editor. Emacs contains special code editing features, a scripting
            : language (elisp), and the capability to read mail, news, and more
            : without leaving the editor.
            : 
            : This package provides an emacs binary with support for X windows.

パッケージ「emacs」をインストールしてみましょう。以下のコマンドを実行すると、「Is this ok [y/N]:(インストールしてもいいですか?)」と尋ねられるので「y」を入力しEnterキーを押すと、必要なパッケージとともにインストールが実施されます。

# yum install emacs
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.riken.jp
 * extras: ftp.riken.jp
 * updates: ftp.riken.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package emacs.x86_64 1:23.1-21.el6_2.3 will be installed
… 中略 …
Total download size: 44 M
Installed size: 146 M
Is this ok [y/N]: y
… 中略 …
  perl-libs.x86_64 4:5.10.1-131.el6_4              perl-version.x86_64 3:0.77-131.el6_4                 
  pixman.x86_64 0:0.26.2-5.el6_4                   polkit.x86_64 0:0.96-2.el6_0.1                       
  sgml-common.noarch 0:0.6.3-32.el6               

Complete!

パッケージ管理 の人気記事

  1. コマンドリファレンス
  2. Linuxコマンド【 apt-get 】パッケージの操作・管理を行う
  3. Linuxコマンド【 yum 】パッケージの操作・管理を行う
  4. manコマンドの表示を日本語にする方法
  5. Linuxコマンド【 apt-cache 】APTライブラリのキャッシュへアクセスする
  6. Linuxコマンド【 apt-show-versions 】パッケージのバージョンを一覧表示する

関連記事(一部広告含む)