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[...]
Example: apt install firefox nano

PARAMETERS

package
    One or more package names to install.

-y, --yes
    Assume 'yes' to all prompts and run non-interactively.

--no-install-recommends
    Do not install recommended packages.

--no-install-suggests
    Do not install suggested packages.

--dry-run, -s, --simulate
    Simulate an operation without making any actual changes.

--reinstall
    Reinstall packages that are already installed.

--allow-unauthenticated
    Ignore warnings about unauthenticated packages.

--allow-downgrades
    Allow installing older versions of packages.

--fix-broken
    Attempt to correct a system with broken dependencies. Often used as apt --fix-broken install.

DESCRIPTION

The apt install command is part of the Advanced Package Tool (APT), a powerful command-line utility for managing software packages on Debian-based Linux distributions like Ubuntu. It is primarily used to install new software packages, including their dependencies, from the configured repositories. When apt install is executed, it first updates its internal cache of available packages (if an apt update was recently performed), then resolves all necessary dependencies for the requested package(s), downloads them, and finally installs them onto the system. It handles complex dependency chains automatically, ensuring that all required libraries and programs are present for the installed software to function correctly. This command provides a user-friendly interface with progress bars and clear output, making package management straightforward for both new and experienced users.

CAVEATS

Requires root privileges to execute successfully; typically run with sudo.
Installing packages from untrusted sources or with --allow-unauthenticated can compromise system security.
Removing essential system packages can render your system unusable. Use with caution.
Requires an active internet connection to download packages from remote repositories.

<I>UPDATING PACKAGE LISTS</I>

Before installing new packages, it's good practice to update your local package list cache using apt update. This command fetches the latest information about available packages from all configured repositories, ensuring you can install the most recent versions.

<I>PACKAGE SOURCES</I>

APT retrieves packages from repositories defined in the /etc/apt/sources.list file and files within /etc/apt/sources.list.d/. These files specify the URLs of package archives and the distribution components (e.g., main, universe) to use.

HISTORY

The apt command was introduced as a more user-friendly and feature-rich front-end to apt-get and apt-cache. While apt-get remains important for scripting, apt provides a more interactive experience for everyday use, including progress bars, better-formatted output, and consolidated functionality. Its development aimed to simplify common tasks and improve the overall user experience of package management on Debian-based systems, building upon the robust foundation laid by apt-get since the late 1990s.

SEE ALSO

apt(8), apt-get(8), apt-cache(8), dpkg(1), sources.list(5)

Copied to clipboard