Install Dependencies Automatically in Ubuntu [3 Exclusive Methods]

A Complete Guide for Beginners Enroll Course Now

Installing a software package in Linux may depend on some other packages as a prerequisite. These packages are called dependencies. Dependencies must be installed before to ensure the successful installation of the original package. That’s why, installing dependencies is the most crucial task in the daily life of a Linux user. In this tutorial, I’ll demonstrate different ways that you can use to install packages and their dependencies automatically in Ubuntu distributions.

To install dependencies automatically with apt, use the following command:

  1. Install dependency: sudo apt install <package_name>
  2. Fix broken dependency: sudo apt install -f

Key Takeaways

  • Installing DEB package in Ubuntu.
  • Inspecting dependency issues regarding TeamViewer installation.
  • Installing dependencies automatically during package installation.


Process Flow Chart

[Distro Used Throughout the Tutorial: Ubuntu 22.04.1 LTS]3 ways to install dependencies automatically in ubuntu

3 Methods to Install Dependencies Automatically in Ubuntu

In Linux, you can install a package in two basic ways. The first one is to download and install the package automatically using a package manager. Secondly, you can manually download the package with necessary files like dependencies and then install it in the system. In this guide, I’ll show you three different approaches that you can use in both cases to install dependencies automatically in your Ubuntu system.

You can read our Comparative Analysis of Methods to distinguish between these three methods and pick the best one for your needs.

Method 1: Using “apt” or “apt-get” to Install Dependencies Automatically

APT (Advanced Package Tool) is a powerful package management system used in Debian-based Linux distributions, including Ubuntu. It simplifies software installation by handling dependencies automatically. Installing a package APT has the following syntax:

sudo apt install <package name>
  • sudo: Enables administrative permissions.
  • apt: Calls APT package management tools.
  • install: Command for installing a package using apt.
  • <package name>: Name of the package you want to install.

Follow these steps to install TeamViewer with all dependencies using APT.

Steps to Follow >

➊ Open the Ubuntu terminal. You can press CTRL+ALT+T.

➋ Run the following command:

sudo apt install teamviewer

➌ Enter user password if required.

➍ Type Y when the confirmation prompt appears.

➎ Press ENTER.installing teamviewer with apt.By the above command, APT will install the latest version of TeamViewer with all necessary dependencies automatically. Moreover, you can use apt-get which is also a command-line tool for package management used in Debian-based Linux distributions. Use the below command to install dependencies automatically using the apt-get command.

sudo apt-get install <package name>

Additionally, if you have tried to install a package that has unmet dependencies, you can use the below command:

sudo apt-get install –fix-broken

This command will resolve all dependency issues automatically during the installation of the mentioned package.

Method 2: Using Synaptic Package Manager to Install Dependencies Automatically

Synaptic Package Manager, often denoted as “Synaptic“, is a GUI (Graphical User Interface) package management tool for Debian-based Linux distributions. interfaces that also handle dependencies and other package management tasks effectively. Follow these steps to install a package with all dependencies automatically using Synaptic in Ubuntu:

Steps to Follow >

➊ Open Synaptic Package Manager from the Show Applications section.Open synaptic package manager form show applications option.➋ Type user password in the authentication window and click Authenticate.Typing user password to authenticate.➌ Click on the Search icon at the top right corner.

➍ Type “teamviewer” in the search box.

➎ Click on Search.Typing teamviewer in search box.A list of packages that have “teamviewer” in their name will appear.

Select the package you want to install.

Right click and select Mark of Installation.Right click teamviewer and select mark for installation.➑ Click on Mark.Confirming to install dependencies automatically.After that, Synaptic will install the package with detected dependencies automatically.

Method 3: Using GDebi to Install Dependencies Automatically

GDebi is mainly a GUI (Graphical User Interface) tool but it also supports CLI (Command Line Interface) to use for installing Debian (.deb) packages on Debian-based Linux distributions, including Ubuntu. It provides a user-friendly interface and handles dependencies automatically. But, you need the .deb file of the package to install it using GDebi. To install dependencies automatically using GDebi, follow the below steps:

Steps to Follow >

Click here to get the .deb file of TeamViewer from the official repository.

➋ Open the Ubuntu terminal by pressing CTRL+ALT+T.

➌ Run the following command:

ls ~/Downloads/
  • ls: Lists all the files and folders in the mentioned directory.
  • ~/Downloads/: Absolute path of the Downloads directory.
teamviewer's deb file is in download folder.The presence of the .deb file of TeamViewer in the Downloads folder ensures the successful downloading of the file.

➍ Now, execute the following command:

sudo gdebi ~/Downloads/teamviewer_15.43.7_amd64.deb
  • sudo: Grants administrative permissions.
  • gdebi: Calls GDebi package management
  • ~/Downloads/teamviewer_15.43.7_amd64.deb: Full name of the package with path.

➎ Enter user password if required.

➏ Type Y when the confirmation prompt appears.

➐ Press ENTER.GDebi installing dependencies of teamviewer automatically.The above command automatically detects and installs the required dependencies.

Comparative Analysis of Methods

I’ve shown three ways to install missing dependencies in Ubuntu. You might be confused to decide which one suits you the best. Here’s a comparison between the methods provided to give you an overview of the pros and cons.

Methods Pros Cons
Method 1
  • Automatically identifies all missing dependencies.
  • Installs the latest version of the dependency package.
  • Convenient syntax that doesn’t depend on the present working directory.
  • Doesn’t support multiple versions of the same dependency package.
Method 2
  • Automatically identifies all missing and broken dependencies.
  • Provides a user-friendly GUI that is suitable for beginners.
  • Hides internal complexity from the user.
  • May not provide core customization such as version control.
Method 3
  • Automatically identifies all missing dependencies.
  • Resolve all dependencies and install the complete package with just the .deb file.
  • Provides both GUI and CLI.
  • Not always preinstalled. So, Users might need to install it manually.
  • Needs to be careful about package location.

If you are comfortable with CLI and want to install all dependencies automatically during the installation of a package you can use Method 1. However, if you are not comfortable with CLI, you can use Method 2 in this situation. In case, you have a .deb file of a package and you want to install it with all required dependencies,, you should follow Method 3.

Common Challenges That May Arise

Although some of the package managers handle missing dependencies in Ubuntu automatically, challenges may arise sometimes. Some common challenges you might encounter and how to address them are listed below.

  • Repository Problems: Repository servers may occasionally experience downtime or issues. Ensure that you’re using up-to-date and reliable repository sources in your /etc/apt/sources.list file.
  • Dependency Version Conflicts: In some cases, a package may require a specific version of a dependency that conflicts with another package‘s requirements. Run sudo apt update and sudo apt upgrade to ensure your system is up to date and packages are compatible.
  • Software from Untrusted Sources: Installing software from untrusted sources or manually downloading .deb files can lead to dependency problems. So, stick to official repositories.
  • Disk Space Issues: If your system is low on disk space, it can prevent package installation. Check available disk space using df -h.


The automatic dependency resolution process discussed in this article simplifies the installation process and ensures complete functionality of the installed software. Also, automatic dependency installation lets you not worry about managing dependencies manually. However, you should stick to official repositories and trusted sources during package installation to ensure compatibility and security.

People Also Ask

How to install dependency packages in Ubuntu?
If you have a .deb file of the dependency package downloaded into your computer, you can install it using dpkg by the command sudo dpkg -i <dependency package.deb> replacing <dependency package.deb> with the actual full name of the dependency package. But if you don’t have the .deb file, use sudo apt install -f.
Does dpkg automatically install dependencies?
No, DPKG (Debian Package Manager) is a low-level package management tool for Debian-based Linux distributions that handles manual installation of .deb packages.
Does apt install dependencies?
Yes, APT (Advanced Package Tool) is a high-level package management tool for Debian-based Linux distributions that can install dependencies automatically. The command for installing a package with all its dependencies using apt is sudo apt install <package name>. Use the actual name of the package instead of <package name> in the mentioned command.
How do I fix missing dependencies in Ubuntu?
You can use the APT package manager to fix missing dependencies automatically in Ubuntu. Run sudo apt install -f or sudo apt-get install –fix-broken when you face missing dependency issues during the installation of a package.
How to install dependencies command?
If you know the dependency package name, use sudo apt install <dependency package name>. In case, you are facing dependency errors but you are not sure about which dependency package causing this error, you can run sudo apt install -f.

Related Articles

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

4.4/5 - (25 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