Test driving Flathub mirror for users in China

11 May 2020

One of the reasons Flathub is relatively fast regardless of where it’s used is CDN service provided by Fastly. This is not a good thing for users from China though, where Fastly, and thus Flathub, is blocked. Similar services are operating in China, but being an open source project, it’s easy to guess our budget is close to zero.

Felix Yan, a fellow Arch developer, suggested some VPS providers that are considered “China-friendly”. In the end, I configured two new servers in Seoul using Oracle Cloud free tier.

As Flathub enforces the remote URL for historical reasons, switching to a different address requires performing some manual changes from the terminal:

  1. Check with flatpak remote-list whether Flathub remote is configured globally (system) or for the current user only (user). It may be both.
  2. Open /var/lib/flatpak/repo/config for system installations or ~/.local/share/flatpak/repo/config for user installation in a text editor.
  3. Find [remote “flathub”] section. Change url to https://sel.flathub.org/repo/. Add new line below with following content: url-is-set=true

The entire section should look similar to:

[remote “flathub”]
xa.comment=Central repository of Flatpak applications
xa.description=Central repository of Flatpak applications

All subsequent Flatpak operations will go through one of the mirrors/proxies in Seoul now. I have also submitted a pull request which will make the process less manual.

If you are located in China, please give it a try and leave feedback in related GitHub issue. We’ll keep it running and mention in the setup instructions if it works well.