How to Install Dependencies Using dpkg? [Easiest Solution]

You may need to install some software to perform your daily tasks efficiently. For example, TeamViewer is a popular software package that allows users to connect to another computer from anywhere in the world. You can install the software using different package managers in Linux. DPKG is one of them. But installation of your desired software package may depend on some other packages called dependencies. Typically, you must install the dependencies before installing any of your preferred software.

Install Dependencies Using dpkg in Ubuntu

DPKG (Debian Package) is a package management system used by Debian-based distributions such as Ubuntu. It is a package management tool that handles the installation, removal and management of individual software packages on the system. When you install a package with dpkg, any dependencies required by that package must be installed manually.

Illustrating to you practically, first I’ll try to install TeamViewer. Then I’ll show how to use dpkg to install dependencies that arise during the installation of TeamViewer.

1. Install TeamViewer Using dpkg

Firstly, download and extract TeamViewer 15.43.7 from the download button. A file named teamviewer_15.43.7_amd64.deb will be downloaded in your Ubuntu Download folder. You can view the file by following the steps:

  1. Open your Ubuntu terminal by pressing CTRL+ALT+T.
  2. Type the command:
    ls Downloads/
    EXPLANATION
    • ls: List all files and folders in provided directory.
    • Downloads/: Navigate to the Downloads folder.

    TeamViewer deb file in the download folder.The output shows all the files and folders located inside the Downloads directory. Also, you can use GUI (Graphical User Interface) to check it.TeamViewer in download folder by GUI. You may see some other files and folders also. But of course, you will see the newly downloaded deb file of TeamViewer located in your Downloads directory. It means the download was successful.
  3. Type the following command:
    sudo dpkg -i Downloads/teamviewer_15.43.7_amd64.deb
    EXPLANATION
    • sudo: Grants administrative privileges.
    • dpkg: Calls package manager named dpkg to manage a package.
    • -i: Tells dpkg to install a package.
    • Downloads/teamviewer_15.43.7_amd64.deb: Location of the deb file with its name.

    Dependency error when installing TeamViewer.The output shows that a package named libminizip1 is the dependency and it is not installed. Because it will try to install Teamviewer 15.43.7 package. But as dpkg can’t install dependencies automatically, it will show a dependency error like this.

2. Install the Dependency Using dpkg Package Manager

As you can use dpkg to install any .deb extension file, you have to download and install the libminizip1 deb file as the TeamViewer installation is stuck due to the dependency error of libminizip1. To do so, follow the steps below:

  1. Download the .deb file of libminizip1. You will find it after extracting the file provided in the download button of this article.
  2. Press CTRL+ALT+T to open Ubuntu terminal.
  3. Navigate to Download/ directory by executing the command:
    ls Downloads

    You will see a file named libminizip1_1.1-8build_amd64.deb. It means libminizip1 is downloaded successfully.libminizip1 file in download folder.

  4. Then type the following command:
    sudo dpkg -i Downloads/libminizip1_1.1-8build_amd64.deb
  5. Type your user password and Press ENTER.Installing libminizip1 by dpkgThe output shows that libminizip1 is installed successfully.
    Note: If you see multiple dependency errors at the beginning of installing software, download all the deb files and repeat the process for every file.

    After installing dependencies like this, try to install TeamViewer with dpkg now, it will show no dependency error because you have already installed its dependency manually by dpkg.

  6. Now, run the following command and it will not show any dependency error:
    sudo dpkg -i Downloads/teamviewer_15.43.7_amd64.deb

    Installing TeamViewer with no dependency error.The output shows that TeamViewer is installed successfully.

Verify the Installation of Dependency in Ubuntu

Sometimes, more dependencies arise when installing a dependency. This is called recursive dependency.  Then it becomes difficult to keep track of the dependency packages. Besides, you may want to check whether the dependency you installed was successful or not. Look at the below methods to verify the installation of dependencies.

A. Using dpkg to Verify Individual Dependency

dpkg shows different types of status flags that you can use to justify the dependency installation. They are:

Status flag Indication About Package
ii Installed and configured.
rc The package is marked for removal but its configuration files are still present.
un Not installed.
ri Installation is broken and its files have been partially installed, waiting for a reinstallation to fix the issue

If you want to check multiple packages’ status, separate them by space. For example:

dpkg -l package1 package2 package3
EXPLANATION
  • dpkg -l: Calls the dpkg package manager to list installed packages that match a specific name or pattern which is provided after it.
  • package1 package2 package3: Multiple package names separated by space.

I’ve met one dependency error (libminizip1) and want to check if it is successfully installed or not. So. I’ll run the following command:

dpkg -l libminizip1

Checking status of libminizip1. The output lists libminizip1:amd64 with the ii status flag. It means the libminizip1 dependency package is successfully installed and configured.

B. Using GUI to Verify Entire Software Package

You can find your installed software if the installation is successful and meets all dependencies. To check whether TeamViewer is successfully installed, follow the steps shown in the image:

  1. Click the Show Applications icon.
  2. Start typing teamviewer in the search bar.Search TeamViewer in show application. If you find TeamViewer in the application list like above, it means you’ve successfully installed the software and all its dependencies.

Common Challenge: Package Architecture Doesn’t Match

You may download a .deb file of a dependency package that is not compatible with the version of your system. If you see an error message “package architecture does not match system” while installing, that means you are trying to install a file not suitable for your hardware. To check your hardware architecture, type the command below:

dpkg --print-architecture
EXPLANATION
  • dpkg: Package management tool for Debian-based architecture.
  • –print-architecture: Shows system architecture.

Checking system architecture. The output shows that my system architecture is amd64. So, I must download the deb packages that are suitable for amd64.

Note: If you see arm64 or other architecture, please be careful to choose .deb files that are suitable for your system architecture and download them from Ubuntu official website or any trusted source.

Conclusion

This article introduces you to the easiest way to install dependencies using dpkg. A complete method with a practical example is described here to resolve dependency errors that occurred during the installation of a package by dpkg. It is suitable for both advanced inspection and beginner installation purposes.

People Also Ask

How to install dependencies in dpkg command?
To install dependencies with dpkg, first download the .deb file of the dependency package form a trusted source. After that, you can install it by executing the sudo dpkg –i <pacakge_name. deb> command.
How to install dependency in Linux?
If you have the .deb file of the dependency package downloaded. execute the command with the following syntax sudo dpkg–i <pacakge_name. deb>. To install all dependencies automatically, run sudo apt-get -f.
How to install deb file with dpkg?
You can install a .deb file by opening a terminal and typing: sudo dpkg -i <package_file.deb>. Replace <package_file.deb> with the full name of the file.
How to find dependencies in Linux?
Run apt show <package-name> to find the list of dependencies of a software package. If you want to find the recursive dependencies, install “apt-rdepends” by sudo apt-get install -y apt-rdepends and then run sudo apt-rdepends <package-name>.
What is dpkg command in Linux?
DPKG is the primary package manager for Debian and Debian-based systems, such as Ubuntu. This tool installs, builds, removes, configures, and retrieves information for Debian packages. The command works with packages in .deb format.

Related Articles


<< Go Back to Dependencies in Linux | Package Management in Linux | Learn Linux Basics

5/5 - (6 votes)
Ashikur Rahman

Hello, I’m Ashikur Rahman, currently working as a Linux Content Developer Executive at SOFTEKO. I have completed my graduation in Computer Science and Engineering from Khulna University of Engineering & Technology (KUET). Also, I’m pursuing my master’s in the same department at Bangladesh University of Engineering & Technology (BUET). I like to learn new technologies, contribute, and share those with others. Here my goal is to provide beneficial and user-friendly articles on Linux distribution for everyone. Read Full Bio

Leave a Comment