I've written other articles that use Flatpak and even cover the installation of Flatpak. In this article, I plan to cover Flatpak in more detail.
Flatpak is a way to install programs on almost all distributions of Linux from a central repository that is compatible with most forms of Linux.
The Flatpak creators say that Flatpak is compatible with 38 different distributions:
Flatpak Installation
Before installing, we can see if Flatpak already exists on your flavor of Linux. Use the following to see:
I am testing this only on two systems right now. One system is Ubuntu 22.04, and the other is Fedora Workstation 39. Fedora already has Flatpak, but Ubuntu does not.
Installation is easy. Just use the installation command for your OS and install 'flatpak'. For Ubuntu, it would be:
Currently, in Ubuntu, this installs version '1.12.7'. We can use the PPA to install a newer version. For Ubuntu, install 'software-properties-common', then add the repository:
Now, you can install 'flatpak' again and my version is now '1.14.6'. Any repositories already installed will remain intact.
Once you have the package installed, you can use the command and parameter, '--version', to test it.
Enabling Flatpak
For systems that do not already have Flatpak installed, it is usually not enabled after you install it. You can reboot, or start the service:
To check the status of the service:
So, the service is running, but we need to add a 'repository' so it has a place to get files. For Flatpak, it is not named a 'repository', but called a 'remote'.
Adding a Remote
To show that there are no remotes added yet, you can run the command:
For some systems that have Flatpak is already installed, there most likely is a remote already present. For example, on Fedora, there is a 'fedora' remote, as shown in Figure 1.
FIGURE 1
On other systems, Flatpak had to be installed, so we need to add a remote. The 'default' is to use the 'flathub' remote that is maintained by the Flatpak creators.
Once you have Flatpak installed on your system, the Flatpak commands will be the same on all distributions.
So, add the remote with:
The remote is called 'flathub' and is at 'https://flathub.org/repo/flathub.flatpakrepo'. If you list the remotes now, see that 'flathub' was added. For systems that already had Flatpak installed and other remotes, there should be 'flathub' as well, as shown in Figure 2.
FIGURE 2
Listing Content of Remotes and Installation
You can list the content of the remotes with:
We can use 'grep' to search for specific items such as in Figure 3 I searched for 'tux'. The last column shows which 'remote' the program is in. Let's say we want to install 'Super Tux Party'. You can see the line in Figure 4.
FIGURE 3
FIGURE 4
Once you have found an application you want to install, you can install it by using the remote and the location, for example 'Super Tux Party' on 'flathub':
Once it installs, see information similar to that in Figure 5.
FIGURE 5
Once installation packages are copied and setup, you can list all the packages with the command:
The file listing will include all dependencies and program files installed by flatpak, as shown in Figure 6.
FIGURE 6
Removing Packages
If you install a package and then no longer want it, you can remove it. For example, in Figure 6 you can see that I installed 'Surge Engine' from 'org.opensurge2d.OpenSurge', it is a knockoff of the Sonic game. Now, I want to remove it.
The command is the same one to install the package. Just change the word 'install' to 'uninstall'.
NOTE: If the package name has capitalized letters, be sure to use them. The names are case-sensitive.
Updating Packages
Sometimes you can check if any of the packages have been updated by performing an update on all downloaded packages, if they have updates:
Like the regular repository list in Linux, the list can be corrupted and may need repaired. You can fix the list with the command:
Permissions
From within Flatpak, you can manage permissions for the packages you download. Install 'flatseal'.
Notice I did not specify a remote to install from. On Fedora, it will ask you if you want to install it from the Fedora or Flathub remote, since it exists in both.
Once the installation is complete, we can open 'Flatseal' from the menu, or run it from the command-line:
You can run any package from Flatpak with the command, just specify the proper package name. The names can be found from the command 'flatpak list'.
From within Flatseal, you can specify the permissions of each Flatpak package that is on the system. You can enable/disable such as:
If something causes a problem with an app, there is a 'Reset' button at the top of the window, see Figure 7. Resetting any changes back to the original configuration will fix any problems.
FIGURE 7
Removing Flatpak and Apps
If you simply uninstall Flatpak, the apps that were installed using Flatpak will still be on your system. So, you need to remove the Flatpak apps and then uninstall Flatpak to remove everything.
With Flatpak, you have the main program, installed apps, libraries, app cache and app data to remove or you simply lose space.
If we want to remove as much as possible from the command line, we can:
The command will list all installed Flatpak apps and libraries, so you can select whether to uninstall everything listed. After it removes the apps, it will go through each item listed and ask if you want the data removed. If you remove all these items, it will remove the folder '~/.var/apps'. It keeps the following folders:
Conclusion
Flatpak is an easy way to install apps on your distro that are not distro dependent.
Try Flatpak to see what apps are available.
Flatpak is a way to install programs on almost all distributions of Linux from a central repository that is compatible with most forms of Linux.
The Flatpak creators say that Flatpak is compatible with 38 different distributions:
- AlmaLinux
- Alpine
- Arch
- Ataraxia Linux
- CentOS
- Chrome OS
- Clear Linux
- Crystal Linux
- Debian
- Deepin
- Elementary OS
- EndeavourOS
- Endless
- EuroLinux
- Fedora
- Gentoo
- GNU Guix
- KDE Neon
- Kubuntu
- Linux Mint
- Mageia
- Manjaro
- MX Linux
- Nix OS
- OpenMandriva
- OpenSUSE
- Pardus
- Pisi GNU Linux
- Pop!OS
- Pure OS
- Raspberry Pi OS
- Red Hat
- Rocky Linux
- Solus
- Turkman Linux
- Ubuntu
- Void Linux
- Zorin OS
Flatpak Installation
Before installing, we can see if Flatpak already exists on your flavor of Linux. Use the following to see:
Code:
flatpak --version
I am testing this only on two systems right now. One system is Ubuntu 22.04, and the other is Fedora Workstation 39. Fedora already has Flatpak, but Ubuntu does not.
Installation is easy. Just use the installation command for your OS and install 'flatpak'. For Ubuntu, it would be:
Code:
sudo apt install flatpak
Currently, in Ubuntu, this installs version '1.12.7'. We can use the PPA to install a newer version. For Ubuntu, install 'software-properties-common', then add the repository:
Code:
sudo add-apt-repository ppa:flatpak/stable -y
Now, you can install 'flatpak' again and my version is now '1.14.6'. Any repositories already installed will remain intact.
Once you have the package installed, you can use the command and parameter, '--version', to test it.
Enabling Flatpak
For systems that do not already have Flatpak installed, it is usually not enabled after you install it. You can reboot, or start the service:
Code:
sudo systemctl start flatpak-system-helper
To check the status of the service:
Code:
sudo systemctl status flatpak-system-helper
So, the service is running, but we need to add a 'repository' so it has a place to get files. For Flatpak, it is not named a 'repository', but called a 'remote'.
Adding a Remote
To show that there are no remotes added yet, you can run the command:
Code:
flatpak remotes
For some systems that have Flatpak is already installed, there most likely is a remote already present. For example, on Fedora, there is a 'fedora' remote, as shown in Figure 1.
FIGURE 1
On other systems, Flatpak had to be installed, so we need to add a remote. The 'default' is to use the 'flathub' remote that is maintained by the Flatpak creators.
Once you have Flatpak installed on your system, the Flatpak commands will be the same on all distributions.
So, add the remote with:
Code:
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
The remote is called 'flathub' and is at 'https://flathub.org/repo/flathub.flatpakrepo'. If you list the remotes now, see that 'flathub' was added. For systems that already had Flatpak installed and other remotes, there should be 'flathub' as well, as shown in Figure 2.
FIGURE 2
Listing Content of Remotes and Installation
You can list the content of the remotes with:
Code:
flatpak remote-ls
We can use 'grep' to search for specific items such as in Figure 3 I searched for 'tux'. The last column shows which 'remote' the program is in. Let's say we want to install 'Super Tux Party'. You can see the line in Figure 4.
FIGURE 3
FIGURE 4
Once you have found an application you want to install, you can install it by using the remote and the location, for example 'Super Tux Party' on 'flathub':
Code:
flatpak install flathub party.supertux.supertuxparty
Once it installs, see information similar to that in Figure 5.
FIGURE 5
Once installation packages are copied and setup, you can list all the packages with the command:
Code:
flatpak list
The file listing will include all dependencies and program files installed by flatpak, as shown in Figure 6.
FIGURE 6
Removing Packages
If you install a package and then no longer want it, you can remove it. For example, in Figure 6 you can see that I installed 'Surge Engine' from 'org.opensurge2d.OpenSurge', it is a knockoff of the Sonic game. Now, I want to remove it.
Code:
flatpak uninstall flathub org.opensurge2d.OpenSurge
The command is the same one to install the package. Just change the word 'install' to 'uninstall'.
NOTE: If the package name has capitalized letters, be sure to use them. The names are case-sensitive.
Updating Packages
Sometimes you can check if any of the packages have been updated by performing an update on all downloaded packages, if they have updates:
Code:
flatpak update
Like the regular repository list in Linux, the list can be corrupted and may need repaired. You can fix the list with the command:
Code:
flatpak repair
Permissions
From within Flatpak, you can manage permissions for the packages you download. Install 'flatseal'.
Code:
flatpak install flatseal
Notice I did not specify a remote to install from. On Fedora, it will ask you if you want to install it from the Fedora or Flathub remote, since it exists in both.
Once the installation is complete, we can open 'Flatseal' from the menu, or run it from the command-line:
Code:
flatpak run com.github.tchx84.Flatseal
You can run any package from Flatpak with the command, just specify the proper package name. The names can be found from the command 'flatpak list'.
From within Flatseal, you can specify the permissions of each Flatpak package that is on the system. You can enable/disable such as:
- network
- bluetooth
- GPU Acceleration
- Sound
- Printing
- Shared Memory
- Virtualization
- and more
If something causes a problem with an app, there is a 'Reset' button at the top of the window, see Figure 7. Resetting any changes back to the original configuration will fix any problems.
FIGURE 7
Removing Flatpak and Apps
If you simply uninstall Flatpak, the apps that were installed using Flatpak will still be on your system. So, you need to remove the Flatpak apps and then uninstall Flatpak to remove everything.
With Flatpak, you have the main program, installed apps, libraries, app cache and app data to remove or you simply lose space.
If we want to remove as much as possible from the command line, we can:
Code:
flatpak uninstall --all --delete-data
The command will list all installed Flatpak apps and libraries, so you can select whether to uninstall everything listed. After it removes the apps, it will go through each item listed and ask if you want the data removed. If you remove all these items, it will remove the folder '~/.var/apps'. It keeps the following folders:
- ~/.local/share/flatpak
- /var/lib/flatpak
Conclusion
Flatpak is an easy way to install apps on your distro that are not distro dependent.
Try Flatpak to see what apps are available.