Unix Package Management

Master Unix package management with our comprehensive guide. Learn about software installation, package management tools, and best practices for efficient system administration
E
Edtoks3:40 min read

Package management tools are essential components of Unix-like operating systems, and they are used for installing, updating, and managing software packages. Two widely used package management tools in Unix are apt (Advanced Package Tool) used in Debian-based systems like Ubuntu and yum (Yellowdog Updater Modified) used in Red Hat-based systems like CentOS and Fedora. Let's explore these tools in detail with examples:

apt (Advanced Package Tool):

1. Installing Packages:

To install a package using apt, use the install command followed by the package name.

sudo apt install package_name

Example: To install the nginx web server:

sudo apt install nginx

2. Updating Package Lists:

To update the local package database, use the update command.

sudo apt update

3. Upgrading Installed Packages:

To upgrade all installed packages to their latest versions, use the upgrade command.

sudo apt upgrade

4. Searching for Packages:

To search for a package by name, use the search command.

apt search package_name

Example: To search for packages related to Python:

apt search python

5. Removing Packages:

To remove a package without removing its configuration files, use the remove command.

sudo apt remove package_name

To completely remove a package and its configuration files, use purge.

sudo apt purge package_name

yum (Yellowdog Updater Modified):

1. Installing Packages:

To install a package using yum, use the install command followed by the package name.

sudo yum install package_name

Example: To install the httpd web server:

sudo yum install httpd

2. Updating Package Lists:

yum automatically updates its package list when you run commands, so there's no separate command like apt update.

3. Upgrading Installed Packages:

To upgrade all installed packages to their latest versions, use the update command.

sudo yum update

4. Searching for Packages:

To search for a package by name, use the search command.

yum search package_name

Example: To search for packages related to PHP:

yum search php

5. Removing Packages:

To remove a package without removing its configuration files, use the remove command.

sudo yum remove package_name

To completely remove a package and its configuration files, use erase.

sudo yum erase package_name

6. Cleaning Package Cache:

To clean the yum cache and free up disk space, use the clean command.

sudo yum clean all

Package Management Summary:

  • Both apt and yum are command-line package management tools.

  • They handle software installation, updates, and removal.

  • They automatically resolve dependencies, ensuring that all required packages are installed.

  • Configuration files are often retained when removing packages to prevent data loss.

  • Package management tools play a crucial role in maintaining system stability and security by keeping software up to date and managing dependencies.

It's important to note that while apt is commonly used in Debian-based systems (e.g., Ubuntu), yum is commonly used in Red Hat-based systems (e.g., CentOS, Fedora). Familiarity with these tools is essential for system administrators and users of Unix-like operating systems to efficiently manage software packages on their systems.

/

Let's keep in touch!

Subscribe to keep up with latest updates. We promise not to spam you.