From 35831e35a82dbe783caf83e8fd7688d14bcd61bd Mon Sep 17 00:00:00 2001 From: wwhio Date: Fri, 18 Jan 2019 23:57:09 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=EF=BC=8C=E7=94=B3=E8=AF=B7=E6=A0=A1=E5=AF=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20180428 A Beginners Guide To Flatpak.md | 144 +++++++++--------- 1 file changed, 69 insertions(+), 75 deletions(-) diff --git a/sources/tech/20180428 A Beginners Guide To Flatpak.md b/sources/tech/20180428 A Beginners Guide To Flatpak.md index 8b3460c2dd..614f54cdf1 100644 --- a/sources/tech/20180428 A Beginners Guide To Flatpak.md +++ b/sources/tech/20180428 A Beginners Guide To Flatpak.md @@ -1,56 +1,53 @@ -Translating by wwhio - - -A Beginners Guide To Flatpak +Flatpak 新手指南 ====== ![](https://www.ostechnix.com/wp-content/uploads/2016/06/flatpak-720x340.jpg) -A while, we have written about [**Ubuntu’s Snaps**][1]. Snaps are introduced by Canonical for Ubuntu operating system, and later it was adopted by other Linux distributions such as Arch, Gentoo, and Fedora etc. A snap is a single binary package bundled with all required libraries and dependencies, and you can install it on any Linux distribution, regardless of its version and architecture. Similar to Snaps, there is also another tool called **Flatpak**. As you may already know, packaging distributed applications for different Linux distributions are quite time consuming and difficult process. Each distributed application has different set of libraries and dependencies for various Linux distributions. But, Flatpak, the new framework for desktop applications that completely reduces this burden. Now, you can build a single Flatpak app and install it on various operating systems. How cool, isn’t it? +不久前,我们介绍 Ubuntu 推出的 [**Snaps**][1]。Snaps 是由 Canonical 公司为 Ubuntu 开发的,并随后移植到其他的 Linux 发行版,如 Arch、Gentoo、Fedora 等等。由于一个 snap 包中含有软件的二进制文件和其所需的所有依赖和库,所以可以在无视软件版本、在任意 Linux 发行版上安装软件。和 Snaps 类似,还有一个名为 **Flatpak** 的工具。也许你已经知道,为不同的 Linux 发行版打包并分发应用时已经多么费时又复杂的工作,因为不同的 Linux 发行版的库不同,库的版本也不同。现在,Flatpak 作为分发桌面应用的新框架可以让开发者完全摆脱这些负担。开发者只需构建一个 Flatpak app 就可以在多种发行版上安装使用。这真是又酷又棒! -Also, the users don’t have to worry about the libraries and dependencies, everything is bundled within the app itself. Most importantly, Flaptpak apps are sandboxed and isolated from the rest of the host operating system, and other applications. Another notable feature is we can install multiple versions of the same application at the same time in the same system. For example, you can install VLC player version 2.1, 2.2, and 2.3 on the same system. So, the developers can test different versions of same application at a time. +用户也完全不用担心库和依赖的问题了,所有的东西都和 app 打包在了一起。更重要的是 Flatpak app 们都自带沙箱,而且与宿主操作系统的其他部分隔离。对了,Flatpak 还有一个很棒的特性,它允许用户在同一个系统中安装同一应用的多个版本,例如 VLC 播放器的 2.1 版、2.2 版、2.3 版。这使开发者测试同一个软件的多个版本变得更加方便。 -In this tutorial, we will see how to install Flatpak in GNU/Linux. +在本文中,我们将指导你如何在 GNU/Linux 中安装 Flatpak。 -### Install Flatpak +### 安装 Flatpak -Flatpak is available for many popular Linux distributions such as Arch Linux, Debian, Fedora, Gentoo, Red Hat, Linux Mint, openSUSE, Solus, Mageia and Ubuntu distributions. +Flatpak 可以在大多数的主流 Linux 发行版上安装使用,如 Arch Linux、Debian、Fedora、Gentoo、Red Hat、Linux Mint、openSUSE、Solus、Mageia 还有 Ubuntu。 -To install Flatpak on Arch Linux, run: +在 Arch Linux 上,使用这一条命令来安装 Flatpak: ``` $ sudo pacman -S flatpak ``` -Flatpak is available in the default repositories of Debian Stretch and newer. To install it, run: +对于 Debian 用户,Flatpak 被收录进 Stretch 或更新版本的默认软件源中。要安装 Flatpak,直接执行: ``` $ sudo apt install flatpak ``` -On Fedora, Flatpak is installed by default. All you have to do is enable enable Flathub as described in the next section. +对于 Fedora 用户,Flatpak 是发行版默认安装的软件。你可以直接跳过这一步。 -Just in case, it is not installed for any reason, run: +如果因为任何原因没有安装的话,可以执行: ``` $ sudo dnf install flatpak ``` -On RHEL 7, run: +对于 RHEL 7 用户,安装 Flatpak 的命令为: ``` $ sudo yum install flatpak ``` -On Linux Mint 18.3, flatpak is installed by default. So, no setup required. +如果你在使用 Linux Mint 18.3,那么 Flatpat 也随系统默认安装,所以跳过这一步。 -On openSUSE Tumbleweed, Flatpak can also be installed using Zypper: +在 openSUSE Tumbleweed 中,使用 Zypper 包管理来安装 Flatpak: ``` $ sudo zypper install flatpak ``` -On Ubuntu, add the following repository and install Flatpak as shown below. +而 Ubuntu 需要添加下面的软件源再安装 Flatpak,命令如下: ``` $ sudo add-apt-repository ppa:alexlarsson/flatpak @@ -60,39 +57,39 @@ $ sudo apt install flatpak ``` -The Flatpak plugin for the Software app makes it possible to install apps without needing the command line. To install this plugin, run: +Gnome 提供了一个 Flatpak 插件,安装它就可以使用图形界面来安装 Flatpak app 了。插件的安装命令为: ``` $ sudo apt install gnome-software-plugin-flatpak ``` -For other Linux distributions, refer the official installation [**link**][2]. +如果你是用发行版没有在上述的说明里,请你参考官方[**安装指南**][2]。 -### Getting Started With Flatpak +### 开始使用 Flatpak -There are many popular applications such as Gimp, Kdenlive, Steam, Spotify, Visual studio code etc., available as flatpaks. +有不少流行应用都支持 Flatpak 安装,如 Gimp、Kdenlive、Steam、Spotify、Visual Sudio Code 等。 -Let us now see the basic usage of flatpak command. +下面让我来一起学习 flatpak 的基本操作命令。 -First of all, we need to add remote repositories. +首先,我们需要添加远程仓库。 -#### Adding Remote Repositories** +#### 添加软件仓库 -**Enable Flathub Repository:** +**添加 Flathub 仓库:** -**Flathub** is nothing but a central repository where all flatpak applications available to users. To enable it, just run: +**Flathub** 是一个包含了几乎所有 flatpak 应用的仓库。运行这条命令来启用它: ``` $ sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo ``` -Flathub is enough to install most popular apps. Just in case you wanted to try some GNOME apps, add the GNOME repository. +对于流行应用来说,Flathub 已经可以满足需求。如果你想试试 GNOME 应用的话,可以添加 GNOME 的仓库。 -**Enable GNOME Repository:** +**添加 GNOME 仓库:** -The GNOME repository contains all GNOME core applications. GNOME flatpak repository itself is available as two versions, **stable** and **nightly**. +GNOME 仓库包括了所有的 GNOME 核心应用,它提供了两种版本:**稳定版**stable**每日构建版**nightly。 -To add GNOME stable repository, run the following commands: +使用下面的命令来添加 GNOME 稳定版仓库: ``` $ wget https://sdk.gnome.org/keys/gnome-sdk.gpg @@ -100,15 +97,15 @@ $ sudo flatpak remote-add --gpg-import=gnome-sdk.gpg --if-not-exists gnome-apps ``` -Applications in this repository require the **3.20 version of the org.gnome.Platform runtime**. +需要注意的是,GNOME 稳定版仓库中的应用需要 **3.20 版本的 org.gnome.Platform 运行时环境**。 -To install the stable runtimes, run: +安装稳定版运行时环境,请执行: ``` $ sudo flatpak remote-add --gpg-import=gnome-sdk.gpg gnome https://sdk.gnome.org/repo/ ``` -To add the GNOME nightly apps repository, run: +如果想使用每日构建版的 GNOME 仓库,使用如下的命令: ``` $ wget https://sdk.gnome.org/nightly/keys/nightly.gpg @@ -116,17 +113,17 @@ $ sudo flatpak remote-add --gpg-import=nightly.gpg --if-not-exists gnome-nightly ``` -Applications in this repository require the **nightly version of the org.gnome.Platform runtime**. +同样,每日构建版的 GNOME 仓库也需要 **org.gnome.Platform 运行时环境的每日构建版本**。 -To install the nightly runtimes, run: +执行下面的命令安装每日构建版的运行时环境: ``` $ sudo flatpak remote-add --gpg-import=nightly.gpg gnome-nightly https://sdk.gnome.org/nightly/repo/ ``` -#### Listing Remotes +#### 查看软件仓库 -To list all configured remote repositories, run: +要查看已经添加的软件仓库,执行下面的命令: ``` $ flatpak remotes Name Options @@ -138,126 +135,126 @@ gnome-nightly-apps system ``` -As you can see, the above command lists the remotes that you have added in your system. It also lists whether the remote has been added per-user or system-wide. +如你所见,上述命令会列出你添加到系统中的软件仓库。此外,执行结果还表明了软件仓库的配置是用户级per-user还是系统级system-wide。 -#### Removing Remotes +#### 删除软件仓库 -To remove a remote, for example flathub, simply do; +要删除软件仓库,例如 flathub,用这条命令: ``` $ sudo flatpak remote-delete flathub ``` -Here **flathub** is remote name. +这里的 **flathub** 是软件仓库的名字。 -#### Installing Flatpak Applications +#### 安装 Flatpak 应用 -In this section, we will see how to install flatpak apps. To install a flatpak application +这一节,我们将学习如何安装 flatpak 应用。 -To install an application, simply do: +要安装一个应用,只要一条命令就能完成: ``` $ sudo flatpak install flathub com.spotify.Client ``` -All the apps in the GNOME stable repository uses the version name of “stable”. +所有的稳定版 GNOME 软件仓库中的应用,都使用“stable”作为版本名。 -To install any Stable GNOME applications, for example **Evince** , run: +例如,想从稳定版 GNOME 软件仓库中安装稳定版 **Evince**,就执行: ``` $ sudo flatpak install gnome-apps org.gnome.Evince stable ``` -All the apps in the GNOME nightly repository uses the version name of “master”. +所有的每日构建版 GNOME 仓库中的应用,都使用“master”作为版本名。 -For example, to install gedit, run: +例如,要从每日构建版 GNOME 软件仓库中安装 gedit 的每次构建版本,就执行: ``` $ sudo flatpak install gnome-nightly-apps org.gnome.gedit master ``` -If you don’t want to install apps system-wide, you also can install flatpak apps per-user like below. +如果不希望应用安装在系统级system-wide,而只安装在用户级per-user,那么你可以这样安装软件: ``` $ flatpak install --user ``` -All installed apps will be stored in **$HOME/.var/app/** location. +所有的应用都会被存储在 **$HOME/.var/app/** 目录下. ``` $ ls $HOME/.var/app/ com.spotify.Client ``` -#### Running Flatpak Applications +#### 执行 Flatpak 应用 -You can launch the installed applications at any time from the application launcher. From command line, you can run it, for example Spotify, using command: +你可以直接使用应用启动器application launcher来运行已安装的 Flatpak 应用。如果你想从命令行启动的话,以 Spotify 为例,执行下面的命令: ``` $ flatpak run com.spotify.Client ``` -#### Listing Applications +#### 列出已安装的 Flatpak 应用 -To view the installed applications and runtimes, run: +要查看已安装的应用程序和运行时环境,执行: ``` $ flatpak list ``` -To view only the applications, not run times, use this command instead. +想只查看已安装的应用,那就用这条命令: ``` $ flatpak list --app ``` -You can also view the list of available applications and runtimes from all remotes using command: +如果想查询已添加的软件仓库中的可安装程序和可安装的运行时环境,使用命令: ``` $ flatpak remote-ls ``` -To list only applications not runtimes, run: +只列出可安装的应用程序的命令是: ``` $ flatpak remote-ls --app ``` -To list applications and runtimes from a specific repository, for example **gnome-apps** , run: +查询指定远程仓库中的所有可安装的应用程序和运行时环境,这里以 **gnome-apps** 为例,执行命令: ``` $ flatpak remote-ls gnome-apps ``` -To list only the applications from a remote repository, run: +只列出可安装的应用程序,这里以 **flathub** 为例: ``` $ flatpak remote-ls flathub --app ``` -#### Updating Applications +#### 更新应用程序 -To update all your flatpak applications, run: +更新所有的 Flatpak 应用程序,执行: ``` $ flatpak update ``` -To update a specific application, we do: +更新指定的 Flatpak 应用程序,执行: ``` $ flatpak update com.spotify.Client ``` -#### Getting Details Of Applications +#### 获取应用详情 -To display the details of a installed application, run: +执行下面的命令来查看已安装应用程序的详细信息: ``` $ flatpak info io.github.mmstick.FontFinder ``` -Sample output: +输出样例: ``` Ref: app/io.github.mmstick.FontFinder/x86_64/stable ID: io.github.mmstick.FontFinder @@ -274,28 +271,25 @@ Runtime: org.gnome.Platform/x86_64/3.28 ``` -#### Removing Applications +#### 删除应用程序 -To remove a flatpak application, run: +要删除一个 Flatpak 应用程序,这里以 spotify 为例,执行: ``` $ sudo flatpak uninstall com.spotify.Client ``` -For details, refer flatpak help section. +如果你需要更多信息,可以参考 Flatpak 的帮助。 ``` $ flatpak --help ``` -And, that’s all for now. Hope you had basic idea about Flatpak. +到此,希望你对 Flatpak 有了一些基础了解。 -If you find this guide useful, please share it on your social, professional networks and support OSTechNix. - -More good stuffs to come. Stay tuned! - -Cheers! +如果你觉得这篇指南有些帮助,请在你的社交媒体上分享它来支持 OSTechNix。 +稍后还有更多精彩内容,尽情期待~ -------------------------------------------------------------------------------- @@ -304,7 +298,7 @@ via: https://www.ostechnix.com/flatpak-new-framework-desktop-applications-linux/ 作者:[SK][a] 选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) +译者:[wwhio](https://github.com/wwhio) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 5e65cad61509045647caffde9971e431b470735b Mon Sep 17 00:00:00 2001 From: wwhio Date: Fri, 18 Jan 2019 23:59:34 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=EF=BC=8C=E7=94=B3=E8=AF=B7=E6=A0=A1=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20180428 A Beginners Guide To Flatpak.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20180428 A Beginners Guide To Flatpak.md (100%) diff --git a/sources/tech/20180428 A Beginners Guide To Flatpak.md b/translated/tech/20180428 A Beginners Guide To Flatpak.md similarity index 100% rename from sources/tech/20180428 A Beginners Guide To Flatpak.md rename to translated/tech/20180428 A Beginners Guide To Flatpak.md