This beginner article explains how to install deb packages on Ubuntu. It also shows you how to remove those deb packages afterwards.
This is another article in our Ubuntu beginner series. If you’re completely new to Ubuntu, you might be wondering about how to install applications.
The easiest way is to use the Ubuntu Software Center. Search for an application by name and install it from there.
Life would be too simple if you could find all the applications in the Software Center. That’s not the case,
Some software is available via ‘deb’ packages. These are archived files that end with the .deb extension.
You can think of .deb files as like .exe files in Windows. You double click on the .exe file and it starts the installation procedure in Windows. Deb packages are pretty much the same.
You can find these deb packages in the download section of a software provider’s website. For example, if you want to install Google Chrome on Ubuntu, you can download the Chrome deb package from its website.
Now the question arises, how do you install deb files? There are multiple ways of installing deb packages on Ubuntu. I’ll show them to you one by one in this tutorial.
Installing .deb files on Ubuntu and Debian-based Linux Distributions
You can choose a GUI tool or a command line tool for installing a deb package. The choice is yours.
Let’s go on and see how to install deb files.
Method 1: Use the default Software Center
The simplest method is to use the default software center in Ubuntu. There’s nothing special to do here. Simply go to the folder where you downloaded the .deb file (usually the Downloads folder) and double click on the file.
It will open the software center, where you should see the option to install the software. All you have to do is to hit the install button and enter your login password.
See, it’s even more simple than installing from a .exe file on Windows, isn’t it?
Troubleshoot: Double clicking deb file doesn’t open in software center in Ubuntu 20.04
Double clicking the deb file in Ubuntu 20.04 opens the file in archive manager instead of software center.
This is weird but can easily be fixed. All you have to do is to right click on the deb file and go for Open With option. In here, choose open with Software Install as the default choice.
Method 2: Use Gdebi application for installing deb packages with dependencies
Again, life would be a lot simpler if things always went smoothly. But that’s not life as we know it.
Now that you know .deb files can be easily installed via the Software Center, let me tell you about the dependency error that you may encounter with some packages.
What happens is that a program may be dependent on another piece of software (such as libraries). When the developer is preparing the deb package for you, he/she may assume that your system already has that piece of software.
But if that’s not the case and your system doesn’t have those required pieces of software, you’ll encounter the infamous ‘dependency error’.
The Software Center cannot handle such errors on its own so you have to use another tool called gdebi.
gdebi is a lightweight GUI application with the sole purpose of installing deb packages.
It identifies the dependencies and tries to install these along with the .deb files.
Personally, I prefer
You can install gdebi from the software center or using the command below:
sudo apt install gdebi
Method 3: Install .deb files in command line using
If you want to install deb packages in the command lime, you can use either the apt command or the dpkg command. The apt command actually uses the dpkg command underneath it, but apt is more popular and easier to use.
If you want to use the apt command for deb files, use it like this:
sudo apt install path_to_deb_file
If you want to use the dpkg command for installing deb packages, here’s how to do it:
sudo dpkg -i path_to_deb_file
In both commands, you should replace path_to_deb_file with the path and name of the deb file you’ve downloaded.
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 remove deb packages
Removing a deb package isn’t a big deal either. And no, you don’t need the original deb file that you used to install the program.
Method 1: Remove deb packages using apt command
All you need is the name of the program that you’ve installed and then you can use apt or dpkg to remove that program.
sudo apt remove program_name
Now the question comes, how do you find the exact program name that you need to use in the remove command? The apt command has a solution for that as well.
You can find the list of all installed files with the apt command, but manually going through this will be a pain. So you can use the grep command to search for your package.
For example, I installed the AppGrid application in the previous section but if I want to find out the exact program name, I can use something like this:
sudo apt list --installed | grep grid
This will give me all the packages that have grid in their name, and from there I can get the exact program name.
apt list --installed | grep grid
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
appgrid/now 0.298 all [installed,local]
As you can see, a program called appgrid is installed. Now you can use this program name with the apt remove command.
Method 2: Remove deb packages using dpkg command
You can use dpkg to find the installed program’s name:
dpkg -l | grep grid
The output will give all the packages installed that have grid in their names.
dpkg -l | grep grid
ii appgrid 0.298 all Discover and install apps for Ubuntu
ii in the above command output means that the package has been correctly installed.
Now that you have the program name, you can use the dpkg command to remove it:
dpkg -r program_name
Tip: Updating deb packages
Some deb packages (like Chrome) provide updates through system updates, but for most other software you’ll have to remove the existing program and install the newer version.
I hope this beginner’s guide helped you install deb packages on Ubuntu. I added the