How to add a package not found by apt-get(debian, ubuntu both)
Tags: aptget, debian, aptaddrepository, ubuntu
Published: 2020-05-28 05:37:31

---
title: How to add a package not found by apt-get(debian, ubuntu both)
published: true
description: 
tags: apt-get, Debian, apt-add-repository, Ubuntu 
---


## First things first
If you use apt-get install to install with a package name, it may not be registered in the repository by default and cannot be installed.
In this article, I'll use an example of installing iozone3.

### Verification Environment
Debian GNU/Linux 8


## Find out where the target package is located in the repository

### First try to install from the list of default packages

First, try to install from the list of default packages and make sure you get a "package not found" error

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

### Finding a repository with a package
If you put the package name in the search window, it will tell you which package it is in.

For Debian, click here
https://www.debian.org/distrib/packages

For Ubuntu, click here.
http://packages.ubuntu.com/ja/


Debian's izone3 is in a non-free repository
https://packages.debian.org/jessie/utils/iozone3

Here's how to add a non-free repository to your list of repositories

## Add a repository

First, check the list of the current repositories

```sh
> 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
```
Make sure there is no non-free

### Install the apt-add-repository

Install the apt-add-repository package for adding a repository

```sh
# Use apt-file to find out where apt-add-repository is on the command line
> apt-get install apt-file
> apt-file update
> apt-file search apt-add-repository

# apt-add-repository is included in software-properties-common, so you can install the whole thing
> apt-get install -y software-properties-common
```

### Adding a non-free repository
I'll add the non-free repository with the izone3 package I just examined to the list of repositories

```sh
> apt-add-repository non-free
```

Checking the repository list, you can see the non-free has been added to the last line

```sh
> 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
```

## Installation of iozone3

I confirmed that I can install it normally using apt-get.

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

Confirm that the installation has been completed by displaying the version

```sh
> 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
  The author retains the exclusive right to publish
  The derivative works are based on this work, including, but not limited to,
  revised versions of this work

  Other contributors:

  Don Capps (Network Appliance) capps@iozone.org

```