Ubuntu Server 14.4 (Trusty Tahr) – add-apt-repository: command not found


The last time I encountered the add-apt-repository: command not found error I was using Ubuntu Server 12.4 Lucid. The solution then was to install python-software-properties as follows:

sudo apt-get install python-software-properties


This did not resolve the issue on my minimal virtual machine installation on Trusty so I installed apt-file – which is an apt package searching utility:

sudo apt-get install apt-file


Update apt-file:

apt-file update


Finally use apt-file to search for the add-apt-repository package:

apt-file search add-apt-repository


As you can see add-apt-repository is in software-properties-common:

software-properties-common: /usr/bin/add-apt-repository
software-properties-common: /usr/share/man/man1/add-apt-repository.1.gz


After installing software-properties-common I was able to use add-apt-repository without any further issue:

sudo apt-get install software-properties-common

Ubuntu – Using apt-file to find missing packages

In a previous post I was unable to run the add-apt-repository command because python-software-properties was not installed on Ubuntu Server. I found the solution (install python-software-properties) by searching the internet but I could have installed apt-file and found the answer myself.

So let’s install apt-file and see how to quickly find the package that contains add-apt-repository.

Open a terminal and issue these commands:

sudo apt-get update
sudo apt-get install apt-file

I was prompted to update apt-file but you can do it manually using the command line:

apt-file update

Now that apt-file is installed and up-to-date let’s issue a search for add-apt-repository:

apt-file search add-apt-repository

The result of the search is as follows:

$ apt-file search add-apt-repository
python-software-properties: /usr/bin/add-apt-repository
python-software-properties: /usr/share/man/man1/add-apt-repository.1.

As you can see the result tells us that the file that we are looking for is in the python-software-properties package. Once that is installed we can run the add-apt- repository command.

Apt-file is a great tool – and I am sure that I will be using it again in the near future!