如何在 Linux 中更新 Flatpak 软件包
Flatpak
![](/data/attachment/album/202301/03/154131lop17rnnrkiprkl7.jpg)


我相信几乎所有的 Linux 用户都会保持他们系统的更新。


但这种更新通常是针对默认的 [包管理器](https://itsfoss.com/package-manager/)。例如，[更新 Ubuntu](https://itsfoss.com/update-ubuntu/) 往往意味着更新所有的 APT 软件包。


然而，还有其他的打包格式，如 Snap 和 Flatpak。Snap 应用程序会自动更新，但 Flatpak 不会。


那么你如何更新 Flatpak 软件包呢？好吧，你可以用这个命令来更新所有已安装和可更新的 Flatpak 包：



```
flatpak update

```

这很简单。但让我再讨论一下关于更新 Flatpak 的一些事情，比如说：


* 更新所有或特定的 Flatpak 包
* 通过软件中心更新 Flatpak 包


让我们先从终端的方法开始。


### 方法 1：使用终端来更新 Flatpak 包


首先让我从最实用的方法开始，你也应该从这个方法开始。


#### 更新每一个过时的 Flatpak 包


更新现有的 Flatpak 包的整个目录是很容易的。


输入给定的命令，就可以得到过期包的列表：



```
flatpak update

```

![update flatpak packages in linux](/data/attachment/album/202301/03/154134vwxbzv9non79owx5.png)


你只需输入 `Y` 并按下回车键，就能搞定每一个更新。


#### 更新特定的 Flatpak 包


要更新特定的软件包，你需要可以更新的软件包的列表。你用的是你之前看到的那个命令。



```
flatpak update

```

![update flatpak packages in linux](/data/attachment/album/202301/03/154134vwxbzv9non79owx5.png)


从输出中复制你要更新的软件包的名称。在以下命令中使用软件包的名称：



```
flatpak update package_name

```

例如，如果你想更新 Telegram，下面的命令可以完成这项工作：



```
flatpak update org.telegram.desktop

```

![update specific package in flatpak](/data/attachment/album/202301/03/154134nk1u5l9o1kmw1him.png)


这就完成了。


### 方法 2：从软件中心更新 Flatpak 应用


有 Flatpak 内置支持的发行版会在软件中心提供 Flatpak 应用的更新。Fedora 和 Linux Mint 就是这样的发行版。


但如果你使用的是 Ubuntu，你就需要在 GNOME 软件中心添加 Flatpak 支持：



```
sudo apt install gnome-software-plugin-flatpak

```

完成后，你将在 Ubuntu 中拥有两个软件中心。这是因为默认的软件中心不是 GNOME 的，而是 Snap Store。


从系统菜单中打开这个新的软件中心：


![open software center in ubuntu](/data/attachment/album/202301/03/154135z7600a3okhrnj3ck.png)


进入“<ruby> 更新 <rt>  Update </rt></ruby>”页面，你会发现过时的软件包列表。这包括 APT 和 Flatpak 软件包。


![update flatpak from software center](/data/attachment/album/202301/03/154135s1kbbeex4jk7jvji.png)


在这里，你可以一次更新所有的软件包，或者你可以有选择地更新什么。


### 总结


许多 Linux 桌面用户往往忘记更新 Flatpak 软件包，因为它们不包括在定期的系统更新中。


由于 Flatpak 是一个沙盒式的打包解决方案，你可能不会面临任何与过时的软件包有关的问题，但你肯定会错过新的功能和修复。


这就是为什么我建议每隔几周运行一次 Flatpak 更新命令。


我希望你喜欢这个快速的 Flatpak 小技巧。




---


via: <https://itsfoss.com/update-flatpak/>


作者：[Sagar Sharma](https://itsfoss.com/author/sagar/) 选题：[lkxed](https://github.com/lkxed) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
![Warp Terminal](/assets/images/warp-terminal.webp)


![Warp Terminal](/assets/images/warp-terminal.webp)

I believe almost all Linux users keep their systems updated.

But that update is usually for the default [package manager](https://itsfoss.com/package-manager/). For example, [updating Ubuntu](https://itsfoss.com/update-ubuntu/) often means updating all the APT packages.

However, there are other packaging formats like Snap and Flatpak. The Snap applications get updated automatically but not the Flatpak ones.

How do you update the Flatpak packages then? Well, you can update all the installed and updatable Flatpak packages using this command:

`flatpak update`


That’s quite simple. But let me discuss a few more things about updating Flatpak, such as:

- Updating all or specific Flatpak packages
- Updating Flatpak packages via Software Center

Let’s start with the terminal method first.

## Method 1: Using the terminal for updating Flatpak packages

Let me first start with the most practical approach that you should also begin with.

### Update every outdated Flatpak package

Updating the whole catalog of existing flatpak packages is quite easy.

Enter the given command, and it will get you the list of outdated packages:

`flatpak update`


![3. update flatpak packages in linux](https://itsfoss.com/content/images/wordpress/2022/12/3.-update-flatpak-packages-in-linux.png)

You just have to enter “Y” and press the Enter key, which will take care of every update.

### Updating specific Flatpak package

To update specific packages, you’d need the list of the packages that can be updated. You used the same command you saw earlier.

`flatpak update`


![3. update flatpak packages in linux](https://itsfoss.com/content/images/wordpress/2022/12/3.-update-flatpak-packages-in-linux.png)

Copy the name of the package you want to update from the output. Use the package name in the following fashion:

`flatpak update package_name`


For example, if you want to update Telegram, the following command will get the job done:

`flatpak update org.telegram.desktop`


![4. update specific package in flatpak](https://itsfoss.com/content/images/wordpress/2022/12/4.-update-specific-package-in-flatpak-800x259.png)

That’s it!

[Learn Linux Quickly - Linux Commands for BeginnersLearn Linux Quickly doesn’t assume any prior Linux knowledge, which makes it a perfect fit for beginners. Nevertheless, intermediate and advanced Linux users will still find this book very useful as it goes through a wide range of topics. Learn Linux Quickly will teach you the following topics:Insta…](https://linuxhandbook.gumroad.com/l/mEsrwA)![](https://public-files.gumroad.com/variants/wd03xyf089rdb915v2jlyed3uymg/3953c12f08a92d2317e5f6a4fe2f6dd48702c3beec8a2173335cffa31a3561ec)


## Method 2: Update Flatpak applications from the software center

Distributions that come up with Flatpak buil-in support provide updates to Flatpak applications in the software center. Fedora and Linux Mint are such distributions.

But if you are using Ubuntu, you’d need to add flatpak support to the GNOME software center:

`sudo apt install gnome-software-plugin-flatpak`


Once done, you will have two software centers in Ubuntu. That’s because the default software center is not GNOME’s but Snap Store.

Open this new software center from the system menu:

![1. open software center in ubuntu](https://itsfoss.com/content/images/wordpress/2022/12/1.-open-software-center-in-ubuntu.png)

Go to the `Updates`

section and you will find the list of outdated packages. This includes both APT and Flatpak packages.

![2. update flatpak from software center](https://itsfoss.com/content/images/wordpress/2022/12/2.-update-flatpak-from-software-center.png)

From here, you can update all the packages at once, or you can be selective with what to update.

## Wrapping Up

Many Linux desktop users tend to forget to update the Flatpak packages as they are not included in the regular system updates.

Flatpak is a sandboxed packaging solution, you may not face any issues related to outdated packages, but you will surely miss out on new features and fixes.

This is why I recommend running the Flatpak update command once every few weeks.

Do you know that you can also [downgrade an updated Flatpak package](https://itsfoss.com/downgrade-flatpak-packages/)? Here's how to do that 👇

[How to Downgrade Flatpak Packages in LinuxOne of the lesser-known features of Flatpak packaging is that it allows you to downgrade installed applications. Here’s how to use it.](https://itsfoss.com/downgrade-flatpak-packages/)![](https://itsfoss.com/content/images/wordpress/2022/12/downgrade-flatpak-packages-1.png)


![](https://itsfoss.com/content/images/wordpress/2022/12/downgrade-flatpak-packages-1.png)

I hope you like this quick little Flatpak tip helpful. Here are a few more to enhance your experience.

[6 Tips and Tools to Enhance Your Flatpak Experience in LinuxIf you love using Flatpak applications, here are a few tips, tools, and tweaks to make your Flatpak experience better and smoother.](https://itsfoss.com/flatpak-tips-tweaks/)![](https://itsfoss.com/content/images/wordpress/2022/07/enhance-flatpak-experience-in-linux.png)


![](https://itsfoss.com/content/images/wordpress/2022/07/enhance-flatpak-experience-in-linux.png)