Linux команда apt install

Package management with APT

IconsPage/apt.png

Package management via apt-get runs hand-in-hand with the /etc/apt/sources.list file. For information on editing or updating your sources list see SourcesList.

Introduction

This page describes how to handle the packages on your system using apt-get and related commands. For example, you can install a new package, remove an installed package, or update all installed packages to the latest versions.

Commands

IconsPage/example.png

  • Example:
sudo apt-get install ubuntu-desktop

Installation commands

IconsPage/note.pngUse the -s flag to simulate an action. For example: «apt-get -s install » will simulate installing the package, showing you what packages will be installed and configured.

auto-apt

IconsPage/example.png

This command runs under the control of auto-apt. If a program tries to access a file known to belong in an uninstalled package, auto-apt will install that package using apt-get. This feature requires apt and sudo to work.

  • Auto-apt keeps databases which need to be kept up-to-date in order for it to be effective. This is achieved by calling the commands auto-apt update, auto-apt updatedb and auto-apt update-local.
  • Usage example
    • You’re compiling a program and, all of a sudden, there’s an error because it needs a file you don’t have. The program auto-apt asks you to install packages if they’re needed, stopping the relevant process and continuing once the package is installed.

    Maintenance commands

    The same as the above, except add the «smart upgrade» checkbox. It tells APT to use «smart» conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones if necessary.

    IconsPage/note.png«apt-get dist-upgrade» does not upgrade from a previous version of Ubuntu. For more information of upgrading from a previous version of Ubuntu see http://www.ubuntu.com/getubuntu/upgrading .
    du -sh /var/cache/apt/archives

    IconsPage/example.png

    Reconfigure the named package. With many packages, you’ll be prompted with some configuration questions you may not have known were there.

    • For example:
    dpkg-reconfigure fontconfig-config
    echo " hold" | dpkg --set-selections
    IconsPage/info.pngThis command may have the unintended side effect of preventing upgrades to packages that depend on updated versions of the pinned package. apt-get dist-upgrade will override this, but will warn you first. If you want to use this command with sudo, you need to use echo " hold" | sudo dpkg --set-selections not sudo echo " hold" | dpkg --set-selections.
    echo " install" | dpkg --set-selections

    Removal commands

    IconsPage/example.png

    This command completely removes a package and the associated configuration files. Configuration files residing in ~ are not usually affected by this command.

  • Оцените статью
    Adblock
    detector