Software from outside Ubuntu's repositories can arrive as a .deb file. APT can install the package from its file path and fetch missing dependencies from enabled repositories.

A local archive may still need network access for its dependencies. Packages built for a different Ubuntu release can require library versions that the enabled repositories cannot supply.

A local package can replace an installed version and run installation scripts as root. The file should come from a trusted publisher or a local build you control. A signed checksum from the publisher can help verify a download before installation.

Steps to install a local deb package on Ubuntu:

  1. Inspect the package metadata, replacing ./jq.deb with the path to your file.
    $ dpkg-deb --field \
      ./jq.deb Package \
      Version Architecture Depends
    Package: jq
    Version: 1.8.1-4ubuntu2+local1
    Architecture: arm64
    ##### snipped #####

    The ./ prefix identifies a file in the current directory. Both APT commands take the same relative or absolute path, quoted if it contains spaces. The example uses a local build of jq.

  2. Compare the archive's Architecture with Ubuntu's package architecture.
    $ dpkg --print-architecture
    arm64

    A native package should match this value, such as arm64 or amd64. A package marked all works across architectures. If a native package names a different architecture, stop and obtain the build for your system.

  3. Refresh APT's package index for dependency resolution.
    $ sudo apt update
  4. Preview the installation plan for your local file in place of ./jq.deb.
    $ sudo apt install \
      --simulate ./jq.deb
    ##### snipped #####
    Installing:
      jq
    
    Installing dependencies:
      libjq1  libonig5
    
    Summary:
      Upgrading: 0, Installing: 3, Removing: 0, Not Upgrading: 4
    ##### snipped #####
    Inst jq (1.8.1-4ubuntu2+local1 local-deb [arm64])
    ##### snipped #####

    The simulation uses sudo to read the same APT configuration as the installation. The Inst line for your package should show local-deb as its only source. Repository sources are normal for dependencies.

    APT can start installing without a prompt. Stop if the target's Inst line is missing or lists a repository, even alongside local-deb. Also stop if APT reports unmet dependencies or proposes unexpected upgrades, downgrades or removals.

  5. Install the local package using your file path in place of ./jq.deb.
    $ sudo apt install ./jq.deb
    ##### snipped #####
    Get:1 /home/user/jq.deb jq arm64 1.8.1-4ubuntu2+local1 [72.2 kB]
    ##### snipped #####

    If APT asks for confirmation, answer y only if the displayed changes match the preview. n cancels. The target package's Get: line must show the path to your file. If it shows a repository URL, APT used the repository copy, even if the version matches your file.

  6. Confirm the installation, replacing jq with the archive's Package value from step 1.
    $ dpkg -s jq
    Package: jq
    Status: install ok installed
    ##### snipped #####
    Version: 1.8.1-4ubuntu2+local1
    ##### snipped #####

    The Status should read install ok installed and the Version should match the archive's version from step 1.

Share this guide