How to Let dpkg Install Dependencies Automatically?

In Linux, dpkg stands for “Debian Package”. It is a command-line tool used for installing, configuring, and removing software packages in Debian-based Linux distributions such as Debian, Ubuntu, and their derivatives. The dpkg command is responsible for managing the individual software packages in a Debian-based Linux system.

This article has briefly explained the step-by-step instructions to install dependencies automatically. 

How to let dpkg Install Dependencies Automatically?

Users can prevent multiple problems such as missing files or libraries, packages that don’t work as expected, and many more. The step-by-step procedure to install dependencies automatically is provided below. 

Step 1: Install Dependencies Automatically

To install dependencies with dpkg, users can utilize the “-f” option to fix broken dependencies. In this way, the “apt” package manager installs any missing dependencies automatically by executing the below command:

$ sudo apt install -f

The above command installs all dependencies if the system is required. In our case, all the dependencies are already installed in the system. 

Step 2: Download .deb Package File

Users can download any Debian file to install the package in the operating system. In our case, download the “Google Chrome” package file that is supported to Linux from the official website:

$ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

The output shows that the Debian package of “Google Chrome” has been downloaded.

Step 3: Install .deb Package File

Users can utilize the “dpkg” command with the “–i” option to install dependencies automatically. In our case, specify the package name “google-chrome-stable_current_amd64.deb” in the below script:

$ sudo dpkg -i google-chrome-stable_current_amd64.deb

The output shows that dependencies of the “google-chrome-stable_current_amd64” package have been installed automatically in the system.

Step 4: Verify Google Chrome

To verify all dependencies are installed automatically, users can utilize the “version” option by specifying the package name. For instance, specify the “google-chrome” to check the installed version:

$ google-chrome --version

The output authenticates that the “Google Chrome 110.0.5481.96” have been installed along with all dependent files.

Conclusion

To install dependencies with dpkg, users execute the “sudo apt install -f” command in the terminal. It ensures that all the required packages are installed on the system. After that, users can install any Debian package by executing the “dpkg–i <pacakge_name.deb>” command. 

This guide has briefly demonstrated the step-by-step procedure to install the package along with dependencies automatically.