How to Add / Remove Flatpak Source Repositories in Linux

Today many Linux applications publish their packages via universal Flatpak. It makes possible to try out great new apps on even old system (e.g., Ubuntu 18.04 and Ubuntu 16.04) without worrying about dependency issue. Though, it needs separated run-time libraries, e.g., GNOME 41 platform, that takes hundreds MB more disk spaces.

About Flatpak Repositories:

I have some apps in my Ubuntu installed as Flatpak. They are usually from Flathub, the de facto standard for getting apps as Flatpak.

However, there are other repositories (e.g., Flathub-beta, KDE apps and Gnome-nightly) contains beta apps such as GIMP 2.99.x for testing purpose. And, Elementary OS has some Flatpak apps in its own repository.

Add Flatpak Repositories:

The Flatpak setup guide tells how to install the daemon as well as add the flathub repository in Ubuntu, Debian, Fedora, Arch and other Linux.

1. Manually add the Flatpak repository:

Usually, you may open terminal and run this command to add a repository:

flatpak remote-add <options> <repo_name> <repo_url>

Frequently used options include:

  • --user, add repository for single user only.
  • --system, add for system wide. It’s default option, so you may skip it
  • --if-not-exists, do nothing if the repository exist.

For example, add Flathub repository system wide using command:

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

And, add the Gnome nightly repository for single user only via command:

flatpak remote-add --user --if-not-exists gnome-nightly https://nightly.gnome.org/repo/

2. Add Flatpak repository automatically

Software developer usually provide an install link button to the Flatpak package. By copying the link address, you may run command to install it:

flatpak install Url-To-Flatpak

The command will try to look for matches, and prompt to add the remote repository that contains the package.

For example, use the command in picture to install an Elementary OS app will ask if to add the remote repository:

By typing “y” will confirm adding that repository, though you may answer “n” to refuse.

Remove Flatpak repositories:

To free up system disk space, I regularly run flatpak uninstall --unused command to remove useless run-time libraries. Also, I prefer to use Flathub only and remove other repositories to keep system clean up.

1. List all installed remote repositories:

Firstly, you may open terminal and run this command to tell all installed Flatpak repositories in your system:

flatpak remotes

Or, use flatpak remote-list command to do the same trick. It lists all repository names as well as function for “system” wide or “user” only options.

[email protected]:~$ flatpak remote-list
Name          Options
AppCenter     system
flathub       system
flathub-beta  user
gnome-nightly user

2. Remove a Flatpak repository:

To remove a system wide repository, simple use flatpak remote-delete command follow with the repository name. For example, remove “AppCenter” shown in previous command output, use command:

flatpak remote-delete AppCenter

A dialog will pop up asks for user password authentication. Once you typed the correct password, it removes that repository.

To remove a user only repository such as “gnome-nightly”, use command:

flatpak remote-delete --user gnome-nightly

It will delete that repository immediately without authentication. After removing unwanted repositories, you may re-run flatpak remote-list command to verify.

That’s all. Enjoy!

Merilyn Ne
Hi, I'm Merilyn Ne, a computer geek working on Ubuntu Linux for many years and would like to write useful tips for beginners. Forgive me for language mistakes. I'm not a native speaker of English.