In Ubuntu one can add a repository via following command -

sudo add-apt-repository ppa:yannubuntu/boot-repair

As Ubuntu is based on Debian code base, I was expecting that the same would work in Debian too, but it doesn't.

  • What is the reason for this?
  • Is there some other shell command I can use to achieve the same?

Note: I know I can edit /etc/apt/sources.list, but I want to achieve this from the shell. I also want to know why the same command won't work when the code base is the same.

4 Answers 4


Debian Jessie and later (2014-)

As pointed out by @voltagex in the comments, it can now be found in the software-properties-common package:

sudo apt-get install software-properties-common

Debian Wheezy and earlier:

The program add-apt-repository is available in Debian. It's in the python-software-properties package:

sudo apt-get install python-software-properties

It was added to that package in version 0.75. The current version in Debian Stable ('squeeze") is 0.60, so it doesn't have it. The version currently in Debian Testing ("wheezy") is, so it's available there.

  • 11
    At least in sid, the add-apt-repository script seems to have moved to software-properties-common
    – Adam
    Commented Jun 22, 2014 at 10:26
  • Version 0.92 of python-software-properties here, and (again) missing :-(
    – gatopeich
    Commented Nov 12, 2014 at 11:33
  • 3
    See the comment above yours -- it's now in software-properties-common
    – Jim Paris
    Commented Nov 12, 2014 at 22:20
  • had hassles updating though Commented May 11, 2015 at 12:46

Assuming you're running a non-ancient version of Debian (Etch or later), you can just drop a file in /etc/apt/sources.list.d/ The file name must end with .list; Debian Stretch (not yet released) will likely add .sources with a different format.

The format is the same as the main sources.list file.

The advantage is, especially if this is for some software you're distributing, you don't have to worry merging your changes into a possibly-edited /etc/apt/sources.list file (especially hard to deal with if your program is uninstalled). You can use dpkg conffile support to put the file in /etc/apt/sources.list.d/.

  • sources.list.d exists since etch, I think. Commented Aug 20, 2012 at 22:08
  • 1
    Yeah, but apt-add-repository takes care of things like translating "ppa:" to an http://ppa.launchpad... type, and to download and install the repository key so that packages are not treated as suspicious Commented Jul 27, 2014 at 11:24
  • @Gilles I think you're right—it isn't on a Sarge machine I have, and is on an Etch machine.
    – derobert
    Commented Dec 8, 2015 at 23:29

add-apt-repository can now be found in the software-properties-common package.

  • 1
    @rbaleksandar this is not in all distros because it has a lot of extra things you may not want, especially in docker. Since the end goal of this task is to add something to /etc/apt/sources.list, you might look at @Goez 's answer in this question.
    – Mike D
    Commented Jan 2, 2019 at 14:19

Ubuntu is based on Debian but includes things Debian doesn't (and in turn are often incorporated into Debian later). The add-apt-repository command is an example which was included in Ubuntu first.

The add-apt-repository actually just executes a couple of commands to add the repository:

  • append the repository to /etc/apt/sources.list
  • add the repository key to the machine.

A script that sort of does the same that can be found here is quoted below

if [ $# -eq 1 ]
NM=$(uname -a && date)
NAME=$(echo $NM | md5sum | cut -f1 -d" ")
    ppa_name=$(echo "$1" | cut -d":" -f2 -s)
    if [ -z "$ppa_name" ]
        echo "PPA name not found"
        echo "Utility to add PPA repositories in your debian machine"
        echo "$0 ppa:user/ppa-name"
        echo "$ppa_name"
        echo "deb http://ppa.launchpad.net/$ppa_name/ubuntu lucid main" >> /etc/apt/sources.list
        apt-get update >> /dev/null 2> /tmp/${NAME}_apt_add_key.txt
        key=$(cat /tmp/${NAME}_apt_add_key.txt | cut -d":" -f6 | cut -d" " -f3)
        apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $key
        rm -rf /tmp/${NAME}_apt_add_key.txt
    echo "Utility to add PPA repositories in your debian machine"
    echo "$0 ppa:user/ppa-name"
  • 2
    It's not recommended to use ppa repo in your Debian distro. There's no control about installations making that. Commented Apr 15, 2019 at 14:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .