How to Install dpkg on Ubuntu 22.04

The dpkg (Debian Package Manager) works similarly to the apt package manager to manage Debian packages by installing, removing, updating, and configuring them.

Ubuntu is also a Debian-based Linux distribution which implies that the dpkg package manager will also work for the latest release of Ubuntu(codenamed Jammy Jellyfish).

In this article, the installation method of dpkg on Ubuntu has been explored, and some usage of this utility is discussed with an example.

How to Install dpkg on Ubuntu 22.04

Though the dpkg manager comes pre-installed on Ubuntu, it is ready to use, but if it is not installed, it can be installed from the default repository of Ubuntu.

To confirm the availability of the dpkg in the default repository of Ubuntu, run the command in the terminal:

$ apt show dpkg

1.21 version of the dpkg is available in the default repository of Ubuntu that can be installed using the command:

$ sudo apt install dpkg -y

When the dpkg is installed, the different usage options of the dpkg package manager can be explored using the command:

$ dpkg --help

Different options are displayed that can be used with the dpkg command, and also the general syntax of using the dpkg utility has been displayed.

How to Install or Remove a Debian Package Using dpkg on Ubuntu?

To understand the usage more clearly, this section shows the installation and removal of Debian packages using dpkg on Ubuntu. As an example, the package TeamViewer is used in this section.

Step 1: Download the Debian Package

First, Download the Debian package of TeamViewer using the command:

$ wget -c https://download.teamviewer.com/download/linux/teamviewer_amd64.deb

Step 2: Install the Downloaded Debian Package

After downloading is completed, use the dpkg manager to install the downloaded TeamViewer package on Ubuntu. For this, use the “dpkg” command with its “-i” option to install the package:

$ sudo dpkg -i teamviewer_amd64.deb

Step 3: Remove the Debian Package Using dpkg

The installed Debian package can be removed using the dpkg manager with its “r” option:

$ sudo dpkg -r teamviewer

In this way, the dpkg can be used to manage Debian packages on Ubuntu.

That’s all from this installation guide!

Conclusion

To install the dpkg on Ubuntu, open the terminal and run the command “sudo apt install dpkg” as this package is available in the default repository.  In this write-up, the installation method of dpkg on Ubuntu 22.04 is explored in detail. Moreover, you have also learned to install or remove any package using “dpkg”.