Advanced Packaging Tool

From XennisWiki
Jump to: navigation, search

The 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 the Debian Linux distribution and its variants. APT simplifies the process of managing software on Unix-like computer systems by automating the retrieval, configuration and installation of software packages, either from precompiled files or by compiling source code. (Wikipedia)

Manage packages

Install packages

Install two packages

apt-get install PACKAGE1 PACKAGE2

Uninstall packages

Remove or purge a package

apt-get remove PACKAGE1
apt-get purge PACKAGE1

Purge all files starting with PACKAGE1 (e.g. PACKAGE1-lib)

apt-get purge PACKAGE1\*

Search a package

apt search SEARCH-STRING

History

The update history is logged in the history.log file, which is usually located in /var/log/apt/history.log.

Upgrade packages

Upgrade system

apt-get upgrade

Simulate upgrade system

apt-get upgrade --simulate

Autoremove and autoclean

apt-get autoremove
apt-get autoclean

Manage repositories (add-apt-repository)

Add a repository

Add a repository and install a package from this repository

add-apt-repository ppa:n-muench/programs-ppa
apt-get update
apt-get install filezilla

Remove a repository

add-apt-repository --remove ppa:n-muench/programs-ppa

Add a repository link

First download and add the key of the repository. Then add the repository deb http://example.org/apt/ trusty-pgdg main to the file postgresql.list

echo "deb http://example.org/apt/ trusty-pgdg main" | sudo tee -a /etc/apt/sources.list.d/postgresql.list

It's recommended to install the package apt-transport-https and use HTTPS instead of HTTP, if available.

Update source and upgrade system

sudo apt-get update
sudo apt-get upgrade

Manage keys (apt-key)

Add a key

Download the key.asc file and add this key.

curl https://example.org/apt-key.gpg| sudo apt-key add -

List keys

apt-key list

Remove a key

Remove the key with the id 1024D/98AB5139

apt-key del 1024D/98AB5139

Errors and problems

Errors were encountered while processing: unattended-upgrades

Error message
Errors were encountered while processing: unattended-upgrades
Solution
apt-get upgrade --fix-missing

See also

External links