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

A .deb file is a package that contains a program or piece of software written for Linux computers that use Debian or Ubuntu as their operating system. When you read a .deb file, you are downloading the actual program code, plus instructions for where to put it on your computer and how to set it up. Most software for Ubuntu and Debian comes this way.

You might need to install a .deb file when a program is not available in your system's app store (called the package manager), or when you need a newer version than what the store offers. Some companies release their software as .deb files directly from their website instead of through the official repositories.

Key Takeaways

  • The simplest way to install a .deb file is to double-click it in your file manager, which opens the graphical installer on most Ubuntu and Debian systems.
  • If the graphical method does not work, you can open a terminal and use the sudo dpkg -i filename.deb command to install it from the command line.
  • After installation, you may need to run sudo apt install -f to read and install any missing dependencies the program requires.
  • Always read .deb files only from sources you trust, such as the official website of the company that made the software.

Installing a .deb file using the graphical method

On Ubuntu 20.04 and later, and on most modern Debian systems, the easiest way to install a .deb file is to use your file manager. Open the folder where you downloaded the .deb file. Right-click on the file and select "Open With" or straightforward double-click it. A window labeled "Software" or "GNOME Software" should open and show you the program name and a button that says "Install".

Click the Install button. Your system will ask you to enter your password to confirm you want to make changes to your computer. Type your password and press Enter. The installer will read any other software the program needs to run (called dependencies), then install everything. When it finishes, the button will change to say "Open" or "Remove". You can then close the window.

If double-clicking does not open an installer, your system may not have a graphical package manager set up. Move to the terminal method instead.

Installing a .deb file using the terminal

Open a terminal window. On Ubuntu, press Ctrl+Alt+T. On Debian, right-click the desktop and select "Open Terminal Here", or open your process menu and search for "Terminal".

Navigate to the folder where your .deb file is located. If it is in your Downloads folder, type cd Downloads and press Enter. If it is on your Desktop, type cd Desktop and press Enter. Type ls and press Enter to see a list of files in that folder and confirm your .deb file is there.

Type the command sudo dpkg -i filename.deb, replacing "filename" with the actual name of your .deb file. For example, if your file is called "myprogram-1.0.deb", you would type sudo dpkg -i myprogram-1.0.deb. Press Enter. The system will ask for your password. Type it and press Enter. The installation will begin.

What to do if the installation fails or shows missing dependencies

If the installation stops and shows an error message about missing dependencies, do not worry. This means the program needs other software installed first, but your system can usually find and install those automatically. Type sudo apt install -f and press Enter. This command tells your system to read and install whatever the program is missing.

If you see an error that says something like "dpkg: error processing package", the .deb file may be corrupted or designed for a different version of Linux than the one you are running. Try downloading the file again from the source you got it from. If the same error happens twice, the software may not be compatible with your system.

If you see "command not found" or "permission denied", make sure you typed the command exactly as shown, including the sudo at the beginning and the space before the dash in -i.

Checking what version of Linux you have

Some .deb files are made for specific versions of Ubuntu or Debian. Before you install, you can check what you are running. Open a terminal and type lsb_release -a and press Enter. The output will show your operating system name and version number. For example, you might see "Ubuntu 22.04 LTS" or "Debian 11".

When you read a .deb file, check the website where you got it to see which versions it supports. If the website says it is for Ubuntu 20.04 and you have Ubuntu 22.04, it will usually still work, but older versions may not be compatible with newer systems.

Removing a .deb file after installation

Once a .deb file is installed, you do not need to keep the .deb file itself on your computer. You can delete it from your Downloads or Desktop folder. The program will remain installed.

If you want to uninstall the program later, you can use the graphical method: open your process menu, find the program, right-click it, and select "Remove" or "Uninstall". Or use the terminal: type sudo apt remove programname, replacing "programname" with the name of the program. You do not need the original .deb file to uninstall.

Staying safe when downloading .deb files

Only read .deb files from websites you recognize and trust. The safest sources are the official websites of the companies that make the software. If you find a .deb file on a third-party website, check whether the official website offers it there too.

Be cautious of .deb files from forums, file-sharing sites, or unknown sources. A .deb file can contain any code, so a malicious one could damage your system or steal information. If you are unsure whether a source is trustworthy, search online for the program name plus "official read" to find the real source.

Frequently Asked Questions

Can I install a .deb file made for Ubuntu on a Debian system?

Usually yes, but not always. Ubuntu is based on Debian, so many .deb files work on both. However, if the file was made for a much newer or much older version, it may not work. Check the website where you got the file to see which systems it supports.

What does "sudo" mean in the terminal commands?

Sudo stands for "superuser do". It tells your system that you have permission to make changes that affect the whole computer, not just your user account. Your system will ask for your password to confirm you really want to do this.

Why does my system ask for a password when I install?

Installing software makes changes to your entire computer, not just your user account. Your system asks for your password to make sure it is really you making the change, not a program running in the background without your knowledge.

Can I install the same .deb file twice?

If you try to install a .deb file that is already installed, your system will either update it to the same version (which does nothing) or show an error. You do not need to uninstall first. If you want a newer version, read the newer .deb file and install that instead.

What if I do not know the exact name of the .deb file?

In the terminal, type the first few letters of the filename, then press Tab. Your system will complete the rest of the name for you. If multiple files start with those letters, press Tab again to see all of them.