LinuxCommandLibrary

apt-install

Install software packages

TLDR

Install a package, or update it to the latest version

$ sudo apt install [package]
copy

Display verbose package version information during installation or update
$ sudo apt install [[-V|--verbose-versions]] [package]
copy

SYNOPSIS

apt install [options] package [{package}/...] [version]

PARAMETERS

-d, --download-only
    Download packages to cache without installing

-f, --fix-broken
    Fix broken dependencies before installing

-s, --simulate
    Simulate actions without changes (dry-run)

-y, --assume-yes
    Automatically answer 'yes' to prompts

--dry-run
    Simulate full installation process

--no-install-recommends
    Skip installing recommended packages

--install-recommends
    Install recommended packages (default)

--no-install-suggests
    Skip installing suggested packages

--reinstall
    Reinstall packages even if already present

-t, --target-release RELEASE
    Install from specific release

--allow-downgrades
    Allow downgrading packages

--ignore-missing
    Ignore missing packages

-m, --ignore-missing
    Ignore uninstalled dependencies

--allow-change-held-packages
    Allow changes to held packages

-h, --help
    Show help message

--version
    Show version information

DESCRIPTION

The apt install command is a high-level tool for installing software packages on Debian-based Linux distributions like Ubuntu. It resolves dependencies automatically, downloads packages from configured repositories, and configures them post-installation.

Unlike lower-level tools like dpkg, apt install fetches missing dependencies and handles version conflicts intelligently. It supports installing multiple packages at once, specific versions, or virtual packages. By default, it installs recommended but not suggested packages for a complete setup.

Usage typically requires superuser privileges via sudo. It's designed for interactive use with progress indicators and confirmation prompts, making it user-friendly. For automation, flags like -y bypass prompts.

It integrates with the APT package management system, ensuring system consistency by upgrading or removing obstructing packages when needed.

CAVEATS

Requires sudo for root privileges; run apt update first for fresh package lists. May remove conflicting packages; use --no-remove if needed. Not for non-Debian systems.

EXAMPLES

sudo apt install vim
sudo apt install nginx=1.18.0-*
sudo apt install --reinstall firefox

EXIT CODES

0: OK; 100: All packages up-to-date; 4: Config error; 10+: Errors in processing

HISTORY

Introduced in Ubuntu 16.04 (2016) as a user-friendly replacement for apt-get install. Developed by Ubuntu team to simplify syntax and add progress bars. Backported to Debian 10+.

SEE ALSO

apt-get(8), apt-cache(8), dpkg(8), aptitude(8), apt-mark(8)

Copied to clipboard