Science and technology

Linux package deal administration with apt

On Linux, package managers enable you to deal with updates, uninstalls, troubleshooting, and extra for the software program in your pc. Seth Kenlon wrote about dnf, the command-line package deal administration software for putting in software program in RHEL, CentOS, Fedora, Mageia, OpenMandriva, and different Linux distros.

Debian and Debian-based distros resembling MX Linux, Deepin, Ubuntu—and distros primarily based on Ubuntu, resembling Linux Mint and Pop!_OS—have apt, a “similar but different” software. In this text, I am going to observe Seth’s examples—however with apt—to point out you tips on how to use it.

Before I begin, I need to point out 4 apt-related instruments for putting in software program:

  • Synaptic is a GTK+ primarily based graphical consumer interface (GUI) entrance finish for apt.
  • Aptitude is an Ncurses-based full-screen command-line entrance finish for apt.
  • There are apt-get, apt-cache, and different predecessors of apt.
  • Dpkg is the “behind the scenes” package deal supervisor apt makes use of to do the heavy lifting.

There are different packaging techniques, resembling Flatpak and Snap, that you just would possibly run into on Debian and Debian-based techniques, however I am not going to debate them right here. There are additionally utility “stores,” resembling GNOME Software, that overlap with apt and different packaging applied sciences; once more, I am not going to debate them right here. Finally, there are different Linux distros resembling Arch and Gentoo that use neither dnf nor apt, and I am not going to debate these right here both!

With all of the issues I am not going to debate right here, chances are you’ll be questioning what tiny subset of software program apt handles. Well, on my Ubuntu 20.04, apt provides me entry to 69,371 packages, from the 0ad real-time technique sport of historical warfare to the zzuf clear utility fuzzer. Not dangerous in any respect.

Finding software program with apt

The first step in utilizing a package deal supervisor resembling apt is discovering a software program package deal of curiosity. Seth’s dnf article used the Cockpit server administration utility for example, so I’ll, too:

$ apt search cockpit
Sorting... Done
Full Text Search... Done
389-ds/hirsute,hirsute 1.four.four.11-1 all
  389 Directory Server suite - metapackage

cockpit/hirsute,hirsute 238-1 all
  Web Console for Linux servers

...
$

The second package deal above is the one you are after (it is the road starting with cockpit/hirsute). If you determine you need to set up it, enter:

$ sudo apt set up cockpit

apt will maintain putting in Cockpit and all of the bits and items, or dependencies, wanted to make it work. Sometimes that is all that is wanted; generally it is not. It’s doable that having a bit extra data could possibly be helpful in deciding whether or not you actually need to set up this utility.

To discover out extra a few package deal, use the apt present command:

$ apt present cockpit
Package: cockpit
Version: 238-1
Priority: optionally available
Section: universe/admin
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>
Bugs: https://bugs.launchpad.web/ubuntu/+filebug
Installed-Size: 88.1 kB
Depends: cockpit-bridge (>= 238-1), cockpit-ws (>= 238-1), cockpit-system (>= 238-1)
Recommends: cockpit-storaged (>= 238-1), cockpit-networkmanager (>= 238-1), cockpit-packagekit (>= 238-1)
Suggests: cockpit-doc (>= 238-1), cockpit-pcp (>= 238-1), cockpit-machines (>= 238-1), xdg-utils
Homepage: https://cockpit-project.org/
Download-Size: 21.three kB
APT-Sources: http://ca.archive.ubuntu.com/ubuntu hirsute/universe amd64 Packages
Description: Web Console for Linux servers
 The Cockpit Web Console permits customers to manage GNU/Linux servers utilizing a
 internet browser.
 .
 It presents community configuration, log inspection, diagnostic studies, SELinux
 troubleshooting, interactive command-line periods, and extra.

$

In explicit, discover the Description subject, which tells you extra concerning the utility. The Depends subject says what else have to be put in, and Recommends reveals what different—if any—cooperating parts are steered alongside it. The Homepage subject presents a URL in case you want extra information.

What package deal offers a file?

Sometimes you do not know the package deal title, however a file that have to be in a package deal. Seth presents for example the qmake-qt5 utility. Using apt search would not discover it:

$ apt search qmake-qt5
Sorting... Done
Full Text Search... Done
$

However, a associated command, apt-file will discover inside packages:

$ apt-file search qmake-qt5
qt5-qmake-bin: /usr/share/man/man1/qmake-qt5.1.gz
$

This turns up a person web page for qmake-qt5 that’s a part of a package deal referred to as qt5-qmake-bin. Note that this package deal title reverses the qmake and qt5 elements.

What recordsdata are included in a package deal?

That helpful apt-file command additionally tells which recordsdata are included in a given package deal. For instance:

$ apt-file listing cockpit
cockpit: /usr/share/doc/cockpit/TODO.Debian
cockpit: /usr/share/doc/cockpit/changelog.Debian.gz
cockpit: /usr/share/doc/cockpit/copyright
cockpit: /usr/share/man/man1/cockpit.1.gz
cockpit: /usr/share/metainfo/cockpit.appdata.xml
cockpit: /usr/share/pixmaps/cockpit.png
$

Note that that is distinct from the data offered by the apt present command, which lists the package deal’s dependencies (different packages that have to be put in).

Removing an utility

You can even take away packages with apt. For instance, to take away the apt-file utility:

$ sudo apt purge apt-file

Note that a superuser should run apt to put in or take away purposes.

Removing a package deal would not robotically take away all of the dependencies that apt installs alongside the best way. However, it is easy to hold out that little little bit of tidying:

$ sudo apt autoremove

Getting to know apt

As Seth wrote, “the more you know about how your package manager works, the easier it is for you to install and query applications when necessary.”

Even if you happen to’re not a daily apt consumer, figuring out it may be helpful when you want to work on the command line whereas putting in or eradicating packages (for instance, on a distant server or when following a how-to printed by some useful soul). You can also must know a bit about Dkpg (talked about above); for instance, some software program creators present a naked .pkg file.

I discover the Synaptic package deal supervisor to be a extremely great tool on my desktop, however I additionally use apt on a handful of servers that I preserve for varied functions.

Download our apt cheat sheet to get used to the command and check out some new methods with it. Once you do, you would possibly discover it onerous to make use of the rest.

Most Popular

To Top