It’s a common habit for a new Ubuntu user to download a .deb file and try to install it. This is because new users often time come from Windows, where they used to run a .exe file to install the software. Debian or Ubuntu also can do this but the difference is the package formatting.
Ubuntu uses the Debian Package File or .deb file to package an application and its dependencies. In this tutorial, I’m going to show you 4 different methods to install a deb file in your Ubuntu.
What Is Deb File or Package?
A .deb file is a compressed archive file that contains all the necessary files, installation instructions, and configurations of a software program. It’s a software package primarily designed for Debian and Debian-based distros like Ubuntu, Linux Mint, Zorin OS, etc.
The name “Deb” comes from the Debian project. Debian is the granddaddy of all the Debian-based distros like Ubuntu, Linux Mint, Zorin OS, Elementary OS, and the list goes on. Debian Package is a popular way for developers to distribute software.
The main advantage of using Deb packages is that they are easy to install and manage. When a user wants to install a new application or program, they simply need to download the Deb package from the internet and use a package manager like APT or DPKG to install it on their system. The package manager will handle all the dependencies and ensure that the application is installed correctly, saving the user time and effort.
Method #1: Install A Deb File Using Ubuntu Software Center
The simplest way to install a deb file is using the Ubuntu Software Center. Right-click on your downloaded file and go to Properties.
Check whether Software Install is the Default Application or not. By default, Archive Manager is selected as Default Application. You need to change that. Select Software Install and set it as Default. Now, close the Properties window.
Now, Double-click your deb file or Right-click and select Open With Software Install.
It will open up the Ubuntu Software Center. Click on the Install button and enter your password.
Wait for the installation to be completed.
Your deb package is successfully installed. Go to your application menu and search for the package.
Method #2: Install A Deb File Using Gdebi
Gdebi is another GUI tool that allows you to install deb packages easily. It not only installs the deb file but also installs the dependencies needed for the package. Ubuntu Software Center does not do this.
If you use Ubuntu Software Center to install a deb file, you may encounter infamous “dependencies errors”. Because it does not handle dependencies as Gdebi does. I always prefer Gdebi over Ubuntu Software Center.
But it does not include in the system by default. You have to install it first. To install Gdebi, use the following command.
sudo apt install gdebi
After installing Gdebi, open up your file manager. Right-click on your downloaded file and open Properties.
Now, select Gdebi Package Installer and Set as default. Close the window.
Double-click or Right-click on the file again and select Open with Gdebi Package Installer.
Click on Install Package. It will ask for your password. Enter your password and wait for the installation to complete.
After it finishes the installation, close the window.
Your deb file is now installed with all the dependencies it requires to operate.
Note that, if any dependencies required for the package do not available in the repositories, Gdebi will not be able to install them. If your deb package requires any additional dependencies or libraries requiring manual installation, install them first.
Method #3: Install A Deb File Using APT In The Terminal
You can install a deb file using the APT Package Manager in the terminal. To do so, open up your file manager and go to the folder where you have downloaded the deb file. Right-click on a blank area and select Open in Terminal.
A new terminal window will open. Now, use the apt install command to install the deb package. The syntax looks like this:
sudo apt install ./<deb-file-name>
For example, I am using the Google Chrome deb package and the filename is “google-chrome-stable_current_amd64.deb“. So, I use this command.
sudo apt install ./google-chrome-stable_current_amd64.deb
Remember that, you need to use the full name including the .deb extension to successfully install the package.
Method #4: Install A Deb File Using DPKG In The Terminal
This is another method to install a deb file using the terminal. DPKG is the package management system for Debian and its derivatives like Ubuntu. APT Package Manager uses DPKG under the hood. You can directly use DPKG to install, build, remove, and manage Debian packages.
To install a deb file, the syntax looks like this:
sudo dpkg -i <deb-file-name>
Open up your file manager and go to the folder where you have downloaded the deb file. Right-click on a blank area and select Open in Terminal.
Now, use the dpkg command to install the deb package. The syntax looks like this:
sudo dpkg -i google-chrome-stable_current_amd64.deb
This time you don’t need to use
./<deb-file-name> at the end. Just enter the full file name and enter. It will ask for your password. Enter your password and wait for the process to be completed.
Resolve Dependencies Error
If you get a dependency error while installing the deb packages, you can use the following command to fix it:
sudo apt install -f
How To Uninstall A Deb Package?
For your time saving, you can follow this method. Open up the Ubuntu Software Center and go to the Installed tab. Look for the package you installed and click the Uninstall button.
It will prompt you whether you want to uninstall it or not. Click the Uninstall button and enter your password.
Wait until the uninstallation is done.
Congratulations! You have learned how to install a deb file in Ubuntu. If you want me to choose a method for you, I would say use Gdebi if you prefer GUI or APT if you prefer Terminal. Let me know which one you like. If you have any questions, ask me in the comment section below.