Manually Add an APT Repository

Linux0 views

Sometimes you can’t use the add-apt-repository command from software-properties-common. In those cases, here’s how to manually add an APT repository without using add-apt-repository. As an example, we’ll add the LibreOffice PPA from Launchpad: https://launchpad.net/~libreoffice/+archive/ubuntu/ppa. On the PPA page, look at “Technical details about this PPA”. You will find something like this:

Display sources.list entries for [Noble (24.04)]:
deb https://ppa.launchpadcontent.net/libreoffice/ppa/ubuntu noble main
deb-src https://ppa.launchpadcontent.net/libreoffice/ppa/ubuntu noble main

Signing key:
4096R/CDDE43BA4DE3F09D7CE7016673AEE920AD55F5A0

Fingerprint:
CDDE43BA4DE3F09D7CE7016673AEE920AD55F5A0

Add the repository source

We need to add a source list file under /etc/apt/sources.list.d/. The file name can be anything, for example: /etc/apt/sources.list.d/libreoffice-ppa.list.

sudo nano /etc/apt/sources.list.d/libreoffice-ppa.list

Then copy and paste the list content:

deb https://ppa.launchpadcontent.net/libreoffice/ppa/ubuntu noble main
deb-src https://ppa.launchpadcontent.net/libreoffice/ppa/ubuntu noble main

.list is the legacy format. We’ll use the newer .sources format later.

Add the signing key

First, create the keyrings directory if it doesn’t exist:

sudo mkdir -p /etc/apt/keyrings

Fetch the signing key from the Ubuntu keyserver:

gpg --keyserver keyserver.ubuntu.com 
    --recv-keys CDDE43BA4DE3F09D7CE7016673AEE920AD55F5A0

Export the key into the APT keyrings directory:

gpg --export CDDE43BA4DE3F09D7CE7016673AEE920AD55F5A0 
 | sudo tee /etc/apt/keyrings/libreoffice-ppa.gpg > /dev/null

CDDE43BA4DE3F09D7CE7016673AEE920AD55F5A0 is part of signing key or fingerprint from PPA details

Bind the signing key to the repository

Edit /etc/apt/sources.list.d/libreoffice-ppa.list and add:

deb [signed-by=/etc/apt/keyrings/libreoffice-ppa.gpg] https://ppa.launchpadcontent.net/libreoffice/ppa/ubuntu noble main
deb-src [signed-by=/etc/apt/keyrings/libreoffice-ppa.gpg] https://ppa.launchpadcontent.net/libreoffice/ppa/ubuntu noble main

This ensures the repository is verified using the correct signing key.

Using the modern .sources format

Newer APT versions (Ubuntu 20.04+) support a structured format using .sources files. Create this file: /etc/apt/sources.list.d/libreoffice-ppa.sources with the following content:

Types: deb deb-src
URIs: https://ppa.launchpadcontent.net/libreoffice/ppa/ubuntu
Suites: noble
Components: main
Signed-By: /etc/apt/keyrings/libreoffice-ppa.gpg

The .sources format is cleaner, more structured, and recommended for new configurations.

Update package list

Finally, update APT:

sudo apt update

Done. The LibreOffice PPA is now added manually without using add-apt-repository command.