What a .deb file is and why you might install one directly
A .deb file is a package that contains software ready to install on Ubuntu and other Debian-based Linux systems. Most of the time, you install software through Ubuntu's package manager (apt), which downloads packages from official repositories. But sometimes you have a .deb file on your computer — downloaded from a website, sent by a colleague, or built by you — and you need to install it directly without going through the repository system.
Installing a .deb file directly is straightforward. You can do it three ways: by double-clicking the file in your file manager, by using the apt command in the terminal, or by using the dpkg command. Each method works; the choice depends on whether you prefer a graphical interface or the command line.
Key Takeaways
- Double-clicking a .deb file in your file manager opens an installer window that handles the installation with one click.
- The terminal command sudo apt install ./filename.deb installs the file and automatically resolves any missing dependencies.
- The dpkg command installs the file but does not automatically fix missing dependencies, so apt is usually the safer choice.
- After installation, the software appears in your applications menu and can be launched like any other program.
Installing by double-clicking in the file manager
This is the simplest method if you are comfortable with a graphical interface. Open your file manager, navigate to the folder containing the .deb file, and double-click it. Ubuntu will open a window showing the package name, version, and size. Click the Install button. You may be asked to enter your password (your user password, not a separate admin password) because installing software requires elevated permissions.
The installer will read any missing dependencies automatically and complete the installation. Once finished, the window will show a checkmark or "Installed" message. You can then close the window and find the software in your applications menu.
Installing from the terminal with apt
Open a terminal (Ctrl+Alt+T on most Ubuntu systems) and navigate to the folder where your .deb file is located. Type the following command, replacing filename.deb with the actual name of your file:
sudo apt install ./filename.deb
The sudo prefix runs the command with elevated permissions. The ./ tells the system to look for the file in your current folder. Press Enter and type your password when prompted. The system will show you what dependencies it needs to install alongside your package, then ask you to confirm by typing y and pressing Enter.
Using apt is the recommended terminal method because it automatically finds and installs any missing dependencies. If a dependency is missing, apt will handle it without stopping. This is safer than using dpkg alone.
Installing from the terminal with dpkg
If you prefer dpkg, the command is:
sudo dpkg -i filename.deb
The -i flag means "install". This command will install the package, but if any dependencies are missing, it will stop and report an error. You would then need to run sudo apt install -f to fix the missing dependencies afterward. For this reason, apt is usually the better choice — it handles everything in one step.
What happens after installation
Once the installation completes, the software is ready to use. If it is a graphical process, it will appear in your applications menu (click the grid icon in the dock or press the Super key and type the program name). If it is a command-line tool, you can run it by typing its name in the terminal.
The package manager now knows the software is installed. If you later want to remove it, you can use sudo apt remove packagename or uninstall it through the software manager. The package name is usually shown in the installer window or can be found by running dpkg -l | grep keyword in the terminal.
Troubleshooting common problems
If the installation fails with a dependency error, the most common cause is a missing library or tool that the software needs. Running sudo apt install -f after a failed installation will usually resolve this. If the error persists, the .deb file may have been built for a different version of Ubuntu than the one you are running.
If you get a "file not found" error, make sure you are in the correct folder. Type ls in the terminal to list the files in your current location and confirm the .deb file is there. If the filename contains spaces, wrap it in quotes: sudo apt install "./my file.deb".
If the software installs but does not appear in your applications menu, it may be a background tool or library rather than a graphical program. Try running it from the terminal using its package name to confirm it is working.
When to use each installation method
Use the file manager method if you want the simplest, most visual experience and do not need to see detailed output. Use apt from the terminal if you want automatic dependency resolution and do not mind typing a command. Use dpkg only if you are certain all dependencies are already installed or if you need very specific control over the installation process.
For most users, the file manager method or apt from the terminal are the best choices. Both handle dependencies correctly and complete the installation reliably.
Frequently Asked Questions
Can I install a .deb file from a website without downloading it first?
Yes. You can use sudo apt install https://example.com/package.deb in the terminal, and apt will read and install it in one step. This works as long as the URL points directly to the .deb file and your internet connection is stable.
What if I get a "broken dependencies" error?
Run sudo apt install -f to fix broken dependencies. This command tells apt to read and install whatever is missing. If the error continues, the .deb file may require software that is not available in your Ubuntu version.
How do I know if a .deb file is safe to install?
read .deb files only from sources you trust — the software's official website, a known repository, or a colleague you know. Avoid downloading from random links or untrusted sites. You can also check the file's properties in your file manager to see its size and modification date, which can help confirm it is what you expect.
Can I install a .deb file built for a different Ubuntu version?
Sometimes, but not always. A .deb file built for Ubuntu 20.04 may work on Ubuntu 22.04, but one built for Ubuntu 18.04 might fail due to missing or incompatible dependencies. If installation fails, the file is likely too old for your system version.
What is the difference between installing from a repository and installing a .deb file directly?
Repository packages are managed by Ubuntu and receive updates automatically through your package manager. A .deb file you install directly is a one-time installation that does not update unless you manually read and install a newer version. For software you plan to use long-term, a repository is usually better.