A downloaded .deb file is an installable package, not an application you can run directly. On Ubuntu or Debian, the simplest way to install one is with apt and a path to the file:
sudo apt install ./package.deb
The ./ matters: it tells apt to use a local file instead of searching for a repository package with that name. apt can also resolve dependencies from your configured repositories, so this is usually the best starting point.
Install the package with apt
If the file is in your Downloads directory, move there first:
cd ~/Downloads
sudo apt install ./package.deb
Replace package.deb with the actual filename. You can also provide the full path instead of changing directories:
sudo apt install /home/you/Downloads/package.deb
If a filename contains spaces, quote the path:
sudo apt install "./my package.deb"
Review the packages apt proposes to install or change, then confirm if the list looks right. If you see an “Unable to locate package” error, check that you included ./ or supplied a full path. Without a path, apt may interpret the argument as a package name rather than a local file.
For other Ubuntu installation problems, the error message often points to the right next check; this Ubuntu installation troubleshooting guide covers common failure stages.
When to use dpkg instead
dpkg installs a local package at a lower level:
sudo dpkg -i package.deb
Unlike apt, dpkg does not fetch missing dependencies from repositories. If it reports dependency problems, let apt try to resolve them:
sudo apt install -f
That asks apt to inspect the incomplete package state, install available dependencies, and finish configuring packages where possible. For a routine manual install, apt install ./package.deb is simpler because it handles installation and dependency resolution together.
Use dpkg when you specifically need the lower-level operation, such as in a script or while diagnosing a package. If you install several local packages with it, dependencies may still need attention afterward:
sudo dpkg -i ./*.deb
sudo apt install -f
Only run the second command if needed to fix dependency issues.
Diagnose common install errors
The package architecture does not match
A package built for one CPU architecture generally will not run correctly on another. Check your system’s package architecture with:
dpkg --print-architecture
Then look for a matching build from the software vendor. Don’t force an architecture mismatch just to get the installation to proceed.
A newer version is already installed
The file you downloaded may be older than the version already installed. Check the package’s installed state using its package name:
dpkg -l packagename
The package name is not necessarily the same as the .deb filename. Confirm that replacing the installed version is what you intend before continuing.
Dependencies are missing after dpkg
If you used dpkg -i and saw a message such as dependency problems prevent configuration, try:
sudo apt install -f
If a required dependency is not available from your configured repositories, you may need to obtain it from a trusted source or use another supported installation method.
Ubuntu and Debian share the DEB package format and use apt and dpkg; package availability can still vary with the repositories configured on each system. Other distributions use different package-management tools—for example, Fedora uses DNF, as described in this overview of Fedora package management.
Verify or remove the installed package
To check whether a package is installed, query it by package name:
dpkg -l packagename
To remove it while keeping its configuration files:
sudo apt remove packagename
To remove the package and its configuration files as well:
sudo apt purge packagename
Use remove if you may reinstall the package and want to retain its settings. Use purge when you want its configuration files removed too.
A note about trust
Installing a .deb package can run scripts with root privileges. That gives the package broad access to the system during installation. Download packages only from the software vendor’s official site or another source you trust, and review what apt plans to change before confirming.
For most local installs, the command to remember is:
sudo apt install ./package.deb
Use a local path, let apt handle dependencies, and treat packages from outside your distribution’s repositories with the same care as any software running with elevated privileges.
I originally published a more detailed version of this guide on the SSHFlow blog.
I'm also building SSHFlow — an SSH client where every server gets its own workspace for terminals, SFTP, code, and databases.
Top comments (0)