deb is the extension ,as well as format of the package format for Debian Linux and it’s derivatives like Ubuntu. This tutorial will show you how to install a deb file/package in ubuntu 20.04 via command line and GUI.

Before installing a deb package manually , it’s better to search in ubuntu’s official repository to see of ubuntu repository already included the package you required because official repository is more reliable and easy .

apt search keyword-here

Install deb package using apt

Apt which stands for Advanced Package Tool, is the command-line package manager for Debian and its derivatives like Ubuntu. apt provides command-line tools for searching, managing and querying information about packages, as well as low-level access to all features provided by the libapt-pkg and libapt-inst libraries which higher-level package managers can depend upon.

sudo apt install /path/to/filename.deb

In case you got dependency errors like E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution) you can try below command

sudo apt install /path/to/filename.deb -f

Where -f stands for fix broken or attempt to correct a system with broken dependencies in place.

The output looks like below :

sudo apt install ./VNC-Viewer-6.20.529-Linux-x86.deb -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
Note, selecting 'realvnc-vnc-viewer:i386' instead of './VNC-Viewer-6.20.529-Linux-x86.deb'
realvnc-vnc-viewer:i386 is already the newest version (6.20.529.42646).
The following packages were automatically installed and are no longer required:
  libfprint-2-tod1 libllvm10
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  gcc-10-base:i386 libbsd0:i386 libc6:i386 libcrypt1:i386 libgcc-s1:i386 libidn2-0:i386 libunistring2:i386 libx11-6:i386 libxau6:i386
  libxcb1:i386 libxdmcp6:i386 libxext6:i386
Suggested packages:
  glibc-doc:i386 locales:i386
The following NEW packages will be installed:
  gcc-10-base:i386 libbsd0:i386 libc6:i386 libcrypt1:i386 libgcc-s1:i386 libidn2-0:i386 libunistring2:i386 libx11-6:i386 libxau6:i386
  libxcb1:i386 libxdmcp6:i386 libxext6:i386
0 upgraded, 12 newly installed, 0 to remove and 46 not upgraded.
1 not fully installed or removed.
Need to get 3,909 kB of archives.
After this operation, 17.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

To remove the installed deb package , first we need to check the package name using command like below

apt list --installed |grep vnc-viewer
realvnc-vnc-viewer/now 6.20.529.42646 i386 [installed,local]

Then use command apt remove the uninstall it.

sudo apt remove realvnc-vnc-viewer

Or maybe add option autoremove to remove the packages were automatically installed and are no longer required.

sudo apt remove realvnc-vnc-viewer autoremove

Note: command dpkg and apt-get also can be used to install deb package but they can’t resolve dependency issue.

Install deb package using apt gdebi

Why gdebi, it lets you install local deb packages resolving and installing its dependencies. apt does the same, but only for remote (http,ftp) located packages. It can also resolve build-depends of debian/control files.

gdebi is not been installed by default in Ubuntu , you can use below command to get it installed.

sudo apt install gdebi-core

To install a deb file/package using gdebi , below command could be used

sudo gdebi /path/to/filename.deb

Install deb file/package via gui/gnome

If you are ubuntu desktop user , you also can install deb package using Ubuntu Software which is a utility for installing ,purchasing, and removing software in Ubuntu, a major part of Ubuntu’s overall software handling. This design specification describes, for designers, developers, testers, and potential contributors, how USC is supposed to work.

Just open your ubuntu’s file explorer , find that deb file ,then you can install it with a double click, ubuntu software will be invoked

ubuntu-software-install

In case after double-clicking the deb file no window popped up , probably because you never used Ubuntu Software, you need to open it manually the first time to let it be initialized .

ubuntu-software

Similarly you can remove installed packages using Ubuntu Software

ubuntu-software-remove

Conclusion

Now we have shown you how to install deb file/package in Ubuntu 20.04, if you are ubuntu server user or you are familiar with command line you can use command sudo apt install filename.deb , and if you are Ubuntu desktop user you can do it via Ubuntu Software.