Linux - Apt (get)

> Procedural Languages > Bash Shell and (Unix|Linux) Utilities (XCU)

1 - About

APT is a package manager that handles installation and removal of software on Debian and other Linux distributions.

It can:

  • fetch packages from remote locations
  • build a dependency graph and retrieves, configures and installs the dependencies automatically.

2 - Client

2.1 - GUI Client

Advertising

2.2 - Command line

2.2.1 - List

apt-cache search packageName

Example:

apt-cache search confluent
confluent-camus - Camus is a Kafka to HDFS connector.
confluent-cli - Confluent Platform CLI allows you to start and manage
confluent-common - Confluent utilites for Java
confluent-control-center - Confluent Control Center provides management and monitoring of Confluent Platform services
confluent-control-center-fe - Confluent Control Center FE provides license and notice info for Confluent Control Center Front End
confluent-kafka-2.11 - publish-subscribe messaging rethought as a distributed commit log
confluent-kafka-connect-elasticsearch - Kafka Connect connector for copying data between Kafka and Elasticsearch
confluent-kafka-connect-hdfs - Kafka Connect connector for copying data between Kafka and Hadoop HDFS
confluent-kafka-connect-jdbc - Kafka Connect connector for JDBC-compatible databases
confluent-kafka-connect-replicator - Kafka Connect connector for replicating topics between Kafka clusters
confluent-kafka-connect-s3 - Kafka Connect S3 connector for copying data between Kafka and
confluent-kafka-connect-storage-common - Kafka Connect Storage Common contains packages used by storage

2.2.2 - Install

apt-get is the command line package management tool .

apt-get install packageName
#
apt-get install -y packageName
sudo apt-get install <package name>=<version>

Example:

sudo apt-get install gparted=0.16.1-1

2.2.3 - Upgrade

Upgrade install the newest versions of all packages currently installed

apt-get upgrade
Advertising

2.2.4 - Search / List the content of a package

  • List files in package <package_name>.
# dpkg -L packageName
dpkg -L confluent-kafka-connect-jdbc
/.
/usr
/usr/share
/usr/share/java
/usr/share/java/kafka-connect-jdbc
/usr/share/java/kafka-connect-jdbc/kafka-connect-jdbc-4.0.0.jar
/usr/share/java/kafka-connect-jdbc/netty-3.10.5.Final.jar
/usr/share/java/kafka-connect-jdbc/common-utils-4.0.0.jar
/usr/share/java/kafka-connect-jdbc/sqlite-jdbc-3.8.11.2.jar
/usr/share/java/kafka-connect-jdbc/zkclient-0.10.jar
/usr/share/java/kafka-connect-jdbc/slf4j-api-1.7.25.jar
/usr/share/java/kafka-connect-jdbc/zookeeper-3.4.10.jar
/usr/share/java/kafka-connect-jdbc/postgresql-9.4-1206-jdbc41.jar
/usr/share/java/kafka-connect-jdbc/jline-0.9.94.jar
/usr/share/java/kafka-connect-jdbc/log4j-1.2.17.jar
/usr/share/doc
/usr/share/doc/confluent-kafka-connect-jdbc
/usr/share/doc/confluent-kafka-connect-jdbc/changelog.Debian.gz
/usr/share/doc/confluent-kafka-connect-jdbc/copyright
/usr/share/doc/kafka-connect-jdbc
/usr/share/doc/kafka-connect-jdbc/README.md
/usr/share/doc/kafka-connect-jdbc/NOTICE
/usr/share/doc/kafka-connect-jdbc/licenses.html
/usr/share/doc/kafka-connect-jdbc/licenses
/usr/share/doc/kafka-connect-jdbc/licenses/LICENSE-postgresql-9.4-1206-jdbc41.txt
/usr/share/doc/kafka-connect-jdbc/licenses/LICENSE-sqlite-jdbc-3.8.11.2.txt.gz
/usr/share/doc/kafka-connect-jdbc/licenses/LICENSE-kafka-connect-jdbc-3.2.0-SNAPSHOT.txt.gz
/usr/share/doc/kafka-connect-jdbc/version.txt
/usr/share/doc/kafka-connect-jdbc/LICENSE.gz
/usr/bin
/etc
/etc/kafka-connect-jdbc
/etc/kafka-connect-jdbc/sink-quickstart-sqlite.properties
/etc/kafka-connect-jdbc/source-quickstart-sqlite.properties

2.2.5 - Info

2.2.5.1 - One package
# apt-cache show <package_name>
apt-cache show confluent-kafka-connect-jdbc
Package: confluent-kafka-connect-jdbc
Priority: optional
Section: misc
Installed-Size: 9146
Maintainer: Confluent Packaging <[email protected]>
Architecture: all
Version: 4.0.0-1
Depends: confluent-common
Filename: pool/main/c/confluent-kafka-connect-jdbc/confluent-kafka-connect-jdbc_4.0.0-1_all.deb
Size: 8917878
MD5sum: 9d312acfda087c2f7a8317f6027fe76b
SHA1: 0d85113391d1fcd7383c336fe0ba9aeefb1f004a
SHA256: 894b12ce324c2513fbc9303dfa6dea5933a79162f3af6ea7aa86ca9d3fa02aad
SHA512: e680bb5617e2d7f3a68103e64bb4cfc29839f067fae11c23f0fd61fe597836ba4ecc40ce7be6f2144e0a7bea7afb0c75109a61637bf3e540102065acd1962bcb
Description: Kafka Connect connector for JDBC-compatible databases
 Kafka Connect JDBC is a Kafka Connector for loading data from any JDBC-compatible
 database.
Description-md5: 7ba68366d1a2238915f77a42bfe8ca9c
Homepage: http://confluent.io
2.2.5.2 - All stats
apt-cache stats
Total package names: 54415 (1088 k)
Total package structures: 54418 (3047 k)
  Normal packages: 41922
  Pure virtual packages: 511
  Single virtual packages: 4608
  Mixed virtual packages: 572
  Missing: 6805
Total distinct versions: 44306 (3190 k)
Total distinct descriptions: 42506 (1020 k)
Total dependencies: 275593 (7717 k)
Total ver/file relations: 45985 (1104 k)
Total Desc/File relations: 42506 (1020 k)
Total Provides mappings: 8804 (176 k)
Total globbed strings: 82 (726 )
Total dependency version space: 1166 k
Total slack space: 53.0 k
Total space accounted for: 15.3 M

2.2.6 - apt-config

#apt-config is the APT Configuration Query program.
shows the configuration
apt-config dump 
APT "";
APT::Architecture "amd64";
APT::Build-Essential "";
APT::Build-Essential:: "build-essential";
APT::Install-Recommends "1";
APT::Install-Suggests "0";
APT::NeverAutoRemove "";
APT::NeverAutoRemove:: "^firmware-linux.*";
APT::NeverAutoRemove:: "^linux-firmware$";
APT::VersionedKernelPackages "";
APT::VersionedKernelPackages:: "linux-image";
APT::VersionedKernelPackages:: "linux-headers";
APT::VersionedKernelPackages:: "linux-image-extra";
APT::VersionedKernelPackages:: "linux-signed-image";
APT::VersionedKernelPackages:: "kfreebsd-image";
APT::VersionedKernelPackages:: "kfreebsd-headers";
APT::VersionedKernelPackages:: "gnumach-image";
APT::VersionedKernelPackages:: ".*-modules";
...........................
...........................
...........................
Advertising

2.3 - Configuration

/etc/apt has the apt configuration folders and files.

ls /etc/apt
apt.conf.d  preferences.d  sources.list  sources.list.d  trusted.gpg  trusted.gpg.d  trusted.gpg~

apt-config is the APT Configuration Query program.

File Description
/etc/apt/sources.list Locations / repository to fetch packages from. See source
/etc/apt/sources.list.d/ Additional source list fragments.
/etc/apt/apt.conf APT configuration file.
/etc/apt/apt.conf.d/ APT configuration file fragments.
/etc/apt/preferences version preferences file. see pinning
/var/cache/apt/archives/ storage area for retrieved package files.
/var/cache/apt/archives/partial/ storage area for package files in transit.
/var/lib/apt/lists/ storage area for state information for each package resource specified in sources.list
/var/lib/apt/lists/partial/ storage area for state information in transit.

3 - Source

A source (package repository) is a directory containing packages along with an index file.

The Debian project keeps a central repository of over 25,000 software packages.

The lists of available packages are fetched from the location(s) specified in /etc/apt/sources.list.

cat /etc/apt/sources.list
deb http://deb.debian.org/debian jessie main
deb http://deb.debian.org/debian jessie-updates main
deb http://security.debian.org jessie/updates main
deb [arch=amd64] http://staging-confluent-packages-4.0.0.s3.amazonaws.com/deb/4.0 stable main

4 - Pinning

APT pinning control which sources should be preferred. You give a preference to get certain packages from a separate source or from a different version of a distribution.

The configuration file is: /etc/apt/preferences

5 - Documentation / Reference