4 ways to Install deb file on Ubuntu – Uninstall deb package {Easy tutorial 2023}

Today this post will explain “4 ways to Install deb file on Ubuntu – Uninstall deb package” for beginners. It will cover approximately all aspect and ways of installing the .deb package on Linux and removal of the .deb file if you are not willing to keep it any more in your system.

What is deb File or package?

Deb is an extension or the file format of the archived software package built for Debian Linux or operating system in the Debian family tree.

If your OS belongs to the non-Debian family-like Centos or RedHat, it is the same as “.rpm” or you can assume them as .exe for windows.

To install deb packages, dpkg, apt and gdebi are the utilities that are used to list information, install or remove deb packages.

If the software is not available in the native Linux repository, you may need to download it from a third-party website in the form of a .deb file.

for e.g., if you need to install Chrome on Ubuntu, you need to download it from the Google chrome website.

Warning

*.deb files must be downloaded from a trusted and secure website otherwise,it may harm you.

Pre-requisite to install deb file on Ubuntu

  1. Sudo or root access
  2. Debian based distribution, I will use Ubuntu 20.04 LTS in this guide

4 ways to Install and uninstall deb package

Below mentioned are the 4 ways to Install deb file on Ubuntu – Uninstall deb package on Debian and it’s derivatives like Ubuntu, Lubuntu, Mint and Xubuntu.

  1. Using the Software centre (GUI)

  2. dpkg command

  3. The apt or apt-get command

  4. gdebi utility (GUI and CLI)

Option1- Install deb file on Ubuntu using Software centre

Installing a deb package using the software centre is the easiest method. I will show an example of a deb package of Teamviewer for your reference.

TeamViewer is a remote access solution available for Linux, Windows PCs,  Apple PCs and various other platforms, including Android and iPhone.

Step1:-

Go to the download directory of Teamviewer, select properties of “teamviewer_15.7.6_amd64.deb”  or your .deb file and check “Allow executing file as program” on the permissions tab.

4-ways-Install-deb-on-Ubuntu-Remove-deb-file-perm

Step2:-

Then select the default application as “Software install” on the “open with”  tab.

4-ways-to-Install-deb-file-on-Ubuntu-Uninstall-deb-package

Step3:-

Double-tap and install your package, it will request that you give sudo root for authorizations.

Step4:-

Verify Teamviewer or your software installation in Show applications.

deb-install-team

How to remove deb package using the software centre

To uninstall or remove deb package using Software centre, you just need to locate that software and click on Remove.

4 ways-Install-deb-Ubuntu-Remove-deb-file

Option2- How to Install deb file on Ubuntu using dpkg

Set the directory where you have downloaded your .deb file.

$ cd Downloads/

Unpack or Execute your deb file, option -i represent install.

$ sudo dpkg -i  "path to your .deb file"

Example

$ sudo dpkg -i teamviewer_15.7.6_amd64.deb

dev@ubuntu:~/Downloads$ sudo dpkg -i teamviewer_15.7.6_amd64.deb
[sudo] password for dev:

Output
Selecting previously unselected package teamviewer.
(Reading database … 195628 files and directories currently installed.)
Preparing to unpack teamviewer_15.7.6_amd64.deb …
Unpacking teamviewer (15.7.6) …
Setting up teamviewer (15.7.6) …
Processing triggers for gnome-menus (3.36.0-1ubuntu1) …
Processing triggers for desktop-file-utils (0.24-1ubuntu2) …
Processing triggers for mime-support (3.64ubuntu1) …
Processing triggers for hicolor-icon-theme (0.17-2) …
dev@ubuntu:~/Downloads$

Verify installed software.

In case Dependency errors bothering you? Dependent libraries and packages can be installed using the apt install command with -f option.

$ sudo apt install -f

How to uninstall deb package using dpkg

Run dpkg command with -r option.

$ sudo dpkg -r "software name"

Example:-

dev@ubuntu:~/Downloads$ sudo dpkg -r teamviewer

Output
(Reading database … 195739 files and directories currently installed.)
Removing teamviewer (15.7.6) …
Removed /etc/systemd/system/multi-user.target.wants/teamviewerd.service.
Clearing assignments …
done
Processing triggers for hicolor-icon-theme (0.17-2) …
Processing triggers for gnome-menus (3.36.0-1ubuntu1) …
Processing triggers for desktop-file-utils (0.24-1ubuntu2) …
Processing triggers for mime-support (3.64ubuntu1) …

Option3- Install deb file using apt command

apt is an advance packaging tool and used as a front-end package manager to list, install, remove, upgrade, search and management of packages.

To install any deb package using apt or apt-get.

$ sudo apt install "path to deb file"

$sudo apt-get install "path to deb file"

Make sure the deb package is downloaded locally and a relative or absolute path is provided. Otherwise, it will try to search it in the remote (/etc/apt/sources.list) a repository or throw an error Unable to locate the package.

$ sudo apt install "path to deb file"

Example:-

dev@ubuntu:~/Downloads$ sudo apt install ./teamviewer_15.7.6_amd64.deb

Output
Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting ‘teamviewer’ instead of ‘./teamviewer_15.7.6_amd64.deb’
Get:1 /home/dev/Downloads/teamviewer_15.7.6_amd64.deb teamviewer amd64 15.7.6 [14.4 MB]
Selecting previously unselected package teamviewer.
(Reading database … 195628 files and directories currently installed.)
Preparing to unpack …/teamviewer_15.7.6_amd64.deb …
Unpacking teamviewer (15.7.6) …
Setting up teamviewer (15.7.6) …
Processing triggers for mime-support (3.64ubuntu1) …
Processing triggers for hicolor-icon-theme (0.17-2) …
Processing triggers for gnome-menus (3.36.0-1ubuntu1) …
Processing triggers for desktop-file-utils (0.24-1ubuntu2) …
dev@ubuntu:~/Downloads$

Point worth to note, once you install the .deb package, Reputed software like Google chrome and Teamviewer, automatically updates site links in the software update repository.

In future, you don’t need to visit these sites, all upgrades can be taken care of by apt or apt-get command 😉

How to Remove deb package using apt or apt-get

apt and apt-get options are approx the same, the only difference you will find, apt is the newer version and still, some options are missing in it compared to the old apt-get installer.

Run this command apt or apt-get with remove option.

$ sudo apt remove "Software name"
$ sudo apt-get remove "Software name"

Example:-

dev@ubuntu:~/Downloads$ sudo apt remove teamviewer

Output
Reading package lists… Done
Building dependency tree
Reading state information… Done
—-output -truncated—-
Do you want to continue? [Y/n] y
(Reading database … 195739 files and directories currently installed.)
Removing teamviewer (15.7.6) …
Removed /etc/systemd/system/multi-user.target.wants/teamviewerd.service.
Clearing assignments …
done
Processing triggers for mime-support (3.64ubuntu1) …
Processing triggers for hicolor-icon-theme (0.17-2) …
Processing triggers for gnome-menus (3.36.0-1ubuntu1) …
Processing triggers for desktop-file-utils (0.24-1ubuntu2) …

apt remove command only removes software and it’s dependency. if you want to remove all configuration files also, you just need to run apt with the purge option. Notice the highlighted line in the output, everything else was the same in output compared to apt remove, so truncated duplicate lines.

$ sudo apt purge "software name"

Example:-

dev@ubuntu:~/Downloads$ sudo apt purge teamviewer

Output

Reading package lists… Done
Building dependency tree
Reading state information… Done
.

output truncated

.

Purging configuration files for teamviewer (15.7.6) …

Option4- How to Install deb using the gdebi tool

gdebi is a small and lite utility available in graphical and terminal both for package installation. Software centre can’t resolve dependency of a .deb package, but gdebi can download, install and resolve all dependency associated with a Linux .deb package.

GUI method to install deb package using gdebi

First of all, you need to install gdebi package as by default it’s not installed during Ubuntu installation.

dev@Devthechamp:~$ sudo apt install gdebi

Output
Reading package lists… Done
Building dependency tree
Reading state information… Done
Use ‘sudo apt autoremove’ to remove them.
The following additional packages will be installed:
gdebi-core libgtk2-perl libpango-perl
Suggested packages:
libgtk2-perl-doc
The following NEW packages will be installed:
gdebi gdebi-core libgtk2-perl libpango-perl
Need to get 841 kB of archives.
Do you want to continue? [Y/n] y

Once the installation is done. Open software search console and search for gdebi

4-ways-Install-deb-on-Ubuntu-Remove-deb-file-gdebi

Select FileOpen— and then select .deb package, which you would like to install.

4-ways-Install-deb-on-Ubuntu-Remove-deb-pkg

Click on Install package, give sudo root access and you are done. it will take care of all dependencies, you don’t need to worry about dependency error anymore.

gdebi-pkg-depen

How to remove deb file using gdebi GUI

if you are not happy with installed software 🙁 or package and you want to remove or uninstall, just click on Remove package from gdebi window.

remove-deb-gdebi

In case you have installed the package using gdebi and there are issues with the package and you need to repair it.

Click on the Reinstall package option, and it will automatically repair all libraries and dependent files for you.

How to install deb file using gdebi on the command line

it’s the easiest option in the command line as well, you just need to go to the directory, where you have .deb package download using the terminal.

$ cd Downloads/

and Run command with the deb package name and you can sit back and relax.

dev@ubuntu:~/Downloads$ sudo gdebi teamviewer_15.7.6_amd64.deb

Output
Reading package lists… Done
Building dependency tree
Reading state information… Done
Reading state information… Done
— output— truncated
Do you want to install the software package? [y/N]:y
/usr/bin/gdebi:113: FutureWarning: Possible nested set at position 1
c = findall(“[[(](\S+)/\S+[])]”, msg)[0].lower()
Selecting previously unselected package teamviewer.
(Reading database … 195625 files and directories currently installed.)
Preparing to unpack teamviewer_15.7.6_amd64.deb …
Unpacking teamviewer (15.7.6) …
Setting up teamviewer (15.7.6) …
Processing triggers for gnome-menus (3.36.0-1ubuntu1) …
Processing triggers for desktop-file-utils (0.24-1ubuntu2) …
Processing triggers for mime-support (3.64ubuntu1) …
Processing triggers for hicolor-icon-theme (0.17-2) …
dev@ubuntu:~/Downloads$

How to uninstall deb package using gdebi command line

To Uninstall package using Gdebi command line, apt purge or dpkg –purge can be used, as gdebi have no command to remove packages.

The purge option confirms that all dependencies and configuration files are cleared from your system for that package.

$ sudo dpkg --purge "software name"

Example:-

dev@ubuntu:~/Downloads$ sudo dpkg --purge teamviewer

Output
(Reading database … 195739 files and directories currently installed.)
Removing teamviewer (15.7.6) …
Removed /etc/systemd/system/multi-user.target.wants/teamviewerd.service.
Clearing assignments …
done
Purging configuration files for teamviewer (15.7.6) …
Processing triggers for hicolor-icon-theme (0.17-2) …
Processing triggers for gnome-menus (3.36.0-1ubuntu1) …
Processing triggers for desktop-file-utils (0.24-1ubuntu2) …
Processing triggers for mime-support (3.64ubuntu1) …

Video tutorial

 

Watch this video on “4 ways to Install deb file on Ubuntu – Uninstall deb package“.

Ending notes:-

Readers, hope every option you can think of installing or uninstalling deb file on Ubuntu is covered in this guide and visiting this post would have been a knowledgeable experience for you.

Let me know your thoughts and feedback by your comments on 4 ways to Install deb file on Ubuntu – Uninstall deb package guide 🙂

Frequently Asked Questions (FAQs)

Where do I put deb files in Ubuntu?

Answer – Whenever you download .deb file, By default, it will be in Download folder. But you are free to move it to any directory. The best place is to make a package directory and save all downloaded packages there for future use.
For example, let’s say package “teamviewer_15.7.6_amd64.deb” is in Download directory.
1.) Make a directory with name “package” in home directory. In my case it’s “/home/dev”.
$ sudo mkdir /home/dev/package
2) move teamviewer .deb file to package directory from downloads directory .
$ sudo mv /home/dev/Downloads/teamviewer_15.7.6_amd64.deb /home/dev/package $ ls /home/dev/package

Can I install Debian packages on Ubuntu?

Answer – Yes, Debian or .deb packages can be installed on Ubuntu. Installation can be done via Software center or using terminal (CLI). I have explained 4 ways to install Debian packages in this post. Please read and install software package as per your favourite method.

How do I install Steam on Ubuntu?

Answer– Follow these steps to install steam on Ubuntu

Step1 – Add multiverse inventory and update inventory
$ sudo add-apt-repository multiverse
$ sudo apt update

Step2 – Install the steam package
$ sudo apt install steam

Does Ubuntu use apt get?

Answer – Yes, Ubuntu uses the apt-get command to install software packages. Earlier apt was used but recently from 20.04, apt-get is used more frequently. apt-get is really a powerful tool to install or upgrade Debian packages.

How do I extract a deb file?

Answer – If you want to extract deb file or want to see content inside it. You can achieve it using ar command.
$ sudo ar -x “path to .deb package file”
For example –
$ sudo ar -x google-chrome-stable_current_amd64.deb

Dev

I'm Dev, your friendly neighbourhood Tech Savy. I spend my days with gadgets, servers, and the occasional laugh-inducing software mishap. Think of me as your tech-savvy, glitch-prone buddy. If you've got questions, feedback, or just need someone to blame when your Wi-Fi goes haywire, I'm your guy!