How to Install and Remove DEB Files on Ubuntu 26.04, 24.04 and 22.04

Install and remove local .deb files on Ubuntu 26.04, 24.04, and 22.04 with APT. Covers dpkg fallback, updates, purge, and fixes.

PublishedAuthorJoshua JamesRead time6 minGuide typeUbuntu

Downloaded Ubuntu apps sometimes arrive as .deb files instead of an APT repository, Snap, Flatpak, or AppImage. The most reliable command-line way to install deb files on Ubuntu is to let APT handle the local file, because APT can resolve dependencies from enabled package sources before it passes the package to dpkg.

The workflow is the same on Ubuntu 26.04, 24.04, and 22.04: inspect the package name, install the local file with APT, reserve dpkg for fallback use, and remove the installed package by package name rather than deleting the downloaded file.

Install Deb Files on Ubuntu

Use local .deb files only from a source you trust, such as the software vendor or project website. APT can handle dependencies and package state, but it cannot make an untrusted package safe; use upstream checksums or signatures when the project publishes them.

Ubuntu documents APT, apt-get, and dpkg for local package files. For normal interactive terminal use, start with sudo apt install ./file.deb and keep dpkg for cases where you specifically need its lower-level behavior.

Choose the Deb Installation Tool

ToolBest UseDependency Handling
APTDefault choice for installing a local .deb file from the terminalResolves needed dependencies from enabled package sources
dpkgFallback when you need direct package unpacking or diagnosticsDoes not fetch dependencies automatically
apt-getScripts and non-interactive automationSame package resolver as APT, with a stable scripting interface

Check the Deb Package Details

Open a terminal in the folder that contains the downloaded file. Most browsers save downloads under ~/Downloads:

cd ~/Downloads

List the available .deb files before installing anything:

ls -1 *.deb

Inspect the package name, version, and architecture stored inside the file:

dpkg-deb -f package-name.deb Package Version Architecture

On Ubuntu 26.04, Ubuntu’s small hello package prints package metadata in this shape:

hello
2.10-5build1
amd64

The first line is the package name you will use later with apt remove, apt purge, apt-cache policy, and package-state checks.

Install a Deb File with APT

Refresh package metadata before installing a local package so APT can resolve dependencies against current source lists:

sudo apt update

These commands use sudo because installing and removing packages changes the system package database. If your account cannot run administrative commands yet, follow the Ubuntu sudoers workflow in add a new user to sudoers on Ubuntu.

Install the file with APT from the current directory. The ./ prefix matters because it tells APT to install a local file instead of searching for a package with that literal filename in the repositories:

sudo apt install ./package-name.deb

If the file is somewhere else, provide the full path. Quotes protect filenames that contain spaces:

sudo apt install "$HOME/Downloads/package-name.deb"

For repeatable shell automation, use apt-get with the same local file syntax:

sudo apt-get install ./package-name.deb

Some vendors publish several package files that must be installed together. Keep them in the same folder and name each file explicitly so you do not accidentally install unrelated downloads:

sudo apt install ./package-one.deb ./package-two.deb

Verify the package is installed by checking for an ii state in dpkg output. Replace package-name with the package name from the earlier dpkg-deb -f check:

dpkg -l package-name | grep '^ii'

On Ubuntu 26.04, a successful installed-state line starts like this; version and description fields differ by package and release:

ii  hello          2.10-5build1 amd64        example package based on GNU hello

Use dpkg as a Fallback Method

dpkg can install the file directly, but it does not download missing dependencies. Use it when you need a direct package operation, then let APT repair dependency state if dpkg leaves the package unconfigured:

sudo dpkg -i package-name.deb

If dependency errors appear, ask APT to fix the broken state:

sudo apt --fix-broken install

APT may install the missing dependencies, or it may remove the unconfigured package if no valid dependency candidate exists. When that happens, install the local file again with APT after resolving the missing dependency source.

Update Packages Installed from Deb Files on Ubuntu

A one-time local .deb install does not automatically create a new update source. If the package also added a vendor APT source, normal Ubuntu package updates can upgrade it; otherwise, download the newer .deb file and install it with APT over the existing package.

Check which version is installed and which repository candidate, if any, APT can see:

apt-cache policy package-name

If the newer package is another downloaded file, install it the same way as the original:

sudo apt install ./newer-package-name.deb

For the broader package-maintenance workflow, including normal repository updates, use the steps in update packages via the Ubuntu command line.

Remove Packages Installed from Deb Files on Ubuntu

Deleting the downloaded .deb file only removes the installer file from your Downloads folder. The installed software remains in Ubuntu’s package database until you remove the package by name.

Find the Package Name Before Removal

If you still have the downloaded file, read the package name directly from it:

dpkg-deb -f package-name.deb Package

If the file is gone, search the installed package list by vendor, app name, or a unique word from the package name. The Ubuntu installed package list guide covers more inventory patterns when you need a broader audit.

dpkg -l | grep 'search-term'

The grep command guide is useful when you need more precise package-list filters, especially on systems with many similarly named packages.

Remove the Installed Package

Remove the package with APT so dependency state stays consistent:

sudo apt remove package-name

Verify the package no longer has an installed ii row. Put the real package name in the variable first; the fallback message prints only when grep finds no installed package line:

PACKAGE_NAME="package-name"
dpkg -l "$PACKAGE_NAME" | grep '^ii' || echo "$PACKAGE_NAME is not installed"

For a deeper removal workflow, including package-state meanings and leftover configuration handling, see remove packages on Ubuntu from the command line.

Purge Package-Owned Configuration Files

Use purge only when you intentionally want to remove package-owned configuration files. Check whether the package actually registered conffiles first:

dpkg --status package-name | grep -A100 '^Conffiles:'

If the command lists files under /etc and you no longer need that configuration, purge the package:

sudo apt purge package-name

apt purge removes package-owned system configuration files, not user profile data under your home directory. For desktop apps, remove user data only when the application’s documentation confirms the exact paths and you have backed up anything you want to keep.

Review Unused Dependencies

A local .deb file can pull dependencies from Ubuntu repositories. Preview unused packages before removing them so unrelated old kernels, desktop helpers, or packages from earlier work do not disappear by accident:

sudo apt autoremove --dry-run

If the preview lists only packages you no longer need, run the real cleanup:

sudo apt autoremove

Troubleshoot Deb File Installation on Ubuntu

APT Cannot Locate the Deb File

If APT says it cannot locate the package, check whether you forgot the local path prefix. This command searches repositories because it does not include ./ or a full path:

sudo apt install package-name.deb

APT then treats the filename as a repository package name and returns this kind of error:

E: Unable to locate package package-name.deb

Use the local path form instead:

sudo apt install ./package-name.deb

If the file is not in the current directory, confirm the path with ls or use the full location:

sudo apt install "$HOME/Downloads/package-name.deb"

Dependency Problems Appear After dpkg

A dpkg -i install can leave a package unpacked but not configured when dependencies are missing. A shortened nonliteral example looks like this; replace the package names with the exact names shown in your terminal:

dpkg: dependency problems prevent configuration of package-name:
 package-name depends on missing-package; however:
  Package missing-package is not installed.

dpkg: error processing package package-name (--install):
 dependency problems - leaving unconfigured

Repair the package state with APT:

sudo apt --fix-broken install

Then check the package database for unresolved problems:

sudo apt-get check

If APT cannot find a dependency, the package may require an Ubuntu component that is disabled, a vendor repository, or a newer Ubuntu release than your system provides.

The Package Needs Universe or Multiverse

Some third-party .deb files depend on packages from Ubuntu’s optional archive components. If APT reports that a dependency is not installable, check whether the missing package belongs to Universe or Multiverse before assuming the vendor package is broken.

The safest path is to confirm the missing dependency by name, enable only the component you need, run sudo apt update, and retry the local file install. Use enable Universe and Multiverse in Ubuntu when the error points to one of those components.

The Deb File Uses the Wrong Architecture

Architecture mismatches happen when you download an arm64, i386, or another build that does not match your Ubuntu installation. Compare the package architecture with your system architecture:

dpkg-deb -f package-name.deb Architecture
dpkg --print-architecture

On an amd64 Ubuntu installation, both lines should match:

amd64
amd64

If they do not match, download the correct build from the vendor or project. Do not force-install an architecture unless the vendor explicitly documents a multiarch setup for that package.

The Download Is Not a Deb File

APT cannot install RPM packages, AppImages, tarballs, or shell installers with the local .deb syntax. If the file ends in .rpm, use the dedicated workflow in install RPM packages on Ubuntu. If the file is an AppImage, follow install AppImage on Ubuntu instead.

Conclusion

Local deb package handling is now tied back to Ubuntu’s package database: APT installs the downloaded file, dpkg-deb identifies the real package name, and APT removes or purges it cleanly later. For regular maintenance, update packages via the Ubuntu command line and review unused dependencies before confirming cleanup.

Share this guide

Help another Linux user troubleshoot faster

Share this guide with someone troubleshooting Linux systems or saving it for later.

Follow LinuxCapable

Want more LinuxCapable guides in Google?

Add LinuxCapable as a preferred source so Google can show more of our fresh Linux tutorials in Top Stories and From your sources when relevant.

Add LinuxCapable as a preferred source on Google
Search LinuxCapable

Need another guide?

Search LinuxCapable for package installs, commands, troubleshooting, and follow-up guides related to what you just read.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffeeBuy me a coffee
Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed in published comments:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<blockquote>quote</blockquote> quote block

Got a Question or Feedback?

We read and reply to every comment - let us know how we can help or improve this guide.

Verify before posting: