3 Ways to Install Deb Files on Ubuntu & Remove Them Later

This is another article in our Ubuntu beginner’s series. If you’re completely new to Ubuntu, you might be wondering how to install apps.

The easiest way is to use the Ubuntu Software Center. Search for an app by name and install it from there.

Life would be too simple if you could find all the apps in the Software Center. That’s not the case, unfortunately.

Some applications are available through ‘deb’ packages. These are archived files ending with the extension .deb.

You can think of .deb files as .exe files in Windows. Double-click the .exe file and the installation procedure in Windows starts. Deb packages are pretty much the same.

You can find these deb packages in the downloads section of a software vendor’s website. For example, if you want to install Google Chrome on Ubuntu, you can download the Chrome deb package from their website.

Now the question arises, how do you install deb files? There are several ways to install deb packages on Ubuntu. I will show them to you one by one in this tutorial.

Installing .deb files on Ubuntu and Debian-based Linux distributions

You can choose a GUI or command-line tool to install a deb package. The choice is yours.

Let’s go ahead and see how to install deb files.

Method 1: Use

the Default Software Center

The simplest method is to use the default software center in Ubuntu. There is nothing special to do here. Just go to the folder where you downloaded the .deb file (usually the Downloads folder) and double-click the file.

The Software Center will open, where you should see the option to install the software. All you have to do is press the install button and enter your login password.

softwareinstallfinal
Installing the deb file will be done through Software Center

Look, it’s even simpler than installing from a .exe file in Windows, isn’t it?

Troubleshooting: Double-clicking deb file does not open in software center in ubuntu 20.04

Double-clicking deb file in ubuntu 20.04

opens the file in

file manager instead of software center

.

This is strange, but it can be easily fixed. All you have to do is right-click on the deb file and opt for the Open with option. Here, choose to open with Software Installation as the default option.

Deb File Install Fix Ubuntu

Method 2: Use Gdebi Application to Install deb Packages with Dependencies

Again, life would be much simpler if things always went well. But that’s not life as we know it.

Now that you know .deb files can be easily installed through the Software Center, let me inform you about the dependency error you may encounter with some packages.

What happens is that a program can depend on another piece of software (such as libraries). When the developer is preparing the deb package for you, he/she may assume that your system already has that piece of software.

But if that’s not the case and your system doesn’t have those required pieces of software, you’ll run into the infamous “dependency bug.”

The Software Center cannot handle such errors on its own, so you should use another tool called gdebi.

gdebi is a lightweight GUI application only for installing deb packages.

Identify dependencies and attempt to install them along with .deb files.

gdebifinal
Install with

gdebi

Personally, I prefer gdebi over the software center to install deb files. It is a lightweight application so the installation seems faster. You can read in detail about using gDebi and make it the default for installing DEB packages.

You can install gdebi deb

package installer from the software center or by using the following

command:sudo apt install gdebi

Method 3: Install .deb files

on the command

line If you want to install deb packages on the command line, you can use the apt command or the dpkg command. The apt command uses the dpkg command below it, but apt is more popular and easier to use.

If you want to use the apt command for deb files, use it like this: sudo apt install path_to_deb_file If

it is in the same directory where the deb file is located, use it like this

: sudo apt install ./deb_file

If

you want to use the dpkg command to install deb packages, here’s how:sudo dpkg

-i path_to_deb_file

In both commands, You should replace path_to_deb_file with the path and name of the DEB file you downloaded.

terminalInstalling deb files using
dpkg command in Ubuntu

If you get a dependency error while installing deb packages, you can use the following command to fix it:

sudo apt install -f

How to remove deb packages

Deleting a deb package is also not a big deal. And no, you don’t need the original deb file you used to install the program.

Method 1: Delete deb packages using

apt command All you need is the name of the program you

have installed and then you can use apt or dpkg

to remove that program. sudo apt remove program_name

Now, how do you find the exact name of the program you need to use in the delete command? The apt command also has a solution for that.

You can find the list of all installed files with the apt command, but manually going through this will be a pain. Therefore, you can use the grep command to search for your package.

For example, I installed the

RocketChat app in the previous section, but if I want to find out the exact name of the program, I can use something like this:

sudo apt list -installed | grep chat

This will give me all the packages that have

‘chat’ in their name, and I can get the exact name of the program from there.

listapt
List of installed apps with ‘chat’ in the name

As you can see, a program called ‘rocketchat’ is installed. You can now use this program name with the apt remove command.

Method 2: Remove deb packages by using

the dpkg command

You can use dpkg to find the name of the installed program: dpkg

-l | grep chat

output will give all installed packages that have ‘chat’ in their names

.

chatdpkg
List Installed App using

dpkg

ii in the above command means that the package has been successfully installed.

Now that you have the name of the program, you can use the dpkg command to remove it:dpkg

-r program_name

What about updating deb packages?

Some deb packages (such as Chrome) provide updates through system updates, but for most other software you will have to remove the existing program and install the latest version.

I hope this beginner’s guide helped you install deb packages on Ubuntu. I added the removal part so you can have better control over your installed programs.