LoginSignup
216

More than 3 years have passed since last update.

apt-getで見つからないパッケージを追加する方法(debian, ubuntu両方対応)

Last updated at Posted at 2016-10-10

はじめに

apt-get installでパッケージ名を指定してインストールしようとした場合に、デフォルトにリポジトリに登録されておらずインストール出来ない場合がある。
今回はiozone3をインストールする例を使って説明する。

検証環境

Debian GNU/Linux 8

対象のパッケージがどこのリポジトリにあるか探す

まずデフォルトのパッケージのリストからインストールを試みる

まずデフォルトのパッケージのリストからインストールを試みてパッケージが見つからないエラーが出ることを確認する

> apt-get install iozone3
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package iozone3

パッケージがあるリポジトリを探す

パッケージ名を検索ウインドウに入れて調べると、どこのパッケージにあるか教えてくれる。

Debianの場合はこちら
https://www.debian.org/distrib/packages

Ubuntuの場合はこちら
http://packages.ubuntu.com/ja/

Debianのiozone3はnon-freeのリポジトリにある
https://packages.debian.org/jessie/utils/iozone3

以下よりnon-freeリポジトリをリポジトリのリストに追加する手順を説明する

repositoryを追加する

まず現状のリポジトリのリストを確認する

> cat /etc/apt/sources.list
deb http://httpredir.debian.org/debian jessie main
deb http://httpredir.debian.org/debian jessie-updates main
deb http://security.debian.org jessie/updates main

non-freeがないことを確認

apt-add-repositoryをインストールする

リポジトリの追加用のapt-add-repositoryパッケージをインストールする

# apt-add-repositoryがどこにあるかコマンドラインで調べたい場合はapt-fileを使う
> apt-get install apt-file
> apt-file update
> apt-file search apt-add-repository

# apt-add-repositoryは software-properties-commonに含まれているのでまるっとインストールする
> apt-get install -y software-properties-common

non-freeリポジトリを追加する

先程調べたiozone3パッケージのあるnon-freeリポジトリをリポジトリのリストに追加してあげる

> apt-add-repository non-free

リポジトリリストの確認、一番最後の行にnon-freeが追加されていることがわかる

> cat /etc/apt/sources.list
deb http://httpredir.debian.org/debian jessie main
deb http://httpredir.debian.org/debian jessie-updates main
deb http://security.debian.org jessie/updates main
deb http://http.us.debian.org/debian/ jessie non-free

iozone3のインストール

普通にapt-getでインストール出来ることを確認。

> apt-get update
> apt-get install -y iozone3

インストールできたことをバージョンを表示することで確認する

> iozone -v
       'Iozone' Filesystem Benchmark Program

        Version $Revision: 3.429 $
    Compiled for 64 bit mode.

       Original Author: William Norcott (wnorcott@us.oracle.com)
               4 Dunlap Drive
               Nashua, NH 03060

       Enhancements: Don Capps (capps@iozone.org)
              7417 Crenshaw
              Plano, TX 75025

  Copyright 1991, 1992, 1994, 1998, 1999, 2002   William D. Norcott

  License to freely use and distribute this software is hereby granted
  by the author, subject to the condition that this copyright notice
  remains intact.  The author retains the exclusive right to publish
  derivative works based on this work, including, but not limited to,
  revised versions of this work

  Other contributors:

  Don Capps       (Network Appliance)   capps@iozone.org

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
216