When managing an Ubuntu Linux system, you will usually install new software by pulling it directly from the official, pre-approved software repositories using the standard apt install command (for example, sudo apt install nginx). This method is secure, fast, and handles all software dependencies automatically.
However, many commercial software developers (such as Google for Chrome, or Discord for their chat client) do not host their software in the official Ubuntu repositories. Instead, they provide a direct download link on their website for a .deb file. A .deb file (short for Debian software package) is the Linux equivalent of a Windows .exe installer or a Mac .dmg file.
How to Install a .deb File via the Terminal
If you are managing a headless server via SSH, or simply prefer the speed of the command line, you can install the downloaded .deb file using the dpkg (Debian Package) utility.
- Open your terminal.
- Navigate to the directory where you downloaded the file (usually the Downloads folder):
cd ~/Downloads
- Run the
dpkgcommand with the-i(install) flag, followed by the exact name of the file. Because installing software changes the core system, you must usesudo.
sudo dpkg -i google-chrome-stable_current_amd64.deb
- Press Enter and provide your administrator password.
The terminal will unpack the archive, extract the binaries, and install the software into the correct system directories.
How to Fix “Dependency Errors”
The biggest drawback of using the raw dpkg command is that it is quite dumb. If the Google Chrome .deb file requires a specific video decoding library to function, but that library is not currently installed on your computer, dpkg will crash mid-installation and output a terrifying red “Dependency problems” error.
Do not panic. You do not need to hunt down those missing libraries manually. You can tell Ubuntu’s smart package manager (APT) to analyze the broken installation and automatically download the missing pieces from the internet to fix it.
- Immediately after receiving the dependency error, run the following command:
sudo apt-get install -f
The -f stands for “fix broken”. APT will connect to the internet, download the missing dependencies, install them, and then automatically finish the interrupted .deb installation.
The Modern Alternative: Using ‘apt’ Directly
To avoid dependency errors entirely, modern versions of Ubuntu allow you to use the smart apt command to install local .deb files directly, bypassing dpkg. This forces the system to calculate and download missing dependencies before it attempts the installation.
To do this, you must provide the relative path to the file (using ./) rather than just the filename:
sudo apt install ./google-chrome-stable_current_amd64.deb
This is now the recommended best practice for installing downloaded packages in the Ubuntu terminal.