Local .deb files bypass repository signing unless you trust the vendor. Prefer official repos and PPAs you verify. After dpkg -i, always run dependency fix — half-installed packages break apt.
What you will achieve
Install a downloaded Debian package on Ubuntu or Debian with apt install ./file.deb or dpkg -i, resolve missing dependencies, and remove cleanly when no longer needed.
1) Preferred method: apt with local file
sudo apt install ./package_1.0_amd64.deb
The ./ prefix is required — apt treats it as a local package path and automatically resolves dependencies from configured repositories. This is the method Debian and Ubuntu docs recommend over raw dpkg.
2) Alternative: dpkg then fix-broken
sudo dpkg -i package_1.0_amd64.deb
sudo apt --fix-broken install
If dpkg stops with unmet dependencies, the second command pulls required libraries from repos. Never leave apt in a broken state.
3) Inspect before installing
dpkg-deb -I package_1.0_amd64.deb
dpkg-deb -c package_1.0_amd64.deb | head
Check version, architecture (amd64 vs arm64), and files it will drop on disk.
4) Verify package contents on system
dpkg -L packagename
dpkg -s packagename | grep -E '^Status|^Version'
5) Remove cleanly
sudo apt remove packagename
sudo apt purge packagename # removes config files too
purge when you want no leftover config in /etc.
6) Multiple local debs with dependencies
sudo apt install ./libfoo_1.deb ./app_2.deb
Apt orders installation by dependency graph — handier than chaining dpkg calls.
7) When version conflicts repo package
sudo apt install ./custom-nginx.deb
apt policy nginx
Locally installed version may pin ahead of repo. Hold if needed: sudo apt-mark hold nginx. Document why — future apt upgrade may try to downgrade.
8) Audit half-installed state
dpkg --audit
sudo apt --fix-broken install -s
Run after any failed local install. -s simulates the fix — review before applying on production package sets.
Prerequisites
Trusted .deb from vendor, matching architecture (amd64/arm64), and working APT sources for dependency resolution.
Verify
dpkg -l | grep packagename
sudo apt --fix-broken install
apt list --installed packagename
No broken packages in dpkg --audit output. Application binary runs and reports expected version.