Install and use Flatpak on Ubuntu


The Linux world has three “universal” packaging formats that allow “any” Linux distribution to run; Snap, Flatpak, and AppImage.

Ubuntu comes baked with Snap but most distributions and developers avoid it due to its close source nature. They prefer Fedora Flatpack Packaging System.

As an Ubuntu user, you are not limited to Snap. You can also use Flatpak on your Ubuntu system.

In this tutorial, I will discuss the following:

  • Enable Flatpak support on Ubuntu
  • Use Flatpak commands to manage packages
  • Get packages from Flathub
  • Add Flatpak packages to the Software Center

look sexy? Let’s see them one by one.

Install Flatpak on Ubuntu

You can easily install Flatpak with the following command:

sudo apt install flatpak

to Ubuntu 18.04 or earlieruse the PPA:

sudo add-apt-repository ppa:flatpak/stable
sudo apt update
sudo apt install flatpak

Add FlatHub repo

You have installed Flatpak support in your Ubuntu system. However, if you try to install the Flatpak package, you will get “The remote references were not found error. This is because Flatpak repositories are not added and so Flatpak does not know where it should get the applications from.

Flatpak has a central repository called Flathub. A number of Flatpak apps can be found and downloaded here.

You have to add the Flathub repo to access these apps.

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Install Flatpak in the latest versions of Ubuntu and then add the Flathub repo
Install Flatpak and add the Flathub Repo

Once Flatpak is installed and configured, Reboot your system. Otherwise, your installed Flatpak apps will not appear in your system menu.

However, you can always run flatpak by running:

flatpak run <package-name>

Common Flatpak commands

Now that you have Flatpak package support installed, it’s time to learn about some of the most popular Flatpak commands needed to manage packages.

Find a package

Either use the Flathub site or use the following command, if you know the name of the application:

flatpak search <package-name>
Search for a package using the Flatpak search command
Find a package

🚧

Except for looking for a flatpak, in other cases, it indicates to the appropriate Flatpak package name, eg com.raggesilver.BlackBox (App ID in the screenshot above). You can also use the last word Blackbox from the application identifier.

Install Flatpak

Here is the syntax for installing the Flatpak package:

flatpak install <remote-repo> <package-name>

Since most of the time you will get apps from Flathub it will be the remote repository flathub:

flatpak install flathub <package-name>
Install a package after searching for its name
Install the package

In some rare cases, you can install Flatpak packages from the developer’s repository directly instead of Flatpak. In this case, you can use syntax like this:

flatpak install --from https://flathub.org/repo/appstream/com.spotify.Client.flatpakref

Install a package from flatpackref

This is optional and also rare. But at some point in time, you will get a .flatpakref application file. This is it Not offline installation. .flatpakref contains the necessary details about where to get the packages.

To install from this file, open Terminal and run:

flatpak install <path-to-flatpakref file>
Install the Flatpak package from the Flatpakref file
Install Flatpackref

Launch the Flatpak app from the device

Again, something you wouldn’t do very often. Mostly, you will look for the install app in the system menu and launch the app from there.

However, you can also run it from the terminal with:

flatpak run <package-name>

List installed Flatpak packages

Want to know which Flatpak apps are installed on your system? List them like this:

flatpak list
List all Flatpak packages installed on your system
List installed packages

Uninstall Flatpak

You can remove the installed Flatpak package in the following way:

flatpak uninstall <package-name>

if you want Clear remaining packages and runtimes that are no longer requiredUses:

flatpak uninstall --unused
Remove the Flatpak package and above, if there are any unused runtimes or packages, remove them
Remove the package

It may help you Save some disk space on Ubuntu.

Flatpak Order Summary

Here is a quick summary of the commands you learned above:

use order
Look for packages flatpack search
Install the package install flatpack
List the installed package flatpack list
Install from flatpackref install flatpack
Uninstall the package uninstall flatpack
Uninstall unused runtimes and packages flatpak uninstalled – not used

Use Flathub to explore Flatpak packages

I understand that searching for Flatpak packages through the command line is not the best experience and this is where it is found Flathub website comes in the picture.

You can browse Flatpak on Flatpak, which provides additional details like approved publishers, total number of downloads etc.

You will also get the commands you need to use to install apps at the bottom of the app page.

Bonus: Use Software Center with Flatpak package support

You can add Flatpak packages to the GNOME Software Center application and use it to install packages graphically.

There is a dedicated plugin to add Flatpak to the GNOME Software Center.

🚧

Since Ubuntu 20.04, the default Software Center in Ubuntu is Snap Store and it does not support flatpak integration. Therefore, installing the package below will result in two software cores at once: one is Snap, the other is DEB.

When you install the GNOME Software Flatpak plugin in Ubuntu, the DEB version of the GNOME software is installed.  So you will have two Software Center apps
Two software center in Ubuntu
sudo apt install gnome-software-plugin-flatpak
Install GNOME plugin in Ubuntu
Install the GNOME plugin

Conclusion

I learned a lot of things here. You have learned to enable Flatpak support in Ubuntu and manage Flatpak packages through the command line. You also learned about the integration with the Software Center.

I hope you feel more comfortable with Flatpaks now. Since you discovered one of the three global packages, how about Get to know Appimages?

How to use AppImage in Linux [Complete Guide]

What is AppImage? How does it work? How it works? Here is the complete guide on using AppImage in Linux.

Please let me know if you have questions or if you encounter any issues.



Source link

Leave a Comment

Your email address will not be published. Required fields are marked *