How can I add a PPA with only Ubuntu releases to a Debian machine?

5,236

It is highly recommended that you do not add third party repos

However, if you understand the risks and are familiar with apt-pinning, you can add and manage 3rd party repositories. I do not recommend you do this to your Debian install and instead install the package from the official stable or back-ports repository. If not there installing the package from source is another viable method.

Again, if you require this package and it is not found in the repos and you want to maintain it using apt, as long as you understand the risks you can follow these steps.

Issue at hand

You are attempting to add the ppa:nextcloud-devs/client repository using the add-apt-repository command. You are unable to get apt-get update to work with the new repo as it uses Ubuntu version names and your sources.list being Debian uses Debian version names.

Solution

I am referencing this guide on how to add an Ubuntu ppa to your Debian system.

You will run the following command as sudo (or root):

add-apt-repository ppa:nextcloud-devs/client

Now you want to check your /sources.list.d/. For example if you are adding Launchpad to your wheezy /sources.list.d/, it should look like this:

deb http://ppa.launchpad.net/webupd8team/java/ubuntu wheezy main 
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu wheezy main

Now change wheezy to the Ubuntu version you want to use. For example, xenial or 16.04.

deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main 
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main

Now you should user apt-pinning to make sure that your system maintains some sanity. I highly recommend that you make your stable repos have a higher priority than your ppa. Your /etc/apt/preferences.d/ should have a reponame.preferences for each repo and the contents of each should be like this:

#/etc/apt/preferences.d/stable.preferences
Package: *
Pin: release a=stable
Pin-Priority: 1000

#/etc/apt/preferences.d/your-ppa-name.preferences
Package: *
Pin: release a=your-ppa-name
Pin-Priority: 750

Now you can run apt update and the ppa should be successfully installed.

Conclusion

I recommend against doing this and would suggest that you use a distro that supports the package you wish to install and avoid using third party repos. However if you know what you are doing this should work.

If you have any questions or concerns about this post, do not hesitate to ask me. If there are any corrections or misconceptions in this answer please inform me. I can update the post as necessary.

Best of Luck!

Share:
5,236

Related videos on Youtube

lofidevops
Author by

lofidevops

Updated on September 18, 2022

Comments

  • lofidevops
    lofidevops over 1 year

    I know (thanks Jim Paris) that I can use add-apt-repository on Debian by first:

    sudo apt-get install software-properties-common
    

    However, I still can't simply run (for example):

    sudo add-apt-repository ppa:nextcloud-devs/client
    sudo apt-get update
    

    ...because the distro folder for that PPA only lists Ubuntu releases (artful, bionic...) not Debian releases (jessie, stretch...). So apt fails to find packages for my release.

    I can solve this manually (decide the most appropriate Ubuntu rleease, download the repo keys, modify /etc/apt-get/sources.list), but I'd prefer to do it from the command line.

    Can I pass a command-line parameter, or otherwise convince add-apt-repository to pick an Ubuntu release? Something like:

    sudo add-apt-repository --force-distro=artful ppa:nextcloud-devs/client
    
    • GAD3R
      GAD3R almost 6 years
      use snap to install the nextcloud-client : snap install nextcloud-client.
  • OrangeDog
    OrangeDog about 5 years
    You can also do this: wiki.debian.org/CreatePackageFromPPA