≡ Menu

Ubuntu sudo: add-apt-repository: command not found error and solution

I‘m trying to run a command ‘sudo add-apt-repository ppa:foo/bar‘ but getting the following error:

     sudo: add-apt-repository: command not found

How do I fix this problem on Ubuntu Linux 14.04 LTS server?

To manage the repositories that you install software from various PPA (Personal Package Archives). It allow you to upload Ubuntu source packages to be built and published as an apt repository by Launchpad.

Fix add-apt-repository: command not found

Simply install the following package on Ubuntu Linux version 14.04 LTS:
$ sudo apt-get install software-properties-common
If you are using Ubuntu Linux version 12.04 LTS or 12.10 or version 13.10 or older try:
$ sudo apt-get install python-software-properties
Sample outputs:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  ca-certificates gir1.2-glib-2.0 iso-codes libasn1-8-heimdal libcurl3-gnutls
  libdbus-glib-1-2 libgirepository-1.0-1 libglib2.0-0 libglib2.0-data
  libgssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal
  libheimntlm0-heimdal libhx509-5-heimdal libidn11 libkrb5-26-heimdal
  libldap-2.4-2 libroken18-heimdal librtmp0 libsasl2-2 libsasl2-modules
  libsasl2-modules-db libwind0-heimdal libxml2 openssl python-apt-common
  python3-apt python3-dbus python3-gi python3-pycurl
  python3-software-properties sgml-base shared-mime-info unattended-upgrades
  xml-core xz-utils
Suggested packages:
  isoquery libsasl2-modules-otp libsasl2-modules-ldap libsasl2-modules-sql
  libsasl2-modules-gssapi-mit libsasl2-modules-gssapi-heimdal python3-apt-dbg
  python-apt-doc python-dbus-doc python3-dbus-dbg libcurl4-gnutls-dev
  python3-pycurl-dbg sgml-base-doc bsd-mailx mail-transport-agent debhelper
The following NEW packages will be installed:
  ca-certificates gir1.2-glib-2.0 iso-codes libasn1-8-heimdal libcurl3-gnutls
  libdbus-glib-1-2 libgirepository-1.0-1 libglib2.0-0 libglib2.0-data
  libgssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal
  libheimntlm0-heimdal libhx509-5-heimdal libidn11 libkrb5-26-heimdal
  libldap-2.4-2 libroken18-heimdal librtmp0 libsasl2-2 libsasl2-modules
  libsasl2-modules-db libwind0-heimdal libxml2 openssl python-apt-common
  python3-apt python3-dbus python3-gi python3-pycurl
  python3-software-properties sgml-base shared-mime-info
  software-properties-common unattended-upgrades xml-core xz-utils
0 upgraded, 37 newly installed, 0 to remove and 0 not upgraded.
Need to get 7,173 kB of archives.
After this operation, 37.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu/ trusty-updates/main libroken18-heimdal amd64 1.6~git20131207+dfsg-1ubuntu1.1 [40.0 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ trusty-updates/main libasn1-8-heimdal amd64 1.6~git20131207+dfsg-1ubuntu1.1 [161 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ trusty/main libidn11 amd64 1.28-1ubuntu2 [93.0 kB]
Get:4 http://archive.ubuntu.com/ubuntu/ trusty-updates/main libhcrypto4-heimdal amd64 1.6~git20131207+dfsg-1ubuntu1.1 [83.9 kB]
Get:5 http://archive.ubuntu.com/ubuntu/ trusty-updates/main libheimbase1-heimdal amd64 1.6~git20131207+dfsg-1ubuntu1.1 [28.9 kB]
Get:6 http://archive.ubuntu.com/ubuntu/ trusty-updates/main libwind0-heimdal amd64 1.6~git20131207+dfsg-1ubuntu1.1 [47.8 kB]
....
..
...
Setting up iso-codes (3.52-1) ...
Setting up libglib2.0-data (2.40.2-0ubuntu1) ...
Setting up libsasl2-modules:amd64 (2.1.25.dfsg1-17build1) ...
Setting up python-apt-common (0.9.3.5ubuntu2) ...
Setting up python3-apt (0.9.3.5ubuntu2) ...
Setting up python3-dbus (1.2.0-2build2) ...
Setting up python3-gi (3.12.0-1ubuntu1) ...
Setting up shared-mime-info (1.2-0ubuntu3) ...
Setting up xml-core (0.13+nmu2) ...
Setting up python3-pycurl (7.19.3-0ubuntu3) ...
Setting up xz-utils (5.1.1alpha+20120614-2ubuntu2) ...
update-alternatives: using /usr/bin/xz to provide /usr/bin/lzma (lzma) in auto mode
Setting up unattended-upgrades (0.82.1ubuntu2.4) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up python3-software-properties (0.92.37.7) ...
Setting up software-properties-common (0.92.37.7) ...
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
Processing triggers for ca-certificates (20141019ubuntu0.14.04.1) ...
Updating certificates in /etc/ssl/certs... 173 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d....done.
Processing triggers for sgml-base (1.26+nmu4ubuntu1) ...

Now you can use the following command to configure PPA:
$ sudo add-apt-repository ppa:foo/bar
See apt-get(8) man page for more info.

Sysadmin because even developers need heroes!!!

Share this tutorial on:
{ 0 comments… add one }
Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">


   Tagged with: