A Guide to Installing a Debian Package in Ubuntu

17 April 2025

1_healthytip

So in your endeavors, you find a nifty application. And it happens to provide only a .deb package. You are on Ubuntu. What do you do? Just hang on. This guide will show you how to install .deb packages on your Ubuntu machine.

A .deb package is much like a zip file for software on Debian-based systems. There are occasions when you need to install one such as to install software that is absent from Ubuntu’s standard app store. This article gives a few methods to install .deb packages on Ubuntu, and it also tells how to do it safely.

Debian Packages and Ubuntu Compatibility

Debian and Ubuntu are closely related. Actually Ubuntu is based on the Debian! This implies that a lot of their tools are similar, and things like the way they handle packages is similar.

What is a .deb Package?

A .deb package is a standard for installing programs under Debian and Ubuntu. It’s the bundle, actually, that contains all the files needed by programs. Actual program files, as well as commands on how to install them, are included. This package has control files and data archives.

Two important tools handle .deb packages: dpkg and apt. These are the critical ones for managing software on your system.

Debian vs. Ubuntu Package Manager Differences

Debian and Ubuntu make use of .deb packages. They, too, make use of similar tools for software management. Sadly, that is where the similarity ends. Even the packages are modified almost all the time by Ubuntu, to function better with Ubuntu’s specifications.

Not all of them, however, are perfect. On the contrary, some of them develop certain problems.

Installing Packages Not Built for A Specific System

Installing .deb packages not made for Ubuntu can really be a bad thing. It may lead to problems in your system; for instance, the package may require other software, whereas it conflicts with the software you already had in your system.

It is advisable to be careful when installing such foreign packages from outside the Ubuntu official source- only in trusted ones.

Method 1: Utilizing the dpkg Command

For the most part, the dpkg command is the simpler interface that you’ll need to know about using on .deb packages-it will install them, remove them, and manage them. However, it does not automatically resolve dependencies, which is probably the biggest flaw of dpkg.

Downloading the .deb Package

First, you want to fetch the relevant .deb file that you wish to install. Get it from a reliable source. The developer’s website is a good recommendation for a package download, but if there is a checksum available, check it as well. This just verifies that the file has not been tampered.

Installing With Dpkg -i

To install a .deb using dpkg, use the command sudo dpkg -i package_name.deb. Replace ‘package_name.deb’ with the real name of your file. The sudo bit provides you with the necessary permissions. This command informs dpkg that it has to install the package. It will unpack and set everything up.

Handling Errors Related to Dependencies
At times, the dpkg throws up an error regarding the dependencies being missing or not installed. The package needs software to be installed elsewhere to work and thus the reason of the error. This can be fixed by running sudo apt-get install -f or sudo apt –fix-broken install. These are the commands apt to find and install the missing pieces.

Method 2: Using apt for Better Dependency Resolution
apt is the higher-level, more intelligent package manager. It will automatically resolve missing dependencies. This makes installation of .deb packages very easy.

Install .deb with apt install./package.deb
The easiest way to install a .deb file with apt is to use the command sudo apt install ./package.deb. The ./ tells apt that the file is in the current directory. apt will then figure out what else needs to be installed. It will download and install those dependencies automatically.

When apt Fails- Resolving Dependency Issues
apt itself sometimes fails to resolve the dependencies. In such a case, try running sudo apt update. This will update the list of available packages. So let’s try installing the .deb file again. Sometimes, that’s all it takes!

Method 3: Using gdebi for a GUI Approach
gdebi is a graphical tool. It makes installing .deb packages easier, and it covers the dependencies as well.

Installing gdebi
To install gdebi, run the command sudo apt install gdebi. This command installs the gdebi tool.

Install .deb Packages Using gdebi
After installing gdebi, you will be able to right-click on a .deb package. Choose the option “Open with” and then select gdebi. After that, gdebi will show you the details of the package along with the dependencies that should be installed. Just tap on the Install Package button, and everything would be done by gdebi for you.

gdebi Limitations
Yes, it makes things a little simpler, but not always perfectly so. Often, it may fail to solve dependencies. gdebi is very user-friendly and is a good option if one likes a GUI interface.

Best Practices and Security Considerations
This is a general advice on how to install and manage .deb packages safely.

Verifying Package Authenticity
Always verify the authenticity of .deb packages, that is, download them from trusted sources, and check for signatures or checksums. This would help ensure that it has not been tampered with.

Managing Repositories
Be careful while establishing software repositories. Add only those repositories that you trust. Untrusted repositories might contain viruses or worms.

Uninstalling a .deb Package
To remove a .deb package, use any of these two commands-dpkg -r package_name or apt remove package_name. The “package_name” variable here refers to the name of the installed package, which will uninstall the software from your system.

Conclusion
In this article, you have been introduced to ways of installing .deb packages in Ubuntu. You have seen a number of commands: dpkg, apt, and gdebi. You should always be careful and handle dependencies wisely. It’s best to use official repositories whenever possible. Use .deb packages only when you need to. Always take the required precautions to keep your system safe.