Flatpak — Universal Package Management for Linux Applications¶
Flatpak is a universal package management system designed to distribute Linux desktop applications across different Linux distributions. It packages applications with their required runtimes, runs them in isolated sandboxes, and enables developers to distribute software independently of the underlying operating system. Flatpak is widely used on desktop Linux systems and is an excellent alternative to Snap for cross-distribution software deployment.
Learning Path¶
Course Progress
What You'll Learn¶
After completing this lesson, you'll be able to:
- Understand Flatpak
- Install Flatpak
- Configure Flatpak repositories
- Install applications
- Update and remove applications
- Understand Flatpak runtimes
- Compare Flatpak with Snap
- Apply Flatpak in real-world environments
Prerequisites¶
Complete:
- Module 1 – Linux Fundamentals
- Module 2 – Linux Command Line Essentials
- Module 3 – Text Processing
- Module 4 – File Management and Permissions
- Module 5 – Users and Groups
- Module 6 – Process Management
- Module 7 Lessons 1–5
Why Learn Flatpak?¶
Imagine you want to install:
- Visual Studio Code
- Discord
- Spotify
- LibreOffice
- OBS Studio
- GIMP
Different Linux distributions have different package managers.
Wouldn't it be useful if one package worked on all of them?
That's exactly what Flatpak provides.
What is Flatpak?¶
Flatpak is a universal package management system that enables applications to run consistently across multiple Linux distributions.
Each Flatpak application includes:
- Application binaries
- Required libraries
- Metadata
- Permissions
- Runtime information
Applications execute inside isolated sandboxes.
How Flatpak Works¶
Flatpak Repository
│
▼
Download Application
│
▼
Install Runtime
│
▼
Install Application
│
▼
Run Inside Sandbox
What is a Runtime?¶
Unlike Snap,
Flatpak separates:
A runtime is a shared collection of libraries used by multiple Flatpak applications.
Benefits:
- Reduced disk usage
- Faster downloads
- Shared dependencies
- Easier updates
Install Flatpak¶
Ubuntu/Debian:
RHEL/Rocky/AlmaLinux:
Fedora:
Add the Flathub Repository¶
Flathub is the most popular Flatpak application repository.
View Configured Repositories¶
Example:
Search for Applications¶
Search for VLC.
Example:
Install an Application¶
Install VLC.
Install GIMP.
Install LibreOffice.
Run an Application¶
List Installed Applications¶
Example:
Update Applications¶
Update all installed Flatpak applications.
Update a specific application.
Remove an Application¶
Remove Unused Runtimes¶
This removes runtimes that are no longer required.
View Application Information¶
Displays:
- Version
- Runtime
- Installation location
- Permissions
List Installed Runtimes¶
View Permissions¶
Display application permissions.
Override Permissions¶
Grant access to the Downloads directory.
Common Commands¶
Search applications.
Install application.
Run application.
Update applications.
Remove application.
Real Production Examples¶
Install Visual Studio Code.
Install OBS Studio.
Install Discord.
Install GIMP.
Production Perspective¶
Flatpak is commonly used for:
- Linux desktop systems
- Developer workstations
- Cross-distribution software deployment
- GUI applications
- Open-source desktop software
- Educational environments
Traditional package managers remain the preferred choice for core operating system packages and server software.
Hands-on Lab¶
Task 1¶
Install Flatpak.
Task 2¶
Add the Flathub repository.
Task 3¶
Verify configured repositories.
Task 4¶
Search for VLC.
Task 5¶
Install VLC.
Task 6¶
List installed applications.
Task 7¶
Update installed applications.
Task 8¶
Remove VLC.
Command Deep Dive¶
| Command | Purpose | Production Example |
|---|---|---|
flatpak search | Search applications | Software discovery |
flatpak install | Install application | Deployment |
flatpak run | Launch application | Daily usage |
flatpak update | Update applications | Maintenance |
flatpak uninstall | Remove application | Cleanup |
flatpak list | List installed applications | Inventory |
flatpak remotes | List repositories | Repository management |
flatpak info | Display application details | Verification |
Flatpak vs Snap¶
| Feature | Flatpak | Snap |
|---|---|---|
| Universal Package Format | ✅ | ✅ |
| Sandboxed Applications | ✅ | ✅ |
| Automatic Updates | Manual (flatpak update) by default | Automatic by default |
| Shared Runtimes | ✅ | ❌ (bundled dependencies) |
| Primary Focus | Desktop applications | Desktop and server applications |
| Popular Repository | Flathub | Snap Store |
Production Troubleshooting Scenario¶
Scenario
A developer installs GIMP using Flatpak.
The application cannot access files in the user's Documents folder.
Investigation:
The required filesystem permission is missing.
Solution:
The application can now access the required files.
Best Practices¶
- Use Flathub as the primary Flatpak repository.
- Keep applications and runtimes updated.
- Remove unused runtimes periodically.
- Review application permissions before granting additional access.
- Use Flatpak primarily for desktop applications rather than core operating system components.
Common Mistakes¶
❌ Forgetting to add the Flathub repository.
✅ Remember to to add the Flathub repository.
❌ Leaving unused runtimes installed.
✅ Do not leave unused runtimes installed.
❌ Granting excessive filesystem permissions to applications.
✅ Avoid this mistake: granting excessive filesystem permissions to applications.
❌ Using Flatpak for packages better managed by the system package manager.
✅ Avoid using Flatpak for packages better managed by the system package manager when a safer approach exists.
Interview Questions¶
Beginner¶
- What is Flatpak?
- What is Flathub?
- Which command installs a Flatpak application?
- How do you list installed Flatpak applications?
Intermediate¶
- What is a Flatpak runtime?
- How do you update Flatpak applications?
- How do you remove unused runtimes?
- How do you view application permissions?
Architect Level¶
- When would you choose Flatpak over Snap?
- Why are shared runtimes beneficial?
- How does Flatpak improve application security?
Summary¶
In this lesson, you learned:
- Flatpak package management
- Installing applications
- Flathub repositories
- Shared runtimes
- Application permissions
- Updating applications
- Sandboxing
- Production best practices
Flatpak provides a secure and portable method for distributing desktop applications across Linux distributions. By separating runtimes from applications and using sandboxing, Flatpak delivers efficient software management while improving compatibility and security.
Key Takeaways¶
- Flatpak is a universal package management system.
- Flathub is the primary repository for Flatpak applications.
- Flatpak uses shared runtimes to reduce duplication.
- Applications run inside secure sandboxes.
- Use
flatpak installto install applications. - Use
flatpak updateto keep applications current.
What's Next?¶
Repository Management — Managing Software Sources in Linux
You'll explore:
- What software repositories are
- Repository configuration
- Adding and removing repositories
- GPG keys and package verification
- Repository priorities
- Enterprise repository management
- Best practices for production systems
Understanding repository management is essential for securely controlling where your Linux systems obtain software updates and packages.