動かざることバグの如し

近づきたいよ 君の理想に

Ubuntuで古いバージョンのパッケージをインストールする

環境

最新ではなく1つ前のバージョンをインストールしたい、ってのはよくあると思う。そもそも特定のバージョンをインストールするには、そのバージョンがいくつかを知る必要があるのだが、Ubuntuだと結構面倒だった。

古い記事(Ubuntu 12とか)だとapt-show-versionsコマンド使おうとか、apt-cacheで裏技的にバージョンを表示していたが、aptコマンドに統一されてからは結構直感的に出来るようになった わーい

方法

例えば cudaのバージョン一覧を表示したい場合、apt show <パッケージ名> -aで一覧が表示される。-aをつけないと最新版歯科表示されないので注意

# apt show cuda -a

Package: cuda
Version: 9.1.85-1
Priority: optional
Section: multiverse/devel
Maintainer: cudatools <cudatools@nvidia.com>
Installed-Size: 25.6 kB
Depends: cuda-9-1 (>= 9.1.85)
Download-Size: 2,512 B
APT-Sources: http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64  Packages
Description: CUDA meta-package
 Meta-package containing all the available packages required for native CUDA
 development. Contains the toolkit, samples, driver and documentation.

Package: cuda
Version: 9.0.176-1
Priority: optional
Section: multiverse/devel
Maintainer: cudatools <cudatools@nvidia.com>
Installed-Size: 25.6 kB
Depends: cuda-9-0 (>= 9.0.176)
Download-Size: 2,504 B
APT-Sources: http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64  Packages
Description: CUDA meta-package
 Meta-package containing all the available packages required for native CUDA
 development. Contains the toolkit, samples, driver and documentation.

Package: cuda
Version: 8.0.61-1
Priority: optional
Section: multiverse/devel
Maintainer: cudatools <cudatools@nvidia.com>
Installed-Size: 25.6 kB
Depends: cuda-8-0 (>= 8.0.61)
Download-Size: 2,510 B
APT-Sources: http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64  Packages
Description: CUDA meta-package
 Meta-package containing all the available packages required for native CUDA
 development. Contains the toolkit, samples, driver and documentation.

Package: cuda
Version: 8.0.44-1
Priority: optional
Section: multiverse/devel
Maintainer: cudatools <cudatools@nvidia.com>
Installed-Size: 25.6 kB
Depends: cuda-8-0 (>= 8.0.44)
Download-Size: 2,504 B
APT-Sources: http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64  Packages
Description: CUDA meta-package
 Meta-package containing all the available packages required for native CUDA
 development. Contains the toolkit, samples, driver and documentation.

ここで8.0.61-1をインストールしたい場合は

apt install cuda=8.0.61-1

でおk かんたんだ