以下の内容はhttps://kazuhira-r.hatenablog.com/entry/2025/11/29/173301より取得しました。


aptのパッケージでインストール可能なバージョンを一覧表示する(apt list --all-versions)、バージョンを指定してインストールする

これは、なにをしたくて書いたもの?

aptのパッケージでインストール可能なパージョンを一覧表示したり、バージョンを指定してインストールする方法をいつも
忘れて調べ直して迷子になるのでメモしておきます。

apt

バージョンを確認するには、apt list --all-versions [パッケージ名]です。

Ubuntu Manpage: apt - command-line interface

またバージョンを指定してインストールするにはapt install [パッケージ名]=[バージョン]です。

apt show --all-versions [パッケージ名]でも各バージョンの詳細を見れますが、量が膨大になります…。

Ubuntu Manpage: apt-cache - query the APT cache

少し見ておきましょう。

環境

今回の環境はこちら。

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04.3 LTS
Release:        24.04
Codename:       noble


$ uname -srvmpio
Linux 6.8.0-88-generic #89-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 01:02:46 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

aptのパッケージでインストール可能なバージョンを一覧表示、インストールする

お題にしておいてなんですが、これを使うのはPPAの場合が多いかもしれません。

たとえばGitLabで試してみましょう。PPAを追加してリポジトリーの情報を更新。

$ curl "https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh" | sudo bash
$ sudo apt update

apt list --all-versions gitlab-ceで見てみます。

$ apt list --all-versions gitlab-ce
一覧表示... 完了
gitlab-ce/noble 18.6.1-ce.0 amd64
gitlab-ce/noble 18.6.0-ce.0 amd64
gitlab-ce/noble 18.5.3-ce.0 amd64
gitlab-ce/noble 18.5.2-ce.0 amd64
gitlab-ce/noble 18.5.1-ce.0 amd64
gitlab-ce/noble 18.5.0-ce.0 amd64
gitlab-ce/noble 18.4.5-ce.0 amd64
gitlab-ce/noble 18.4.4-ce.0 amd64
gitlab-ce/noble 18.4.3-ce.0 amd64
gitlab-ce/noble 18.4.2-ce.0 amd64
gitlab-ce/noble 18.4.1-ce.0 amd64
gitlab-ce/noble 18.4.0-ce.0 amd64
gitlab-ce/noble 18.3.6-ce.0 amd64
gitlab-ce/noble 18.3.5-ce.0 amd64
gitlab-ce/noble 18.3.4-ce.0 amd64
gitlab-ce/noble 18.3.3-ce.0 amd64
gitlab-ce/noble 18.3.2-ce.0 amd64
gitlab-ce/noble 18.3.1-ce.0 amd64
gitlab-ce/noble 18.3.0-ce.0 amd64
gitlab-ce/noble 18.2.8-ce.0 amd64
gitlab-ce/noble 18.2.7-ce.0 amd64
gitlab-ce/noble 18.2.6-ce.0 amd64
gitlab-ce/noble 18.2.5-ce.0 amd64
gitlab-ce/noble 18.2.4-ce.0 amd64
gitlab-ce/noble 18.2.2-ce.0 amd64
gitlab-ce/noble 18.2.1-ce.0 amd64
gitlab-ce/noble 18.2.0-ce.0 amd64
gitlab-ce/noble 18.1.6-ce.0 amd64
gitlab-ce/noble 18.1.5-ce.0 amd64
gitlab-ce/noble 18.1.4-ce.0 amd64
gitlab-ce/noble 18.1.3-ce.0 amd64
gitlab-ce/noble 18.1.2-ce.0 amd64
gitlab-ce/noble 18.1.1-ce.0 amd64
gitlab-ce/noble 18.1.0-ce.0 amd64
gitlab-ce/noble 18.0.6-ce.0 amd64
gitlab-ce/noble 18.0.5-ce.0 amd64
gitlab-ce/noble 18.0.4-ce.0 amd64
gitlab-ce/noble 18.0.3-ce.0 amd64
gitlab-ce/noble 18.0.2-ce.0 amd64
gitlab-ce/noble 18.0.1-ce.0 amd64
gitlab-ce/noble 18.0.0-ce.0 amd64
gitlab-ce/noble 17.11.7-ce.0 amd64
gitlab-ce/noble 17.11.6-ce.0 amd64
gitlab-ce/noble 17.11.5-ce.0 amd64
gitlab-ce/noble 17.11.4-ce.0 amd64
gitlab-ce/noble 17.11.3-ce.0 amd64
gitlab-ce/noble 17.11.2-ce.0 amd64
gitlab-ce/noble 17.11.1-ce.0 amd64
gitlab-ce/noble 17.11.0-ce.0 amd64
gitlab-ce/noble 17.10.8-ce.0 amd64
gitlab-ce/noble 17.10.7-ce.0 amd64
gitlab-ce/noble 17.10.6-ce.0 amd64
gitlab-ce/noble 17.10.5-ce.0 amd64
gitlab-ce/noble 17.10.4-ce.0 amd64
gitlab-ce/noble 17.10.3-ce.0 amd64
gitlab-ce/noble 17.10.1-ce.0 amd64
gitlab-ce/noble 17.10.0-ce.0 amd64
gitlab-ce/noble 17.9.8-ce.0 amd64
gitlab-ce/noble 17.9.7-ce.0 amd64
gitlab-ce/noble 17.9.6-ce.0 amd64
gitlab-ce/noble 17.9.5-ce.0 amd64
gitlab-ce/noble 17.9.3-ce.0 amd64
gitlab-ce/noble 17.9.2-ce.0 amd64
gitlab-ce/noble 17.9.1-ce.0 amd64
gitlab-ce/noble 17.9.0-ce.0 amd64
gitlab-ce/noble 17.8.7-ce.0 amd64
gitlab-ce/noble 17.8.6-ce.0 amd64
gitlab-ce/noble 17.8.5-ce.0 amd64
gitlab-ce/noble 17.8.4-ce.0 amd64
gitlab-ce/noble 17.8.2-ce.0 amd64
gitlab-ce/noble 17.8.1-ce.0 amd64
gitlab-ce/noble 17.8.0-ce.0 amd64
gitlab-ce/noble 17.7.7-ce.0 amd64
gitlab-ce/noble 17.7.6-ce.0 amd64
gitlab-ce/noble 17.7.4-ce.0 amd64
gitlab-ce/noble 17.7.3-ce.0 amd64
gitlab-ce/noble 17.7.2-ce.0 amd64
gitlab-ce/noble 17.7.1-ce.0 amd64
gitlab-ce/noble 17.7.0-ce.0 amd64
gitlab-ce/noble 17.6.5-ce.0 amd64
gitlab-ce/noble 17.6.4-ce.0 amd64
gitlab-ce/noble 17.6.3-ce.0 amd64
gitlab-ce/noble 17.6.2-ce.0 amd64
gitlab-ce/noble 17.6.1-ce.0 amd64
gitlab-ce/noble 17.6.0-ce.0 amd64
gitlab-ce/noble 17.5.5-ce.0 amd64
gitlab-ce/noble 17.5.4-ce.0 amd64
gitlab-ce/noble 17.5.3-ce.0 amd64
gitlab-ce/noble 17.5.2-ce.0 amd64
gitlab-ce/noble 17.5.1-ce.0 amd64
gitlab-ce/noble 17.5.0-ce.0 amd64
gitlab-ce/noble 17.4.6-ce.0 amd64
gitlab-ce/noble 17.4.5-ce.0 amd64
gitlab-ce/noble 17.4.4-ce.0 amd64
gitlab-ce/noble 17.4.3-ce.0 amd64
gitlab-ce/noble 17.4.2-ce.0 amd64
gitlab-ce/noble 17.4.1-ce.0 amd64
gitlab-ce/noble 17.4.0-ce.0 amd64
gitlab-ce/noble 17.3.7-ce.0 amd64
gitlab-ce/noble 17.3.6-ce.0 amd64
gitlab-ce/noble 17.3.5-ce.0 amd64
gitlab-ce/noble 17.3.4-ce.0 amd64
gitlab-ce/noble 17.3.3-ce.0 amd64
gitlab-ce/noble 17.3.2-ce.0 amd64
gitlab-ce/noble 17.3.1-ce.0 amd64
gitlab-ce/noble 17.3.0-ce.0 amd64
gitlab-ce/noble 17.2.9-ce.0 amd64
gitlab-ce/noble 17.2.8-ce.0 amd64
gitlab-ce/noble 17.2.7-ce.0 amd64
gitlab-ce/noble 17.2.5-ce.0 amd64
gitlab-ce/noble 17.2.4-ce.0 amd64
gitlab-ce/noble 17.2.2-ce.0 amd64
gitlab-ce/noble 17.2.1-ce.0 amd64
gitlab-ce/noble 17.2.0-ce.0 amd64
gitlab-ce/noble 17.1.8-ce.0 amd64
gitlab-ce/noble 17.1.7-ce.0 amd64
gitlab-ce/noble 17.1.6-ce.0 amd64
gitlab-ce/noble 17.1.4-ce.0 amd64
gitlab-ce/noble 17.1.3-ce.0 amd64
gitlab-ce/noble 17.1.2-ce.0 amd64
gitlab-ce/noble 17.1.1-ce.0 amd64
gitlab-ce/noble 17.1.0-ce.0 amd64

多数のバージョンが表示されました。

バージョンを指定してインストールする場合はこうですね。

$ sudo apt install gitlab-ce=18.5.3-ce.0

Eclipse Temurinの場合。PPAの追加は省略しています。

$ apt list --all-versions temurin-21-jdk
一覧表示... 完了
temurin-21-jdk/noble 21.0.9.0.0+10-0 amd64
temurin-21-jdk/noble 21.0.8.0.0+9-0 amd64
temurin-21-jdk/noble 21.0.7.0.0+6-0 amd64
temurin-21-jdk/noble 21.0.6.0.0+7-1 amd64
temurin-21-jdk/noble 21.0.6.0.0+7-0 amd64
temurin-21-jdk/noble 21.0.5.0.0+11-2 amd64
temurin-21-jdk/noble 21.0.5.0.0+11-1 amd64
temurin-21-jdk/noble 21.0.4.0.0+7-1 amd64
temurin-21-jdk/noble 21.0.3.0.0+9-1 amd64

そしてUbuntu Linuxリポジトリーのパッケージに対してこれをやっても最新版が表示されるだけなので、そもそもバージョンを
指定してインストールするということがありません。

$ apt list --all-versions openjdk-17-jdk
一覧表示... 完了
openjdk-17-jdk/noble-updates,noble-security 17.0.17+10-1~24.04 amd64
openjdk-17-jdk/noble 17.0.11+9-1 amd64

なので、主にPPA向けですね。

おわりに

aptのパッケージでインストール可能なバージョンを一覧表示したり、バージョンを指定してインストールする方法を確認して
みました。

実際のところ、ほとんど使いません。PPAを追加してパッケージインストールする時に指定することがあるくらいなのですが、
その時に探し回ることになるのでメモしておきました。

1番使うのは、個人的にはDockerfileを書く時な気がしますね。




以上の内容はhttps://kazuhira-r.hatenablog.com/entry/2025/11/29/173301より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14