What a .deb file is and why you might need one

A .deb file is a package that contains a program or tool ready to install on Linux systems that use Debian or Ubuntu. When you download software for Linux, you will sometimes get a .deb file instead of an installer like you would on Windows or Mac. The file holds the program code, configuration files, and instructions for where everything should go on your computer.

You might need to install a .deb file when a program is not available in your system's app store, when you need a specific version that is not in the standard repositories, or when a developer gives you the file directly. The process is straightforward once you know which method to use.

Key Takeaways

  • The graphical method (double-clicking the .deb file) works on most modern Ubuntu and Debian systems and requires no terminal knowledge.
  • The terminal method using dpkg -i filename.deb gives you more control and shows you exactly what is happening during installation.
  • If installation fails because of missing dependencies, use apt install -f to fix broken packages automatically.
  • Always download .deb files from sources you trust, since packages can contain any code the creator put inside them.

Installing a .deb file using the graphical method

On Ubuntu 20.04 and newer, and on most modern Debian systems, you can install a .deb file by opening your file manager, finding the .deb file, and double-clicking it. A window will open showing the package name, version, and an "Install" button. Click that button, enter your password when prompted, and the system will install the package.

This method works because your system has a graphical package manager set up to handle .deb files automatically. It is the simplest approach if you are comfortable using a file manager. The downside is that if something goes wrong, you see less detail about what happened. If the installation fails, the error message may not tell you exactly why.

Installing a .deb file using the terminal

Open a terminal and navigate to the folder where your .deb file is located. If the file is on your Desktop, you can type cd Desktop. Then run this command, replacing filename.deb with the actual name of your file:

sudo dpkg -i filename.deb

The system will ask for your password. Type it and press Enter. The dpkg tool will unpack the file and install the package. You will see text output showing what is being installed. This method gives you full visibility into what is happening and works on any Debian or Ubuntu system, even older ones.

What to do if installation fails due to missing dependencies

Sometimes a .deb file depends on other packages that are not yet installed on your system. When this happens, dpkg will show an error message listing the missing packages and refuse to complete the installation. This is a safety measure — the program will not work without those dependencies.

To fix this, run this command in the terminal:

sudo apt install -f

This tells the system to download and install whatever packages are needed to make the broken installation complete. After it finishes, the original program should be installed and ready to use. If you used the graphical method and got a dependency error, open a terminal and run the same apt install -f command to resolve it.

Checking if installation worked

After installation completes, you can verify that the package is installed by running this command in the terminal:

dpkg -l | grep packagename

Replace packagename with part of the program's name. If the package is installed, you will see a line with "ii" at the start, which means "installed". If nothing appears, the installation did not complete.

You can also look for the program in your applications menu. Most installed programs will appear there automatically after installation. If it does not show up, the program may not have created a menu entry, but it is still installed and can be run from the terminal by typing its command name.

Understanding what you are installing

Before you install any .deb file, take a moment to think about where it came from. A .deb package can contain any code the creator put into it, so only install files from sources you recognize and trust. If a friend sends you a .deb file, or you find one on a website you have never heard of, be cautious. Stick to official project websites, well-known repositories, or your system's built-in app store when possible.

You can inspect what is inside a .deb file before installing it by running dpkg -c filename.deb in the terminal. This shows you a list of all the files that will be installed and where they will go. This does not tell you what the code does, but it shows you the scope of what is being added to your system.

Removing a .deb package you no longer want

If you install a .deb package and later decide you do not want it, you can remove it using the graphical method or the terminal. In the graphical method, open your system's app store or package manager, find the program in the installed list, and click the remove or uninstall button.

From the terminal, run:

sudo apt remove packagename

Replace packagename with the name of the package. You can find the exact package name by running dpkg -l | grep followed by part of the program's name. The system will remove the program but usually leave its configuration files behind in case you reinstall it later. If you want to remove those files too, use sudo apt purge packagename instead.

Frequently Asked Questions

Can I install a .deb file meant for Ubuntu on Debian, or vice versa?

Usually yes, because both systems use the same package format and share most of the same libraries. However, if the .deb file was built for a much older or newer version of the system, it may not work. Start with the graphical method or terminal method and see if it installs. If you get a dependency error, the package may not be compatible with your version.

What does "sudo" mean in the terminal commands?

The sudo prefix means "run this command as the administrator." Installing packages requires administrator permission because they affect the whole system, not just your user account. When you type sudo, the system asks for your password to confirm you have permission to make changes.

Why does the graphical method sometimes not work?

On older Ubuntu and Debian systems, or on systems with minimal desktop environments, the graphical package manager may not be installed or may not be set up to handle .deb files. In those cases, the terminal method with dpkg -i will always work. You can also try right-clicking the .deb file and looking for an "Open With" option to choose a package manager manually.

Is it safe to install .deb files from the internet?

It is as safe as downloading any software from the internet. Only install .deb files from official project websites, well-known Linux repositories, or sources you trust. Avoid .deb files from unknown websites or unsolicited downloads. If you are unsure about a file, search for the project name online to find its official source.