This guide walks you through publishing a Flatpak application to your own repository and then pushing updates to it. You’ll learn how to build the app, create a repository, add the build, install it locally for testing, and finally update the repository when you release a new version. Before starting, you need the Flatpak SDK and a working Flatpak manifest (.json or .yml) for your app.
What You’ll Need
- A Linux system with Flatpak installed (
flatpak --version). - The Flatpak builder tool:
sudo apt install flatpak-builder(Debian/Ubuntu) orsudo dnf install flatpak-builder(Fedora). - The Flatpak runtime and SDK matching your manifest (e.g.,
org.freedesktop.Platform//24.08andorg.freedesktop.Sdk//24.08). Install them withflatpak install flathub org.freedesktop.Platform//24.08 org.freedesktop.Sdk//24.08. - A valid manifest file for your application (e.g.,
com.example.MyApp.json). - An SSH key or a web server where you’ll host the repository (for remote access).
Step-by-Step
- Prepare your build directory. Create a clean directory for the build output, for example
build-dir. This will contain the compiled app and its metadata. - Build the application. Run
flatpak-builder --repo=my-repo build-dir com.example.MyApp.json. This compiles the app and stages it inbuild-dir. The--repoflag tells the builder to also create a repository namedmy-repoif it doesn’t exist, and to add the build to it. - Verify the build. Check for errors in the output. If the build fails, fix the manifest or source issues and re-run. You can also use
flatpak-builder --run build-dir com.example.MyApp.jsonto test the app before installing it. - Initialize the repository (if not already done). If you didn’t use
--repoin step 2, create a repository withflatpak build-init-repo my-repo. This sets up the OSTree structure for your repo. - Add the build to the repository. If you built without
--repo, useflatpak build-commit-from --repo=my-repo my-app-branch build-dir. If you used--repoin step 2, the commit is already done. The branch name is usuallyapp/com.example.MyApp/<arch>/stableor similar, depending on your manifest’sbranchkey. - Generate the appstream metadata (optional but recommended). Run
flatpak build-update-repo my-repoto update the repository metadata. This is needed after adding or updating any app. - Install the app locally for testing. Add the local repository to Flatpak:
flatpak remote-add --user my-repo my-repo(or--systemfor system-wide). Then install:flatpak install --user my-repo com.example.MyApp. - Run and verify the installed app. Launch it from your application menu or with
flatpak run com.example.MyApp. Check that it works correctly. - Publish the repository. Copy the
my-repodirectory to a web server or a static hosting service (e.g.,scp -r my-repo user@server:/var/www/flatpak/). Ensure the server serves the files over HTTP or HTTPS. - Add the remote to users. Users can add your remote with:
flatpak remote-add --user my-repo https://example.com/flatpak/my-repo.flatpakrepo. You need to provide a.flatpakrepofile that points to your repo. Create one with the following content:[Flatpak Repo] Title=My Apps Url=https://example.com/flatpak/my-repo Homepage=https://example.com Comment=My Flatpak repository Description=Apps from me Icon=https://example.com/icon.png
- Update the app (new version). When you release a new version, edit your manifest (e.g., bump the
versionfield or change the commit/tag in the source). Then rebuild:flatpak-builder --repo=my-repo build-dir com.example.MyApp.json. This will add a new commit to the repository. - Update the repository metadata. Run
flatpak build-update-repo my-repoto refresh the summary file. - Push the updated repository to your server. Upload the entire
my-repodirectory again, overwriting the old files. Users will see the update the next time they runflatpak update.
Common Mistakes
- Forgetting to update the repository metadata. If you don’t run
flatpak build-update-repo, clients may not see the new version. - Using the wrong branch name. The branch must match what the manifest specifies. Check with
flatpak list --runtimeorostree lsin the repo. - Not cleaning the build directory. Reusing a dirty build directory can cause stale files. Use
flatpak-builder --force-clean build-dir ...to start fresh. - Hosting the repo over plain HTTP. Flatpak requires a secure connection (HTTPS) for production. HTTP works only for local testing.
- Forgetting to add the runtime SDK. If the runtime is not installed, the build fails with a missing runtime error.
Tips
- Use a version control system (like Git) to track your manifest and build scripts.
- Automate the build and publish process with a CI/CD pipeline (e.g., GitHub Actions) to avoid manual steps.
- Sign your repository with GPG for integrity:
flatpak build-update-repo --gpg-sign=KEYID my-repo. This prevents tampering. - Test the update on a clean system before pushing to production.
- Keep your runtime SDK updated to the latest stable version to get security fixes.
Troubleshooting
- Build fails with “runtime not found”. Install the required runtime and SDK:
flatpak install flathub org.freedesktop.Platform//24.08 org.freedesktop.Sdk//24.08(adjust version as needed). - App doesn’t appear after install. Check that the branch name is correct and that you installed from the right remote. Use
flatpak listto see installed apps. - Update not showing for users. Ensure you ran
flatpak build-update-repoand that the repository files were fully uploaded to the server (including thesummaryfile). - Error: “remote not found” when adding. Double-check the URL in the
.flatpakrepofile and that the server is accessible. - Permission denied when writing to repo. If using
--system, you may needsudoor change ownership of the repo directory.
Frequently Asked Questions
Can I host a Flatpak repo on GitHub Pages?
Yes, GitHub Pages supports static files, and Flatpak repos are just static OSTree data. Upload the repo to a branch and serve it via HTTPS.
Do I need to sign my repository?
Not strictly, but it’s highly recommended. Without a signature, Flatpak will warn users that the repo is not signed. Use flatpak build-update-repo --gpg-sign=KEYID.
How do I remove an app from my repository?
You can’t remove a specific commit, but you can create a new branch without the app and update the repo. Alternatively, delete the repo and recreate it, but that breaks existing installs.
Can I publish updates without rebuilding the whole app?
Yes, if only metadata changed (like the appstream file), you can use flatpak build-commit-from to add a new commit with just the changed files.
What is the difference between --user and --system?
--user installs the app only for the current user, while --system installs it system-wide (requires root). For publishing, use --system for broader access.
How do I set the version number in the manifest?
In the appdata section, set <releases> with a <release version="1.2.3" date="..."/>. This is what users see in software centers.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Google Chrome Helper: What It Is & How to Disable
- Fix 0x80070422 on Windows Server (Step-by-Step)
- How to Troubleshoot a Malfunctioning Driver on Windows
- How to Create Folders in Microsoft Outlook
- Fix Status Range List Conflict 0xc0000282 in Windows
- Fix Software Not Uninstalling on Windows 10