How to Install a .deb Package on Ubuntu
Ubuntu, like other Debian-based systems, uses .deb
files as the standard package format. While most software is installed via apt
or the Ubuntu Software Center, sometimes you may need to install software manually using a .deb
file you downloaded from a website or built yourself.
In this article, we’ll cover how to install .deb
packages using the GUI and command line, how to resolve dependencies, and best practices for safe installation.
1. What Is a .deb
Package?
A .deb
file is a Debian Software Package. It includes all the files, metadata, and scripts necessary to install and manage software on Debian-based systems like Ubuntu.
2. Installing via the GUI (Ubuntu Software)
If you’re using Ubuntu Desktop:
- Double-click the
.deb
file. - Ubuntu Software will open and show an Install button.
- Click Install and enter your password.
✅ Best for beginners and simple apps
⚠️ Sometimes fails if dependencies are missing
3. Installing via dpkg
(Low-Level CLI Tool)
dpkg
is a low-level tool that directly installs .deb
packages without checking for missing dependencies.
sudo dpkg -i ./example-package.deb
To fix missing dependencies after this step:
sudo apt-get install -f
Great for scripted installs Will fail if dependencies are missing (until you run apt install -f)
Installing via apt (Recommended)
The apt tool can install local .deb packages and resolve dependencies automatically.
sudo apt install ./example-package.deb
Note: You must include ./ or an absolute path; otherwise, apt will look in remote repos. ✅ Safest and most reliable method ✅ Automatically resolves and installs dependencies
Checking If a Package Is Installed
To verify installation:
dpkg -l | grep package-name
To check which files were installed:
dpkg -L package-name
Uninstalling a .deb Package
To remove a package:
sudo apt remove package-name
To purge configuration files too:
sudo apt purge package-name
Common Errors and Fixes
❌ dpkg: error processing package (...)
Run:
sudo apt install -f
❌ Unable to locate package ./example.deb
Make sure to include ./ in the file path.
❌ Dependency is not satisfiable: libxyz
Either install the required dependency manually or use apt which handles it automatically.
Automating .deb Installation (Optional)
For scripts or Dockerfiles:
curl -O <https://example.com/package.deb>
sudo apt install ./package.deb -y
Or using gdebi (optional tool for advanced handling):
sudo apt install gdebi
sudo gdebi ./example-package.deb
When Not to Use .deb Files
If the package is already in Ubuntu’s apt repositories If the .deb file is from an untrusted source If the package offers a Snap, Flatpak, or AppImage alternative that updates automatically
- Summary
Method | Dependency Handling | Recommended For |
---|---|---|
GUI | ❌ | Beginners |
dpkg | ❌ (manual fix) | Advanced scripting |
apt | ✅ | Most users |
gdebi | ✅ (optional) | Desktop + GUI fallback |
Further Reading
Need to automate .deb installs across machines or deploy in CI/CD pipelines? Consider wrapping your install steps with apt and verifying checksum signatures for safety.