Difference between revisions of "APT"

From wikieduonline
Jump to navigation Jump to search
Line 14: Line 14:
 
* <code>apt-cache policy</code><ref>http://manpages.ubuntu.com/manpages/xenial/man8/apt-cache.8.html#options</ref> List source repository configured included priorities of each source.
 
* <code>apt-cache policy</code><ref>http://manpages.ubuntu.com/manpages/xenial/man8/apt-cache.8.html#options</ref> List source repository configured included priorities of each source.
 
* <code>[[apt-cache showpkg]] PACKAGE_NAME</code>. See also: <code>apt show PACKAGE_NAME</code><code>dpkg -s PACKAGE_NAME</code>
 
* <code>[[apt-cache showpkg]] PACKAGE_NAME</code>. See also: <code>apt show PACKAGE_NAME</code><code>dpkg -s PACKAGE_NAME</code>
* <code>apt-cache show PACKAGE_NAME</code>
+
* <code>[[apt-cache show]] PACKAGE_NAME</code>
  
 
== Relevant configuration files and directories ==
 
== Relevant configuration files and directories ==

Revision as of 07:06, 22 December 2019

Advanced Package Tool, or APT, is a free software user interface that works with core libraries to handle the installation and removal of software on Debian, Ubuntu and other Linux distributions. Main Advanced Package Tool (APT) binaries are: apt, apt-get and apt-cache

Basic apt-get/apt commands

  • Installing: apt install PACKAGE_NAME
  • apt show PACKAGE_NAME or aptitude show PACKAGE_NAME
  • apt policy PACKAGE_NAME [1] Provides source repository for a given package.
  • apt-get update && apt-get upgrade
  • Showing pending to update packages: apt-get upgrade --dry-run or apt-get upgrade -s
    • /usr/lib/update-notifier/apt-check --human-readable

Basic apt-cache commands

  • apt-cache search
  • apt-cache policy[2] List source repository configured included priorities of each source.
  • apt-cache showpkg PACKAGE_NAME. See also: apt show PACKAGE_NAMEdpkg -s PACKAGE_NAME
  • apt-cache show PACKAGE_NAME

Relevant configuration files and directories

  • /etc/apt/sources.list[3]: Configuration files with locations to fetch packages from.
  • /etc/apt/sources.list.d/: directory with additional source list fragments.

Updates

  • To collect information about what installed packages can be upgraded:
    • apt update
    • apt list --upgradable
    • apt-get upgrade --dry-run or apt-get upgrade -s
    • apt update && apt upgrade
  • To upgrade all installed packages: apt upgrade
  • apt dist-upgrade (see also /do-release-upgrade/)
  • apt /Automatic updates/

Holding packages

To avoid packages from being upgrade when upgrading use apt-mark command

  • apt-mark hold PACKAGE_NAME
  • apt-mark unhold PACKAGE_NAME
  • apt-mark showhold[4]

Single upgrade

  • To upgrade only a package: apt-get install --only-upgrade PACKAGE_NAME

Activities

  1. Read differences between apt upgrade and apt dist-upgrade: https://unix.stackexchange.com/a/304887
  2. Read Linux server administration/apt/Automatic updates
  3. Install software-properties-common package[5] to be able to use apt-add-repository Python command available since 2004.

See Also

Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.

Original Source: https://en.wikiversity.org/wiki/Linux_server_administration/apt

Advertising: