How to Install a .deb File on Ubuntu

How to Install a .deb File on Ubuntu
To install a .deb file on Ubuntu, use the command sudo apt install ./package.deb. Unlike earlier commands for installing packages, apt resolves and installs all needed dependencies automatically. This article explains why and how to handle cases where a .deb file requires certain dependencies.
How do I install a .deb file on Ubuntu from the terminal?
The answer is to run sudo apt install ./package.deb, including the ./ before the filename. Modern apt solves dependencies automatically; earlier commands did not.
$ sudo apt install ./google-chrome-stable_current_amd64.deb
It works because, according to its own man pages, apt is the more user-friendly front-end for dpkg โ it runs the same installation process but also reads the dependency list from the package and checks whether the missing dependencies are installed from configured repositories.
Why do I need the ./ before the filename?
Without the ./ prefix, apt tries to interpret the argument as a package name and fails with a "not found" error because it looks for a package with the given name in repositories, not a file on disk.
$ sudo apt install package.deb # fails - looks for a repo package
$ sudo apt install ./package.deb # works - treated as a local file
It confuses people because usually apt install accepts a package name, and a file extension makes the filename look similar enough to a package name.
The ./ (or a full path, e.g., /home/user/downloads/package.deb) tells apt to treat the argument as a file path, not a package name to find.
What's the difference between apt install ./file.deb and dpkg -i file.deb?
The dpkg -i command installs the package but does nothing about its dependencies. The apt install ./file.deb does the same installation and resolves dependencies automatically.
$ sudo dpkg -i package.deb
According to the dpkg man page, dpkg does not resolve dependencies but assumes they are satisfied. apt is a higher-level utility described in the same documentation as "the primary and more user-friendly front-end" to dpkg.
Use dpkg -i when you already know that the dependencies are installed or when you specifically troubleshoot and want the dpkg behavior without an additional layer of apt dependency resolver in the middle.
What if dpkg -i fails with missing dependencies?
If the dpkg -i command fails because of missing dependencies, follow it up with sudo apt --fix-broken install.
$ sudo dpkg -i package.deb
$ sudo apt --fix-broken install
This two-step sequence is essentially the same thing that apt install ./package.deb does in one command.
There's rarely a reason to run this manually unless you specifically troubleshoot the situation where a .deb package is already partly installed.
Can I install a .deb file from the GUI instead?
If you have a desktop environment, yes โ double-clicking a .deb file in a file manager opens it in the Software Center or a similar application.
Ubuntu Server does not include any desktop environments by default, so there's nothing to open .deb files in.
In a headless server setup, you can still use the terminal methods outlined in this article โ there's no file manager in which to double-click a file anyway.
Our VPS plans and Bare Metal servers provide full access to apt and dpkg from the terminal, so installing .deb packages not included in the default repositories works exactly as explained here.
Get started with Orbit Servers
Low-latency VPS, bare metal, and colocation across the US, EU, and APAC - provisioned instantly and built for performance-critical workloads.
Get startedRelated products
Written by
Julius