LoginSignup
71

More than 5 years have passed since last update.

Yum で特定のバージョンを指定してソフトウェアをインストールする方法

Posted at

はじめに

バージョンを固定してソフトウェアをインストールしたい場合によくやる方法だけど、よくやり方を忘れるからメモっとく。

Yum のリポジトリ内にある全ての重複したバージョンを列挙するために --showduplicates というオプションが用意されている。このオプションは、Yum のサブコマンドである listsaearch に対して有効である。

ここでは 1 例として、Docker CE の特定のバージョンをインストールしてみる。前提として、OS は CentOS 7.4 を使い、かつ、Docker 用リポジトリは導入済みとする。

全ての重複バージョンの検索

search サブコマンドに対して --showduplicates オプションを付与すると以下のような結果が出力される。

$ sudo yum --showduplicates search docker-ce
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.riken.jp
 * epel: ftp.riken.jp
 * extras: ftp.riken.jp
 * updates: ftp.riken.jp
========================================================== N/S matched: docker-ce ===========================================================
docker-ce-17.03.0.ce-1.el7.centos.x86_64 : The open-source application container engine
docker-ce-17.03.1.ce-1.el7.centos.x86_64 : The open-source application container engine
docker-ce-17.03.2.ce-1.el7.centos.x86_64 : The open-source application container engine
docker-ce-17.06.0.ce-1.el7.centos.x86_64 : The open-source application container engine
docker-ce-17.06.1.ce-1.el7.centos.x86_64 : The open-source application container engine
docker-ce-17.06.2.ce-1.el7.centos.x86_64 : The open-source application container engine
docker-ce-17.09.0.ce-1.el7.centos.x86_64 : The open-source application container engine
docker-ce-17.09.1.ce-1.el7.centos.x86_64 : The open-source application container engine
docker-ce-17.12.0.ce-1.el7.centos.x86_64 : The open-source application container engine
docker-ce-17.12.1.ce-1.el7.centos.x86_64 : The open-source application container engine
docker-ce-18.03.0.ce-1.el7.centos.x86_64 : The open-source application container engine
docker-ce-selinux-17.03.0.ce-1.el7.centos.noarch : SELinux Policies for the open-source application container engine
docker-ce-selinux-17.03.1.ce-1.el7.centos.noarch : SELinux Policies for the open-source application container engine
docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch : SELinux Policies for the open-source application container engine

  Name and summary matches only, use "search all" for everything.

特定のバージョンを指定してインストール

上記の結果から各バージョンごとのリポジトリ内でのソフトウェア名がわかったので、それを指定してインストールする。

$ sudo yum install docker-ce-17.12.1.ce-1.el7.centos.x86_64

(省略)

Dependencies Resolved

=============================================================================================================================================
 Package                            Arch                    Version                                  Repository                         Size
=============================================================================================================================================
Installing:
 docker-ce                          x86_64                  17.12.1.ce-1.el7.centos                  docker-ce-stable                   30 M
Installing for dependencies:
 container-selinux                  noarch                  2:2.42-1.gitad8f0f7.el7                  extras                             32 k
 libtool-ltdl                       x86_64                  2.4.2-22.el7_3                           base                               49 k

Transaction Summary
=============================================================================================================================================
Install  1 Package (+2 Dependent packages)

(省略)

以上。

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
71