无法在 Ubuntu 20.04 上安装 Deb 文件？这是你需要做的！
deb

> 
> 双击.deb 文件后无法通过 Ubuntu 20.04 的软件中心安装？你不是唯一遇到此问题的人。本教程展示了解决方法。
> 
> 
> 


![](/data/attachment/album/202005/15/112149cfdyg556upv6vd66.jpg)


在“[安装 Ubuntu 20.04 之后要做的事](/article-12183-1.html)”一文中，一些读者提到他们[用 .deb 文件安装软件](https://itsfoss.com/install-deb-files-ubuntu/)遇到了麻烦。


我发现这很奇怪，因为使用 deb 文件安装程序是最简单的方法之一。你要做的就是双击下载的文件，它会在软件中心中打开（默认情况下）。单击安装，它要求你输入密码，并在几秒钟/分钟内安装了该软件。


我[从 19.10 升级到 Ubuntu 20.04](https://itsfoss.com/upgrade-ubuntu-version/)直到今天都没有遇到这个问题。


我下载了 .deb 文件来安装 [Rocket Chat Messenger](https://rocket.chat/)，然后双击该文件安装时，文件用存档管理器打开。这不是我所期望的。


![DEB files opened with Archive Manager instead of Software Center](/data/attachment/album/202005/15/112245karnndgrbt5avqru.png)


“修复”很简单，我将在本教程中向你展示。


### 在 Ubuntu 20.04 中安装 deb 文件


由于某些原因，在 Ubuntu 20.04 中 deb 文件的默认打开程序被设置为存档管理器。存档管理器是用于[解压 zip](https://itsfoss.com/unzip-linux/) 和其他压缩文件。


解决此问题的方法非常简单。[在 Ubuntu 中更改默认应用](https://itsfoss.com/change-default-applications-ubuntu/)，将打开 DEB 文件从“存档管理器”改到“软件安装”。让我告诉你步骤。


**步骤 1：**右键单击下载的 .deb 文件，然后选择**属性**：


![](/data/attachment/album/202005/15/112246vc6c9lj5gj5jpp9m.png)


**步骤 2：**进入“**打开方式**”标签，选择“**软件安装**”，然后点击“**设置为默认**”。


![](/data/attachment/album/202005/15/112248zpiwyiciyiqwl99y.png)


这样，以后所有的 .deb 文件都将通过“软件安装”即软件中心打开。


双击 .deb 文件确认，看看是否在软件中心中打开。


### 忽视的 bug 还是愚蠢的功能？


为什么会用存档管理器打开 deb 文件让人无法理解。我确实希望这是一个 bug，而不是像[在 Ubuntu 20.04 中不允许在桌面上拖放文件](https://itsfoss.com/add-files-on-desktop-ubuntu/)这样的怪异功能。


既然我们在讨论 deb 文件的安装，就让我告诉你一个不错的工具 [gdebi](https://launchpad.net/gdebi)。它是一个轻量级应用，其唯一目的是安装 DEB 文件。有时它也可以处理依赖关系。


你可以了解更多有关[使用 gdebi 并默认设为安装 deb 文件的工具](https://itsfoss.com/gdebi-default-ubuntu-software-center/)。




---


via: <https://itsfoss.com/cant-install-deb-file-ubuntu/>


作者：[Abhishek Prakash](https://itsfoss.com/author/abhishek/) 选题：[lujun9972](https://github.com/lujun9972) 译者：[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)

In the “[things to do after installing Ubuntu 20.04](https://itsfoss.com/things-to-do-after-installing-ubuntu-20-04/)” article, a few readers mentioned that they had trouble [installing software from the Deb file](https://itsfoss.com/install-deb-files-ubuntu/).

I found that strange because installing a program using the deb file is one of the simplest methods. All you have to do is to double-click the downloaded file and it opens (by default) with the Software Center program. You click on install, it asks for your password and within a few seconds/minute, the software is installed.

I had [upgraded to Ubuntu 20.04 from 19.10](https://itsfoss.com/upgrade-ubuntu-version/) and hadn’t faced this issue with it until today.

I downloaded the .deb file for installing [Rocket Chat messenger](https://rocket.chat/) and when I double-clicked on it to install this software, the file was opened with the archive manager. This is not what I expected.

![Error Opening Deb File](https://itsfoss.com/content/images/wordpress/2020/05/error-opening-deb-file.png)

The “fix” is simple, and I am going to show it to you in this quick tutorial.

## Installing deb files in Ubuntu 20.04 and 22.04

For some reasons, the default software to open the deb file has been set to Archive Manager tool in Ubuntu 20.04. The Archive Manager tool is used for [extract zip](https://itsfoss.com/unzip-linux/) and other compressed files.

The solution for this problem is pretty simple. You [change the default application in Ubuntu](https://itsfoss.com/change-default-applications-ubuntu/) for opening DEB files from Archive Manager to Software Install. Let me show you the steps.

**Step 1:** Right click on the downloaded DEB file and select **Properties**:

![Open Deb Files](https://itsfoss.com/content/images/wordpress/2020/05/open-deb-files.png)

**Step 2:** Go to “**Open With**” tab, select “**Software Install**” app and click on “**Set as default**“.

![How to fix deb file not opening with software center](https://itsfoss.com/content/images/2023/09/deb-file-install-fix-ubuntu.webp)

This way, all the deb files in the future will be opened with Software Install i.e. the software center applications.

Confirm it by double clicking the DEB file and see if it open with the software center application or not.

## Ignorant bug or stupid feature?

Why deb files are supposed to be opened with Archive Manager is beyond comprehension. I do hope that this is a bug, not a weird feature like [not allowing drag and drop files on the desktop in Ubuntu 20.04](https://itsfoss.com/add-files-on-desktop-ubuntu/).

Since we are discussing deb file installation, let me tell you about a nifty tool [gdebi](https://launchpad.net/gdebi). It’s a lightweight application with the sole purpose of installing DEB file. Not always but some times, it can also handle the dependencies.

You can learn more about [using gdebi and making it default for installing deb files here](https://itsfoss.com/gdebi-default-ubuntu-software-center/).

On a related note, you may also want to read about [deleting deb packages](https://itsfoss.com/uninstall-deb-ubuntu/).