Flatpak on Ubuntu: A Comprehensive Guide to Installation and Usage

1

Flatpak is a modern framework for distributing desktop applications on Linux. It is designed to overcome the challenges posed by the diversity of Linux distributions by providing a consistent and secure app environment. In this article, we’ll explore what Flatpak is, why it’s beneficial, and how you can install and use it on Ubuntu.

What is Flatpak?

Flatpak is a tool for building, distributing, and running Linux applications in a sandboxed environment. It separates applications from the underlying system, ensuring compatibility across distributions and improving security by isolating apps from the host system.

Flatpak Key Features:

  • Cross-Distro Compatibility: Works across various Linux distributions without needing distribution-specific packaging.
  • Sandboxing: Isolates applications, reducing the risk of system corruption or security breaches.
  • Ease of Updates: Allows seamless updates for apps without dependency conflicts.
  • Centralized Repository: Flathub, the central repository for Flatpak apps, provides access to a wide range of applications.

Why Use Flatpak?

Flatpak offers several advantages for both users and developers:

For Users:

  • Access to the latest versions of apps.
  • Improved security through sandboxing.
  • Simplified installation process.

For Developers:

  • Simplified app distribution across multiple Linux distributions.
  • Consistent runtime environments.

How to Install Flatpak on Ubuntu 24.04 LTS

Follow these steps to set up Flatpak on Ubuntu and start using it to manage applications:

Step 1: Update Your System

Before installing Flatpak, ensure your system is up-to-date:

$ sudo apt update && sudo apt upgrade -y

Step 2: Add the Flathub Repository

Flathub is the primary source of Flatpak applications. Add it to your system:

$ sudo add-apt-repository ppa:flatpak/stable

Output will be as shown below :

ramansah@dev02:~$ sudo add-apt-repository ppa:flatpak/stable
Repository: 'Types: deb
URIs: https://ppa.launchpadcontent.net/flatpak/stable/ubuntu/
Suites: noble
Components: main
'
Description:
Latest stable versions of Flatpak.

Support policy
--------------

This PPA is provided as a convenience for Ubuntu users, with no guarantee of support. If you are an Ubuntu developer and would like to volunteer to maintain packages for this PPA, please contact us via <https://github.com/flatpak/ppa-flatpak/issues>.

Packages in this PPA are built for LTS branches of Ubuntu, currently 24.04 'noble', 22.04 'jammy' and 20.04 'focal'. The newest LTS branch is treated as the highest priority for updates.

Packages for Ubuntu 18.04 or older are generally no longer updated. Branches that have reached EOL for non-subscription-based updates are likely to stop receiving updates, or be removed from this PPA, when backports to those branches become too difficult.

Non-LTS branches such as groovy and hirsute are not currently supported by this PPA. If you are an Ubuntu developer and would like to volunteer to maintain packages for this PPA, please contact us via <https://github.com/flatpak/ppa-flatpak/issues>.

Source code for the packages used here
--------------------------------------

* https://github.com/flatpak/ppa-flatpak
* https://github.com/flatpak/ppa-flatpak-builder
* https://github.com/flatpak/ppa-xdg-desktop-portal
* https://github.com/flatpak/ppa-xdg-desktop-portal-gtk

These packages are built from the ppa/stable/noble, ppa/stable/jammy, ppa/stable/focal branches.

Development versions of these packages
--------------------------------------

https://launchpad.net/~flatpak/+archive/ubuntu/development provides newer prereleases of Flatpak from its development branch.
More info: https://launchpad.net/~flatpak/+archive/ubuntu/stable
Adding repository.
Press [ENTER] to continue or Ctrl-c to cancel.
Hit:1 http://id.archive.ubuntu.com/ubuntu noble InRelease
Hit:2 http://id.archive.ubuntu.com/ubuntu noble-updates InRelease 
Hit:3 http://id.archive.ubuntu.com/ubuntu noble-backports InRelease 
Hit:4 http://security.ubuntu.com/ubuntu noble-security InRelease 
Hit:5 https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 InRelease 
Hit:6 https://ppa.launchpadcontent.net/ansible/ansible/ubuntu noble InRelease 
Get:7 https://ppa.launchpadcontent.net/flatpak/stable/ubuntu noble InRelease [17.8 kB]
Hit:8 https://software.virtualmin.com/vm/7/gpl/apt virtualmin InRelease 
Get:9 https://ppa.launchpadcontent.net/flatpak/stable/ubuntu noble/main amd64 Packages [2,536 B]
Get:10 https://ppa.launchpadcontent.net/flatpak/stable/ubuntu noble/main Translation-en [1,572 B]
Fetched 21.9 kB in 2s (8,784 B/s)
Reading package lists... Done

Step 3: Install Flatpak

Flatpak is available in Ubuntu’s official repositories. Install it using the following command:

$ sudo apt update
$ sudo apt install flatpak

Output will be as shown below :

ramansah@dev02:~$ sudo apt install flatpak
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
bubblewrap
Suggested packages:
malcontent-gui
The following packages will be upgraded:
bubblewrap flatpak
2 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
Need to get 1,405 kB of archives.
After this operation, 5,120 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 https://ppa.launchpadcontent.net/flatpak/stable/ubuntu noble/main amd64 bubblewrap amd64 0.10.0-1~flatpak1~24.04.1 [50.3 kB]
Get:2 https://ppa.launchpadcontent.net/flatpak/stable/ubuntu noble/main amd64 flatpak amd64 1.14.10-1~flatpak1~24.04.1 [1,355 kB]
Fetched 1,405 kB in 3s (435 kB/s) 
[master a9deb79] saving uncommitted changes in /etc prior to apt run
Author: ramansah <ramansah@dev02.bckinfo.com>
5 files changed, 38 insertions(+), 5 deletions(-)
create mode 100644 apt/sources.list.d/flatpak-ubuntu-stable-noble.sources
(Reading database ... 303539 files and directories currently installed.)
Preparing to unpack .../bubblewrap_0.10.0-1~flatpak1~24.04.1_amd64.deb ...
Unpacking bubblewrap (0.10.0-1~flatpak1~24.04.1) over (0.9.0-1ubuntu0.1) ...
Preparing to unpack .../flatpak_1.14.10-1~flatpak1~24.04.1_amd64.deb ...
Unpacking flatpak (1.14.10-1~flatpak1~24.04.1) over (1.14.6-1ubuntu0.1) ...
Setting up bubblewrap (0.10.0-1~flatpak1~24.04.1) ...
Setting up flatpak (1.14.10-1~flatpak1~24.04.1) ...
Installing new version of config file /etc/X11/Xsession.d/20flatpak ...
Installing new version of config file /etc/profile.d/flatpak.sh ...
Processing triggers for dbus (1.14.10-4ubuntu4.1) ...
Processing triggers for man-db (2.12.0-4build2) ...
[master 807ff08] committing changes in /etc made by "apt install flatpak"
Author: ramansah <ramansah@dev02.bckinfo.com>
2 files changed, 4 insertions(+)

Step 4: Restart Your System

To ensure that Flatpak integrates correctly with your system, restart your machine:

$ sudo reboot

How to Use Flatpak On Ubuntu 24.04

1. Searching for Applications

To search for an application, use the following command:

$ flatpak search <app_name>

2. Installing Applications

Install an application from Flathub using its name:

$ flatpak install flathub <app_name>

3. Running Applications

Launch a Flatpak application using:

$ flatpak run <app_name>

4. Updating Applications

Update all Flatpak applications with:

$ flatpak update

5. Removing Applications

Uninstall an application using:

$ flatpak uninstall <app_name>

6. Example: Installing VLC Media Player

Let’s use Flatpak to install VLC, a popular media player:

$ flatpak install flathub org.videolan.VLC

6.1 Run VLC with:

$ flatpak run org.videolan.VLC

6.2 Managing Permissions with Flatpak

Flatpak applications are sandboxed, but you can manage their permissions using the flatpak override command. For example:

$ flatpak override --user org.videolan.VLC --filesystem=~/Videos

Alternatively, you can use tools like Flatseal, a GUI application for managing Flatpak permissions:

$ flatpak install flathub com.github.tchx84.Flatseal
$ flatpak run com.github.tchx84.Flatseal

Conclusion

Flatpak is an excellent tool for running modern Linux applications in a consistent and secure environment. By following this guide, you can easily install and start using Flatpak on Ubuntu. Whether you are a casual user or a developer, Flatpak simplifies the Linux app ecosystem significantly.

For more information, visit the official Flatpak website or explore the Flathub repository.

(Visited 117 times, 1 visits today)

You may also like