Flatpak 介绍
Flatpak(前世为 xdg-app
)是一种用于构建、分发、安装和运行应用程序的技术,类似的应用程序容器技术还有大名鼎鼎的 Snap 、AppImage 。它主要针对的是 Linux 桌面,通过在沙箱中隔离应用程序来提高 Linux 桌面的安全性,允许应用程序安装在任何 Linux 发行版上,而且支持用户在同一个系统中安装同一应用程序的多个版本。如果需要更多的 Flatpak 应用,可以从 Flathub 应用商店直接获取。
Flatpak 安装
1 2 3 4 5 6 7 8 9 10 11 12 13 # yum install flatpak flatpak-builder# flatpak remote-add --if -not-exists flathub https://flathub.org/repo/flathub.flatpakrepo# wget https://sdk.gnome.org/keys/gnome-sdk.gpg# flatpak remote-add --gpg -import=gnome-sdk.gpg gnome https://sdk.gnome.org/repo/# flatpak remote-add --gpg -import=gnome-sdk.gpg --if -not-exists gnome-apps https://sdk.gnome.org/repo-apps/# flatpak remote-add --if -not-exists gnome-nightly https://nightly.gnome.org/gnome-nightly.flatpakrepo
Flatpak 仓库管理命令
1 2 3 4 5 6 7 8 9 10 11 12 13 14 # flatpak remotes# flatpak remote-delete gnome-apps# flatpak remote-ls | head -20 # flatpak remote-ls --app # flatpak remote-ls gnome-apps --app
Flatpak 应用管理命令
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 # flatpak install flathub com.leinardi.gwe# flatpak install --user flathub com.leinardi.gwe# flatpak run com.leinardi.gwe# flatpak info com.leinardi.gwe# flatpak list# flatpak list --app # flatpak update# flatpak update com.leinardi.gwe# flatpak uninstall com.leinardi.gwe# flatpak install com.leinardi.gwe.flatpak
Flatpak 安装插件
将 OBS 的插件文件存放到 ~/.var/app/com.obsproject.Studio/config/obs-studio/plugins
目录即可。
Flatpak 配置代理
若 Flatpak 的下载速度比较慢,此时可以配置 Flatpak 使用代理,以此加快下载速度。
1 2 3 4 5 6 # export http_proxy=http://127.0.0.1:8118# export https_proxy=http://127.0.0.1:8118# curl -I www.google.com
1 2 3 # unset http_proxy# unset https_proxy
Flatpak 更新应用到指定版本
查询应用的历史版本
1 flatpak remote-info --log flathub org.qgis.qgis
通常会返回应用历史版本相关的 Commit 信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 QGIS Desktop - A Free and Open Source Geographic Information System ID: org.qgis.qgis Ref: app/org.qgis.qgis/x86_64/stable Arch: x86_64 Branch: stable Version: 3.6.2 License: GPL-2.0+ Collection: org.flathub.Stable Download: 381.3 MB Installed: 1.2 GB Runtime: org.kde.Platform/x86_64/5.12 Sdk: org.kde.Sdk/x86_64/5.12 Commit: f800f16369746b5e82ccf1da7ed2ae6da225c3528081efbf16d5606ce46442d3 Parent: f3e180bb9ddc0cc9fc304e899b7c71405d10db81a8200f3d34dfb6288fec15b9 Subject: Include python future module (80f93cec) Date: 2019-04-26 00:14:37 +0000 History: Commit: f3e180bb9ddc0cc9fc304e899b7c71405d10db81a8200f3d34dfb6288fec15b9 Subject: Update to QGIS 3.6.2 (f1cbbf22) Date: 2019-04-23 04:38:57 +0000 Commit: 24d453472a05d12fdf473d1dd0f7b6510c4eec322dae83af7387172990b2d90d Subject: Fix build on flathub (48b0b7fa) Date: 2019-03-30 04:24:30 +0000 Commit: bd8025a0950240575fada49d52b05c3aeffb5863ff047c6b78a9ed13ac4e59a5 Subject: Added netcdf and hdf5 support (cdf2875c) Date: 2019-02-14 06:01:56 +0000 Commit: 249b547613eaaff9d3d8b651d1ffebc499532bfc041868b537d3d231776bf530 Subject: Update to qgis 3.4.2 (9ee661f8) Date: 2018-11-29 04:28:13 +0000 Commit: 9f7b5a691c48adeb991276439786a6119f91261b27a27091692565aaa3cde8e0 Subject: Fix typo (1ce68a18) Date: 2018-11-07 08:18:18 +0000 Commit: 1856a7d4a0430638c1249708994b204fb5329fc01bca709597f58c219120086b Subject: Include -DWITH_3D=TRUE as suggested (3a2d3a83) Date: 2018-09-26 15:47:23 +0000 Commit: 42ae7e501cb771eed7c7aee8cb06c4b3f956494d325fae379215b248216c2549 Subject: Allow QGIS to access the network (92e56b48) Date: 2018-09-26 14:30:53 +0000
更新应用至指定的 Commit ID
1 flatpak update --commit =f3e180bb9ddc0cc9fc304e899b7c71405d10db81a8200f3d34dfb6288fec15b9 org.qgis.qgis
Flatpak 清理磁盘空间
1 flatpak uninstall --unused
1 2 3 4 5 sudo du -sh /var/lib/flatpak/repo/tmp/ sudo rm -rf /var/lib/flatpak/repo/tmp/*
Flatpak 相关目录说明
1 2 1. 普通用户运行Flatpak应用后自动生成的缓存目录为:~/.var/app 2. 系统级安装Flatpak应用后,其应用的安装文件所在目录为:/var/lib/flatpak/app、/var/lib/flatpak/runtime
创建 Flatpak 应用的快捷方式
1 2 3 4 5 6 # ln -s /var/lib/flatpak/app/com.leinardi.gwe/x86_64/stable/fd76222820472b18cf6d6733e8549da7b25f14266cde1d4ba7d6975f983db7f8/files/share/applications/com.leinardi.gwe.desktop /usr/share/applications/gwe.desktop
Deepin-Wine 安装
Deepin(深度)默认支持 Flatpak,因此可以通过 Flatpak 安装 Deepin 构建打包好的 Flatpak 应用。首先使用 Flatpak 安装 Deepin-Wine 容器,然后就可以安装 Deepin 官方提供的 TIM、微信、迅雷等常用应用了。实测虽然部分应用可以安装并使用,但实际使用起来不太稳定。具体安装步骤可参考:flatpak-deepinwine-gitee 、Deepin-Wine 环境的 Ubuntu/Debian 移植版
参考博客