Install a Deb File by dpkg or by APT on Debian / Ubuntu: 3 Easy Methods

Posted on

Install a Deb File by dpkg or by APT on Debian / Ubuntu: 3 Easy Methods

Install a Deb File by dpkg or by APT on Debian / Ubuntu: 3 Easy Methods

In this guide, you will learn to Install a Deb File by dpkg or by APT on Debian / Ubuntu distros. A deb file is a software package file format primarily used by Debian and Ubuntu operating systems. This format simplifies the process of distributing and installing software on these Linux distributions. You can follow the steps below to see how to Install a Deb File by dpkg or by APT on Debian / Ubuntu in all versions such as Ubuntu 22.04 and Debian 12.

What is a Deb File Used For?

The deb file is used for installation packages that include software developed for computers that run on the Linux operating system using the Debian package management application. The Debian package management system offers a robust way to install, upgrade, and remove software on Debian-based systems.

What is the difference between apt and dpkg?

APT is a front-end to dpkg that is more user-friendly. dpkg handles individual package activities, APT handles package relationships, as well as the sourcing and administration of higher-level versioning choices. In short, APT is built on top of dpkg and provides more advanced features like dependency resolution and repository management.

To Install a Deb File by dpkg or by APT on Debian / Ubuntu, you must have access to your server as a non-root user with sudo privileges. For this purpose, you can visit the Debian Initial Guides on the Orcacore website.

Then, follow the steps below to Install a Deb File by dpkg or by APT on Debian / Ubuntu.

Method 1 – Install Deb Files with dpkg on Debian / Ubuntu

The dpkg is already installed by default in all Debian-based systems. You can use its option “-i” to install any deb files. The syntax is shown below:

sudo dpkg -i /path/package_name.deb

However, dpkg may give you a dependency error while installing the package.

dpkg: error processing package

If you get this error, then run the following command to install the pending dependencies:

sudo apt install -f

Then, install your deb package again. This command tells APT to attempt to fix broken dependencies.

Method 2 – Install Deb Files with APT on Debian / Ubuntu

At this point, you can easily install any deb files with Apt on Debian. APT (Advanced Package Tool) automatically resolves and installs any necessary dependencies, making it a more convenient method than dpkg alone.

To install deb files with APT, you can use one of the following commands:

# sudo apt install ./package_name.deb
# sudo apt install /path/package_name.deb

Method 3 – Install Deb Files with GDEBI on Debian / Ubuntu

Also, there is another way to install a deb file. GDEBI is a package installer to install Debian executable packages on the Debian-based distribution of Linux.

The Gdebi package manager is not installed by default in Debian. To install it, run the command below:

sudo apt install gdebi -y

When your installation is completed, you can use it to install any local deb file.

sudo gdebi /path/package_name.deb

The above command will install the deb file for you automatically. GDebi is particularly useful as it resolves and installs dependencies directly, similar to APT, but specifically designed for local .deb files.

That’s it, you are done.

Conclusion

At this point, you have learned to Install a Deb File by dpkg or by APT on Debian / Ubuntu distros. Also, you can use another package manager named Gdebi to install the deb packages on your Debian distros. These three methods provide flexibility based on your specific needs and the state of your system.

Hope you enjoy it. You may also interested in these articles:

Install Gnome Desktop Environment on Debian 12

Install MySQL on Debian 12 Bookworm

Alternative Methods for Installing Deb Files

While dpkg, apt, and gdebi are common and effective methods for installing .deb files, there are alternative approaches that can be useful in certain scenarios. Here are two additional methods:

Method 4: Using apt-get

While apt and apt-get largely overlap in functionality, apt-get remains a viable option and can be particularly useful in older scripts or systems where apt might not be fully supported. The key difference between apt and apt-get lies in their user interface and some advanced features. apt is designed to be more user-friendly, combining the functionality of apt-get and apt-cache into a single command.

To install a .deb file using apt-get, you can combine it with the dpkg command for initial installation and then use apt-get to resolve dependencies.

  1. Install the package using dpkg:

    sudo dpkg -i /path/to/your/package.deb
  2. Resolve dependencies using apt-get:

    If the dpkg command returns dependency errors, you can resolve them using apt-get with the -f (fix broken) option:

    sudo apt-get install -f

    This command will analyze the system and attempt to install any missing dependencies required by the package. After resolving dependencies, the package should be properly configured.

    This method is especially useful when you want a more granular control over the dependency resolution process or when dealing with older systems.

Method 5: Using a GUI Package Manager (Synaptic)

For users who prefer a graphical interface, Synaptic Package Manager offers a user-friendly way to install .deb files and manage dependencies. Synaptic provides a visual representation of available packages, their status, and dependencies, making it easier to understand and manage software installations.

  1. Install Synaptic Package Manager (if not already installed):

    sudo apt install synaptic
  2. Open Synaptic Package Manager:

    You can typically find it in your applications menu under "System Tools" or similar category, or by typing synaptic in the terminal.

  3. Navigate to "File" -> "Add Custom Package…":

    This will open a file browser allowing you to select the .deb file you want to install.

  4. Select the .deb file:

    Choose the .deb file and click "Open".

  5. Synaptic will analyze the package and its dependencies:

    If there are any missing dependencies, Synaptic will identify them and offer to install them.

  6. Click "Apply":

    This will start the installation process, including downloading and installing any required dependencies.

Synaptic’s GUI makes it easier for novice users to manage packages and dependencies, providing a visual overview of the system’s software environment. It’s a great alternative to command-line methods for those who prefer a more interactive approach.