I have Elementary OS 5.1 Hera, and I would like to use PPAs. That way, I can install some more software not in the default repositories. How can I do this?
3 Answers
Elementary, like Debian and some other Debian derivatives, doesn't support PPAs out of the box. In order to use them, you'll have to install software-properties-common
.
Open your terminal with CTRL + ALT + T and simply enter the following:
sudo apt install software-properties-common
Once you've done that, you can add PPAs in the normal way. For example, this is a LibreOffice PPA:
sudo add-apt-repository ppa:libreoffice/ppa
Where possible, it's recommended to not use PPAs at all. Adding a PPA is essentially giving the owner of the PPA root (administrator) level access to your system. It is possible for them to maliciously or accidentially replace system packages with broken/unpatched/malicious versions.
PPAs by trusted vendors are probably fine (Ubuntu, Libreoffice, etc), however, always be aware they run the risk of breaking your system if they are misconfigured.
If the software you want is available from flathub.org, then I would recommend getting it from there instead as Flatpak is a much more safe and secure packaging format.
As an alternative to using add-apt-repository
from the package software-properties-common
, you can manually add the PPA as a repository, with the full understanding that adding extra repositories means you might have to manually manage them.
First, open up the PPA's page (this page, for example), and open up the "technical details about this PPA" drawer. Select the Ubuntu version that your elementary OS version is based on: for 7.x, this is Ubuntu 22.04. Then you should see something like this:
This PPA can be added to your system manually by copying the lines below and adding them to your system's software sources. Display sources.list entries for: [Jammy (22.04)]
deb https://ppa.launchpadcontent.net/ubuntuhandbook1/emacs/ubuntu jammy main deb-src https://ppa.launchpadcontent.net/ubuntuhandbook1/emacs/ubuntu jammy main
Next, add a file in /etc/apt/sources.list.d/
. In my case, I'll call it /etc/apt/sources.list.d/emacs.list
. Then paste the sources.list entries that the PPA page told you into this file.
Then, download the key for the PPA and put it into /etc/apt/trusted.gpg.d/
. (There is a deprecated way of using apt-key but that's, well, deprecated.) This, unfortunately, seems to involve a dance to import the key by its fingerprint into a keyring, exporting it into a file, then cleaning up, because GPG does not appear to have a way to retrieve a key from a keyserver directly into a file.
Find the fingerprint of the PPA's signing key, which is written in the same Technical details section on the PPA's page.
Import the key into your keyring. (You can import it into a temporary one as well; for those options see the page I linked above about this dance.) Continuing my example above:
gpg --keyserver keyserver.ubuntu.com --recv F4E48910A020E77056748B745738AE8480447DDF
Export it back out, this time as a file.
--armor
makes gpg export it in plain text format. apt wants plain text keys to end in.asc
, and binary keys to end in.gpg
. elementary's own keys use plain text, so I'll follow them.gpg --armor --export F4E48910A020E77056748B745738AE8480447DDF > mykey.asc sudo mv mykey.asc /etc/apt/trusted.gpg.d/emacs.key.asc
The repository should be fully added at this point. If you want to remove the key from your user's GPG keyring, you can freely do so (perhaps with Seahorse or with gpg --delete-keys <fingerprint>
).
Finally, run apt update
and the PPA should now be available with no deprecation warnings.