Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

The Server version of Ubuntu does not have the add-apt-repository command. How can i add a PPA to the server without this command?

share|improve this question
    
in the latest version of synaptic you can add ppa's directly in the software sources instead of a deb line –  Dirk Hartzer Waldeck Aug 2 '11 at 12:39

5 Answers 5

up vote 98 down vote accepted

You can simply add the add-apt-repository command. It's part of the python-software-properties package.

sudo apt-get install python-software-properties

Side note: in 11.04 they added a symlink to add-apt-repository so it can be run as apt-add-repository which totally makes more sense to me. Everything else apt starts with "apt".

Second side note: (Tested on 13.10) As the comments below indicated, this may also be necessary:

sudo apt-get install software-properties-common
share|improve this answer
    
Seeing it's actually a function of apt it is actually logical to me. "add repository with apt" > "apt-add-repository" –  MrChrisDruif Mar 27 '12 at 15:32
3  
what if "python-software-properties" is already installed, and you still get "command not found" when trying to use "apt-add-repository"? –  monkut Jul 23 '12 at 1:08
    
Did you also try "add-apt-respository"? On versions before 11.04 you must put the "add" before the "apt". –  Mark Russell Jul 26 '12 at 21:24
8  
if "python-software-properties" is already installed, and you still get "command not found", try "software-properties-common". –  nategood Jun 2 '13 at 20:14
9  
sudo apt-get install software-properties-common was required for me also; this should be edited into the answer. –  Josh Nov 29 '13 at 19:08

Let me teach you how to fish. apt-file enables you to find out which package provides a given file. dpkg -S does the same thing, but only for installed packages. apt-file works whether or not the package has been installed.

So, first you install apt-file: sudo apt-get install apt-file. You then need to update its information, just as you have to with apt-get: sudo apt-file update. Now it's ready for use:

jo-erlend@jedesktop:~$ 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.gz
jo-erlend@jedesktop:~$

So, in this case the next thing to do would be to install python-software-properties.

share|improve this answer
2  
excellent tip - it perhaps shouldnt be buried in this question - a separate question would be a good idea to highlight this. –  fossfreedom Aug 2 '11 at 11:47
    
@fossfreedom Is this what you're talking about? - askubuntu.com/questions/13792/… –  jrg Aug 2 '11 at 12:46
7  
Due to this tip I discovered that in 12.10 server apt-add-repository is located in software-properties-common (no longer in python-software-properties) –  Damiön la Bagh Mar 10 '13 at 22:08
    
I hate fishing. –  dimadima Oct 22 '13 at 20:25

Not necessarily the best answer, but will function: the old-fashioned way (pre Ubuntu 9.10, they call it) of editing /etc/apt/sources.list still works. You will also need to get the GPG key on the system manually.

See this page: https://launchpad.net/+help/soyuz/ppa-sources-list.html

Copied here because this eventually will disappear.

On older (pre 9.10) Ubuntu systems

Step 1: Visit the PPA's overview page in Launchpad. Look for the heading that reads Adding this PPA to your system and click the Technical details about this PPA link.

Step 2: Use the Display sources.list entries drop-down box to select the version of Ubuntu you're using.

Step 3: You'll see that the text-box directly below reads something like this:

deb http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu jaunty main deb-src http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu jaunty main

Copy those lines.

Step 4: Open a terminal and type:

sudo gedit /etc/apt/sources.list

This will open a text editor containing the list of archives that your system is currently using. Scroll to the bottom of the file and paste the lines you copied in the step above.

Save the file and exit the text editor.

Step 5: Back on the PPA's overview page, look for the Signing key heading. You'll see something like:

1024R/72D340A3 (What is this?)

Copy the portion after the slash but not including the help link; e.g. just 72D340A3.

Step 6: Now you need to add that key to your system so Ubuntu can verify the packages from the PPA. In your terminal, enter:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 72D340A3

(Replace 72D340A3 with whatever you copied in the step 5.)

This will now pull down the PPA's key and add it to your system.

Step 7: Now, as a one-off, you should tell your system to pull down the latest list of software from each archive it knows about, including the PPA you just added:

sudo apt-get update

Now you're ready to start installing software from the PPA!

share|improve this answer
    
If no other quicker and more user friendly answer is given then i will put this one as the correct. It solves the problem in a "special" way ;) –  Luis Alvarado Apr 29 '11 at 15:10
    
While add-apt-repository is easier, in a server install I like to keep things lean, so I don't mind doing it manually. This was the answer I was looking for. –  D. Strout Apr 14 '13 at 18:30
    
This method is way better than installing apt-add-repository and all the crap that comes with the requisite package. –  dimadima Oct 22 '13 at 20:25
    
This has proved to be very useful to me for a Vagrant setup using the shell provisioner. Thanks Broam! –  yanhan Aug 1 at 9:13

add-apt-repository is provided by the package python-software-properties.

Thus if you should install via

sudo apt-get install python-software-properties
share|improve this answer
    
Thanks! I must say that I find a quite illogical name. Also, do you have any idea why I it is not standard installed? –  Peter Smit Aug 2 '11 at 10:41
2  
agreed illogical - as to why, you could speculate that servers are usually 'fixed' in terms of running software. Thus you dont need the 'luxury' of adding and removing repositories frequently ... end-of-speculation! –  fossfreedom Aug 2 '11 at 10:46
    
Why is it illogical? It's a set of python tools to deal with software properties. add-apt-repository is one of those tools. –  Jo-Erlend Schinstad Aug 2 '11 at 13:32
    
I already have python-software-properties installed but I keep getting this error. I tried apt-add and add-apt notations, and none work... what to do? –  Mohamad May 15 '13 at 23:17
    
@Mohamad - I would suggest you ask another question - link back to this Q and give as much details about the error that you see. –  fossfreedom May 16 '13 at 7:22

Run this command:

sudo apt-get install software-properties-common

And then you can add your repository running:

sudo add-apt-repository [REPOSITORY]

Renember to replace [REPOSITORY] with the repository name you want to add.

share|improve this answer

protected by Raja Apr 2 at 17:26

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.