本稿では、aptコマンドを使ってDebianの標準以外のパッケージをインストールする方法を紹介します。
1. はじめに
Debianにパッケージをインストールする時には、aptコマンドを使うことが多いと思います。
デフォルトの状態ではDebianの公式リポジトリのみが/etc/apt/sources.list
に設定されています。
そのため、サードパーティ製のパッケージ(Debianの公式リポジトリに登録されていないパッケージ)をインストールするためには、そのパッケージが格納されてるリポジトリを/etc/apt/sources.list
に追加する必要があります。
今回は、以下の記事を参考にiozone3
のインストールを例に手順を解説します。
2. 実行環境
Debian GNU/Linux 11 (bullseye)
3. 手順
3-1.パッケージディレクトリを検索
以下のサイトから、インストールしたいパッケージが存在するリポジトリを検索します。
「キーワード」にiozone3
と入力して「検索」。
iozone3
はnon-free
リポジトリにあることがわかる。
3-2.リポジトリを追加
/etc/apt/sources.list
にnon-free
リポジトリを追加します。
今回はリポジトリの追加にapt-add-repository
コマンドを使用します(sources.listを自分で直接編集する方法もある)。
apt-add-repository
コマンドを使用するにはsoftware-properties-common
パッケージが必要です。
以下のコマンドを実行して、software-properties-common
パッケージをインストールします。
$ apt install -y software-properties-common
※上記コマンドの-yオプションについて、以下apt-getのmanpageより抜粋
-y, --yes, --assume-yes
Automatic yes to prompts; assume "yes" as answer to all prompts and run non-interactively.
If an undesirable situation, such as changing a held package, trying to install an unauthenticated package or removing an essential package occurs then apt-get will abort.
Configuration Item: APT::Get::Assume-Yes.
次に、以下のコマンドを実行して/etc/apt/sources.list
にnon-free
リポジトリを追加します。
$ apt-add-repository non-free
以下の/etc/apt/sources.list
にnon-free
リポジトリが追加されたことがわかります。
# deb http://ftp.jp.debian.org/debian bullseye main
deb http://ftp.jp.debian.org/debian bullseye main non-free
deb-src http://ftp.jp.debian.org/debian bullseye main non-free
deb http://security.debian.org/debian-security bullseye-security main non-free
deb-src http://security.debian.org/debian-security bullseye-security main non-free
3-3.パッケージをインストール
最後にiozone3
をインストールします。
$ apt update $ apt install -y iozone3
以上です。
【参考】