Close Menu
    Facebook X (Twitter) Instagram
    Command Linux
    • About
    • How to
      • Q&A
    • OS
      • Windows
      • Arch Linux
    • AI
    • Gaming
      • Easter Eggs
    • Statistics
    • Blog
      • Featured
    • MORE
      • IP Address
      • Man Pages
    • Write For Us
    • Contact
    Command Linux
    Home - How to - How to Apt Install Specific Version on Debian-Based Systems

    How to Apt Install Specific Version on Debian-Based Systems

    WillieBy WillieFebruary 18, 2026Updated:March 24, 2026No Comments3 Mins Read

    Package managers on Ubuntu and Debian grab the latest release by default. Sometimes that’s not what you want. You may need an older build or a version tied to a specific dependency chain. The apt install specific version command lets you pick exactly which build goes on your machine. This guide covers checking available versions, installing the right one, and locking it so future updates don’t overwrite your choice.

    Why You Would Apt Install Specific Version

    A newer release can break compatibility with your stack. Your deployment pipeline may require a fixed build that passed QA. On older servers, a dated package might be the only option that avoids unwanted upgrades. If you’re new to Debian-based package management, the apt-get command reference is a good starting point.

    Update Your Package Index

    Pull the latest metadata from your configured repositories first:

    sudo apt update

    Skipping this step can cause version lookups to return stale or incomplete results.

    Check Available Versions

    Use apt-cache policy to list every obtainable build. Replace nginx with your target package:

    apt-cache policy nginx
    FieldMeaning
    InstalledThe build currently on your machine (or “none”)
    CandidateThe default build apt would grab
    Version tableAll obtainable builds with priority scores

    Apt Install Specific Version of a Package

    Pass the exact build string with an equals sign:

    sudo apt install nginx=1.20.2-1ubuntu2

    Copy the version string character-for-character from apt-cache policy output. The general syntax:

    sudo apt install package-name=version-string

    Hold the Package to Block Automatic Upgrades

    After you apt install specific version, a routine apt upgrade can overwrite it. Lock the package with apt-mark:

    sudo apt-mark hold nginx

    To allow upgrades again later:

    sudo apt-mark unhold nginx

    Verify the Build and Troubleshoot Problems

    Run apt-cache policy nginx to confirm the “Installed” line matches your target build. If something went wrong:

    ProblemFix
    Version not foundRun sudo apt update. The version may live in a repo you haven’t enabled.
    Dependency conflictsTry sudo aptitude install package=version for alternative resolution.
    Pinned priority blockingForce with sudo apt install package=version --allow-downgrades.

    Tips Before You Start

    Back up your system before swapping builds. For programming libraries, tools like virtualenv or conda isolate dependencies without touching system packages. See the dpkg man page for lower-level inspection, and if apt isn’t working, check the guide on fixing apt-get command not found.

    FAQs

    Can I install multiple specific package versions at once?

    Yes. Separate each pair with a space: sudo apt install pkg1=version1 pkg2=version2. Fails if any package has unmet dependencies.

    Does apt install specific version work the same as apt-get?

    Yes. Both accept package=version syntax and behave identically for pinned installs.

    How do I downgrade a package to an older version?

    Use sudo apt install package=older-version. Add --allow-downgrades if apt blocks the operation.

    What if the version I need is not in any repository?

    Add a PPA or third-party repo that carries it, or download the .deb file and install with sudo dpkg -i package.deb.

    Will holding a package cause problems during system upgrades?

    Held packages are skipped during upgrades. This can trigger dependency warnings. Monitor holds with apt-mark showhold.

    Willie
    • Website

    Willie has over 15 years of experience in Linux system administration and DevOps. After managing infrastructure for startups and enterprises alike, he founded Command Linux to share the practical knowledge he wished he had when starting out. He oversees content strategy and contributes guides on server management, automation, and security.

    Related Posts

    How to Prepare a Linux Mint Live USB

    April 17, 2026

    How To Take Screenshot on Linux

    April 15, 2026

    How to Use the Linux Restart Command to Reboot Your Server

    April 15, 2026

    How To Run A Shell Script In Linux

    April 13, 2026
    Top Posts

    How to Check Linux Version

    April 9, 2026

    TCPTRACEROUTE

    April 17, 2026

    sensors

    January 22, 2026

    ZLIB

    March 17, 2026
    • Home
    • Contact Us
    • Privacy Policy
    • Terms of Use

    Type above and press Enter to search. Press Esc to cancel.