Adding repositories to sources.list.d manually

tallesl profile image Talles L ใƒป2 min read

It's pretty common to find instructions for adding an deb repository source as a shell script. They normally append stuff to /etc/apt/sources.list, while I prefer creating a separate file for each repo on /etc/apt/sources.list.d.

Here's how I do:

1. Create a /etc/apt/sources.list.d/{repo name}.list file with its content being the repository source (some at the end of this post):

sudo vim /etc/apt/sources.list.d/{repo name}.list

2. Download the repo GPG key (as text):

curl {gpg key url} > {repo name}

3. Convert it to a .gpg (binary):

gpg --dearmor {repo name}

4. Delete the original file and move the .gpg one to /etc/apt/trusted.gpg.d/:

rm {repo name} && sudo mv {repo name}.gpg /etc/apt/trusted.gpg.d/

Now you can sudo apt update and sudo apt install {your package}.

Here's some of my repos (Ubuntu 20.04):

Posted on by:

tallesl profile

Talles L


A Brazilian software developer ๐Ÿ‡ง๐Ÿ‡ท that loves to play video-games ๐ŸŽฎ, tries it best to be active on GitHub ๐Ÿ’ป, and sometimes writes here on DEV ๐Ÿ“„.


markdown guide