Install deb file from command line (dpkg, apt, gdebi, software center)

What is a deb file?

Deb is a collection of archived files that is managed by Debian Package Management System. Some softwares in Ubuntu is available through the deb package, these files have a .deb extension. In simple words, to install files in linux we have a software center but it does not have all the softwares, so these softwares are needed to be installed through the deb package. We will go through a number of steps through which we can install softwares from the deb package.

In this article we will be installing Google Chrome in Ubuntu.

  • First we have to download chrome from their official website. Follow this link https://www.google.com/chrome/ Installation in ubuntu

  • Now click on the Download button and select your linux type. Installation in ubuntu

  • Your download will be available in download folder Installation in ubuntu

Ways to install deb package in Ubuntu

Now we will see multiple ways of installing Google Chrome in Ubuntu as an example.

1. Software Center

  • First simplest way to install this file is to just double click on it and it will open it in software center like this Installation in ubuntu

  • Then you just need to click on install and enter password. Installation will start Installation in ubuntu

2. Installing .deb file using gdebi

While installing through software center, sometimes we can face some error like dependency error. This is because our software is dependent on some other piece of software or library. This occurs because while preparing the deb package, sometimes the developer may assume that some other required library or software is already available, but if it is not there then the system gives an error message.

To handle this we have gdebi, which is a lightweight GUI application. Its sole purpose is to install deb packages. It detects the dependencies and tries to install them along the package. Lets see how it works

  • First we have to install gdebi Open Command prompt (CTRL+ALT+T), then type command:

    sudo apt install gdebi

    and enter the password to your computer. gdebi package installer application will be installed. Installation in ubuntu

  • Right click on the downloaded file and select open with “ gdebi package installer “. Then click Install Package Installation in ubuntu

  • Then google chrome will be installed Installation in ubuntu

3. Installing deb files using dpkg command

For dpkg we will use -i parameter

  • Then type command {sudo dpkg -i path_to_the_file} in the terminal window and enter password.

    sudo dpkg -i ./Downloads/google-chrome-stable_current_amd64.deb 

    Installation in ubuntu

  • If we get error of missing dependencies, we can use this apt command to fix them

    sudo apt install -f

    Installation in ubuntu

  • To remove the package we have to use -r parameter

    sudo dpkg -r google-chrome-stable

    Installation in ubuntu

4. Installing deb file using apt command

To install using apt command, first we must have apt installed. Apt command uses dpkg underneath. It is more easy and popular.

  • Then type command {sudo apt install path_to_the_file} in the terminal window.

    sudo apt install ./Downloads/google-chrome-stable_current_amd64.deb 

    Installation in ubuntu

  • You can also remove this file by command

    sudo apt remove google-chrome-stable

    Installation in ubuntu

Also see: How to install software in Linux (RPM/DEB systems)

Help us improve this content by editing this page on GitHub