Ivy Consultants Inc.

Consulting Services for Security, Networking, Wi-Fi and Windows Server

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:

sonnyb@ubuntu-server:~$ fortune | cowsay

 _______________________________________

/ As flies to wanton boys are we to the gods; they kill us for their sport.\  

|\ -- Shakespeare, “King Lear”   /

 ---------------------------------------

      

List installed packages

You can list all install packages by using the command below:

apt list --installed

Updating Package Lists

Before installing new software or updating existing packages, it’s a good practice to update the list of available packages:

sudo apt update

Upgrading a specific package

There may be times when you only want to upgrade one specific package instead of all of your packages. You can accomplish this with the command below:

sudo apt install --only-upgrade package_name

Upgrading Installed Packages

To upgrade all your installed packages to their latest available versions, use:

sudo apt upgrade

Removing Packages

To remove an installed package:

sudo apt remove package_name

To remove a package along with its configuration files:

sudo apt purge package_name

Comparison of Package Managers

Feature / Package ManagerAPTYUMZypperPacman
Base DistributionDebian-basedRed Hat-basedopenSUSEArch Linux
Search Commandapt searchyum searchzypper searchpacman -Ss
Install Commandapt installyum installzypper installpacman -S
Update Package Listapt updateyum check-updatezypper refreshpacman -Sy
Upgrade Packagesapt upgradeyum updatezypper updatepacman -Su
Remove Packageapt removeyum removezypper removepacman -R

Verifying Your Actions

After performing any package management operation, you can verify it by checking the status of the package. For instance, to verify installation:

apt list --installed | grep package_name