Updated: 9 October 2026 · Applies to: Debian 13 (apt 3.0.3, tested), Ubuntu 24.04 (apt 2.8.3, tested) and Ubuntu 26.04 (apt 3.2.0, tested); the same commands apply to Linux Mint 22 (Ubuntu 24.04 base)

To install a .deb file on Debian or Ubuntu, run sudo apt install ./package.deb in the folder that holds the file. The ./ (or a full path such as /home/user/Downloads/package.deb) tells apt it is a local file, and apt then downloads any missing dependencies from your repositories. The older way is sudo dpkg -i package.deb followed by sudo apt install -f; gdebi is a third option.

For software that is already in the Debian or Ubuntu repositories you do not need a .deb file at all. The install command is:

sudo apt update
sudo apt install jq

Use apt search keyword to find a package name and apt show name to read its description and version.

Method 1: apt install ./file.deb (recommended)

  1. Open a terminal in the folder with the file, for example cd ~/Downloads.
  2. Install it with a path. Here a test package hello-json that needs jq was installed on Debian 13; apt took the package from the local file and its three dependencies from the Debian mirror:
    $ sudo apt install ./hello-json_1.0_all.deb
    Installing:
      hello-json
    
    Installing dependencies:
      jq  libjq1  libonig5
    
    Summary:
      Upgrading: 0, Installing: 4, Removing: 0, Not Upgrading: 1
      Download size: 436 kB / 437 kB
      Space needed: 1271 kB / 34.9 GB available
    
    Get:1 /root/debs/hello-json_1.0_all.deb hello-json all 1.0 [768 B]
    Get:2 http://deb.debian.org/debian trixie/main amd64 libonig5 amd64 6.9.9-1+b1 [189 kB]
    ...
    Setting up jq (1.7.1-6+deb13u4) ...
    Setting up hello-json (1.0) ...
    Ubuntu 24.04 (apt 2.8) prints the older style ("The following NEW packages will be installed:") but works the same way.
  3. Check it: dpkg -l hello-json shows ii (installed) in the first column.

Without ./, apt looks for a package with that name in the repositories and fails: Error: Unable to locate package jq_1.7.1-6+deb13u4_amd64.deb.

Method 2: dpkg -i, then fix dependencies

dpkg installs exactly the file you give it and never downloads anything. If a dependency is missing, the package stays unpacked but not configured:

$ sudo dpkg -i jq_1.7.1-6+deb13u4_amd64.deb
Unpacking jq (1.7.1-6+deb13u4) ...
dpkg: dependency problems prevent configuration of jq:
 jq depends on libjq1 (= 1.7.1-6+deb13u4); however:
  Package libjq1 is not installed.

dpkg: error processing package jq (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 jq

dpkg -l jq now shows iU (unpacked, not configured). Let apt fetch the missing packages and finish the job:

$ sudo apt install -f
...
Setting up libonig5:amd64 (6.9.9-1+b1) ...
Setting up libjq1:amd64 (1.7.1-6+deb13u4) ...
Setting up jq (1.7.1-6+deb13u4) ...

apt install -f is the same as apt --fix-broken install.

Method 3: gdebi

gdebi is a small tool that installs a local .deb and its dependencies. It is in the repositories of Debian 13 and Ubuntu 26.04 (gdebi-core 0.9.5.8) and Ubuntu 24.04 (0.9.5.7):

sudo apt install gdebi-core
sudo gdebi hello-json_1.0_all.deb

gdebi lists the dependencies it will add and asks first:

Requires the installation of the following packages: jq libjq1 libonig5 

test package that needs jq
Do you want to install the software package? [y/N]:

-n (--non-interactive) skips the question. On a desktop, the gdebi package adds the graphical version (gdebi-gtk).

Check a .deb file before installing it

$ dpkg -I jq_1.7.1-6+deb13u4_amd64.deb
 new Debian package, version 2.0.
...
 Package: jq
 Version: 1.7.1-6+deb13u4
 Architecture: amd64
 Depends: libc6 (>= 2.38), libjq1 (= 1.7.1-6+deb13u4)
...

dpkg -I shows the version, architecture and dependencies; dpkg -c file.deb lists the files it will install. Only install .deb files from the vendor or a source you trust: the package scripts run as root.

Remove a package installed from a .deb

sudo apt remove hello-json     # keeps configuration files
sudo apt purge hello-json      # also removes configuration files
sudo apt autoremove            # removes dependencies nothing else needs

dpkg -r name and dpkg --purge name also work, but dpkg refuses to remove a package that another one needs (dpkg: dependency problems prevent removal of jq: hello-json depends on jq.) and never cleans up dependencies.

How to download a Debian package

  • One package, current version: apt download jq saves jq_1.7.1-6+deb13u4_amd64.deb in the current folder. Run as root in /root, apt warns Download is performed unsandboxed as root ...; the download still works.
  • A package plus the dependencies this system is missing: sudo apt-get install --download-only jq stores the files in /var/cache/apt/archives/ and installs nothing.
  • Everything for an offline machine (same release and architecture):
    apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances jq | grep "^\w" | sort -u)
    On Debian 13 this downloaded six files (jq, libjq1, libonig5, libc6, libgcc-s1, gcc-14-base). Copy them to the offline machine into a folder everyone can read, such as /tmp/offline, and run sudo apt install ./*.deb there, or sudo dpkg -i *.deb. Both worked in our test with the network cut. From /root apt failed with File not found - /root/offline/jq_1.7.1-6+deb13u4_amd64.deb (13: Permission denied), because apt's download user _apt cannot read that folder.
  • From a browser: search on packages.debian.org, open the package for your release (trixie is Debian 13) and pick your architecture in the "Download" table at the bottom. The download page shows the file size, the SHA256 checksum and the mirror links; it also suggests using a package manager instead of downloading by hand where you can.

To download or install an older or specific version, see how to install a specific package version on Ubuntu and Debian.

Installing a Debian package on Ubuntu

Ubuntu uses the same .deb format, so the commands are the same. A package built for Debian only installs if Ubuntu can satisfy its exact dependencies. The Debian 13 build of jq failed on Ubuntu 24.04:

$ sudo apt install ./jq_1.7.1-6+deb13u4_amd64.deb
The following packages have unmet dependencies:
 jq : Depends: libjq1 (= 1.7.1-6+deb13u4) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Install Ubuntu's own package instead (sudo apt install jq), or the vendor's .deb for Ubuntu if there is one. Do not force it with dpkg -i --force-depends: dpkg then installs jq without libjq1, and apt refuses every later install with E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). until you remove it. A vendor .deb that lists both Debian and Ubuntu as supported is fine on either.

Related articles

Official documentation: apt(8) and dpkg(1) on manpages.debian.org.

Ucartz services for this topic

Was this answer helpful? 0 Users Found This Useful (0 Votes)