fbpx

Package management via the Advanced Package Tool, or APT for short, is part of the recipe for success of Debian and thus also of offshoots such as Ubuntu. There are plenty of graphical interfaces for this, but APT can only take advantage of all its advantages in the shell.

Installing and updating programs from online package sources is the easiest way to equip a Linux distribution with the programs you want and to keep it up to date. What seems so natural today was not always so easy: In the early years of Linux, software installation was one of the tougher nuts that had to be cracked by manually searching for the required libraries and required programs.

The APT (Advanced Packaging Tool) package manager for the DEB format and its tools are one of the great achievements of Debian, which Ubuntu and Co. have inherited. 15 years ago, Debian was one of the first distributions to receive APT, a tool kit for searching for and installing packages from online repositories, which automatically resolves updates and package dependencies. APT is only a package manager and thus an addition to the framework of the package manager dpkg. APT has its own list of available packages from online repositories and is so convenient that Debian / Ubuntu users are more likely to come into contact with APT than with dpkg.

While beginners are well served with graphic front-ends such as Synaptic or the comparatively cumbersome Ubuntu Software Center, the command line tools apt-get and apt-cache provide many clever solutions for package management for demanding users.

Precise search: Find packages more specifically

A search in the list of available packages with the command

apt-cache search [Suchbegriff]

searches package names and their descriptions (example: apt-cache search putty ). The resulting list is long and doesn’t just contain relevant entries. This is sufficient for an initial overview, but anyone who wants to track down a specific software package needs more detailed search results. You only search in the package names and not in the descriptions

apt-cache search --names-only [Suchbegriff]

more precise. Several search terms also make a search more precise, which apt-cache automatically interprets as an AND search:

apt-cache search --names-only [Suchbegriff1] [Suchbegriff2]

Filtering the results with grep is possible, but usually not necessary.

The short description of “apt-cache search [search term]” is always very concise and not always meaningful, while the graphic tool Synaptic always provides a longer description. This description can also be used on the command line with the command apt

apt-cache show [Paketname]

recall. With APT 1.0 (from Ubuntu 14.04, Mint 17, Debian 8) simply the command is sufficient

apt show [Paketname]

out.

Needle in a haystack: A search for a single file in the available packages is possible with the additional tool apt-file, which maintains its own database.
Needle in a haystack: A search for a single file in the available packages is possible with the additional tool apt-file, which maintains its own database.

Which package exactly does the program you are looking for contain? It is not always obvious which packages and system libraries a program brings with it. Although the relationship between packages is described in detail in the APT package database, precise information on the files they contain is not stored. Therefore there is the extra tool apt-file for Debian and Ubuntu , which you should install afterwards:

sudo apt-get install apt-file

The newly installed tool has no idea about the available program packages and files, so you must first familiarize apt-file with the repositories:

sudo apt-file update

Apt-file builds its own database in which you can then use

apt-file search [Dateiname]

be able to search for the required program packages.

The most important practical tips for apt-get

When remote maintenance of servers via the network using SSH, the network connection may break off during a packet update. In unfavorable cases, only a few newer packages are installed after an interrupted upgrade and not all dependencies are resolved. By entering the command

sudo apt-get -f install

fix incomplete dependencies and bring with you

sudo apt-get dist-upgrade

the package database returns to a consistent state, so that afterwards

sudo apt-get dist-upgrade

continue the upgrade.

Always execute with sudo: This alias definition in the β€œ.bashrc” file of the shell automatically adds the required prefix sudo each time apt-get is called.

Always as root with an alias for apt-get: With an alias definition in the shell, every call of apt-get is automatically prefixed with sudo. To do this, open the “.bashrc” file in your home directory with any text editor and enter the line at the alias definitions or at the end of the file

alias apt-get="sudo apt-get"

one. The alias is available when you open a terminal window again. From now on, all apt-get commands will work even if you forgot to call them via sudo.

The new progress indicator:Β Up until now, it was not possible to predict how long the installation of the downloaded packages would take during an upgrade.Β Apt-get provides more information in the form of a new status bar in the terminal, which shows the overall progress of upgrades.Β This nice addition is supported from APT 1.0 (fromΒ UbuntuΒ 14.04,Β Linux MintΒ 17 and soonΒ DebianΒ 8) and with the additional configuration line

Dpkg::Progress-Fancy "1";

activated, which you enter at the end of the file β€œetc / apt / apt.conf.d / 99progressbar”. If the file does not yet exist, create a new one with this line.

Categories: Knowledgebase

0 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.