Title: Export Flatpak programs from a computer to another | |
Author: Solène | |
Date: 01 January 2023 | |
Tags: linux flatpak bandwidth | |
Description: In this article, you will learn how to use Flatpak to | |
export an installed program to another Linux system. | |
# Introduction | |
As a flatpak user, but also someone with a slow internet connection, I | |
was looking for a way to export a flatpak program to install it on | |
another computer. It turns out flatpak supports this, but it's called | |
"create-usb" for some reasons. | |
So today, I'll show how to export a flatpak program from a computer to | |
another. | |
Flatpak official website | |
Flatpak documentation about usb drives | |
# Pre-requisites | |
For some reasons, the default flathub parameters doesn't associate it a | |
"Collection ID", which is required for the create-usb feature to work, | |
so we need to associate a "Collection ID" to the flathub remote | |
repository on both systems. | |
We can use the example from the official documentation: | |
``` | |
flatpak remote-modify --collection-id=org.flathub.Stable flathub | |
``` | |
# Export | |
The export process is simple, create a directory in which you want the | |
flatpak application to be exported, we will use `~/export/` in the | |
examples, with the program `org.mozilla.firefox`. | |
``` | |
flatpak create-usb ~/export/ org.mozilla.firefox | |
``` | |
The export process will display a few lines and tell you when it | |
finished. | |
If you export multiple programs into the same directory, the export | |
process will be smart and skip already existing components. | |
# Import | |
Take the `~/export/` directory, either on a USB drive, or copy it using | |
rsync, share it over NFS/Samba etc... It's up to you. In the example, | |
`~/export/` refers to the same directory transferred from the previous | |
step onto the new system. | |
Now, we can run the import command to install the program. | |
``` | |
flatpak install --sideload=~/export/.ostree/repo/ flathub org.mozilla.firefox | |
``` | |
If it's working correctly, it should be very fast. | |
# Limitation | |
Because the flatpak components/dependencies of a program can differ | |
depending on the host (for example if you have an NVIDIA card, it will | |
pull some NVIDIA dependencies), so if you export a program from a | |
non-NVIDIA system to the other, it won't be complete to work reliably | |
on the new system, but the missing parts can be downloaded on the | |
Internet, it's still reducing the bandwidth requirement. | |
# Conclusion | |
I kinda like Flatpak, it's convenient and reliable, and allow handling | |
installed programs without privileges escalation. The programs can be | |
big, it's cool to be able to save/export them for later use. |