Level 1
0 / 100 XP

Installing and Managing Packages

In this lesson, you'll learn about package management in Linux, focusing on the apt package manager. By the end of this lesson, you'll understand how to search for, install, update, and remove packages using apt. Additionally, we'll briefly compare apt with other popular package managers, highlighting their similarities and differences.

Understanding Package Managers in Linux

Package managers are tools that automate the process of managing software on your Linux system. They handle the installation, updating, configuration, and removal of software packages. Each Linux distribution tends to favor a specific package manager, though they generally perform similar functions. The most common package managers include:

  1. APT (Advanced Package Tool) : Used in Debian and Debian-based distributions like Ubuntu.
  2. YUM (Yellowdog Updater, Modified) : Utilized in Red Hat and Red Hat-based distributions like CentOS.
  3. Zypper : The package manager for openSUSE.
  4. Pacman : Designed for Arch Linux.

These package managers differ mainly in their commands and package repositories but share the common goal of simplifying software management.

Working with apt in Ubuntu and Debian

Searching for Packages

To search for a package in the apt repository, use the command:

apt search package_name

Replace package_name with the name or description of the software you're looking for. Search for the package named cowsay.

Installing Packages

To install a package, the command is:

sudo apt install package_name

In this example, we will install the package cowsay:

sudo apt install cowsay

Also install the package named fortune, then you can pipe fortune to cowsay and get output like the following:

Text
paulh@ubuntu-server:~$ fortune | cowsay _______________________________________ / As flies to wanton boys are we to the \\ | g…