DAY -7 Understanding Package Managers in Linux

DAY -7 Understanding Package Managers in Linux

ยท

4 min read

Introduction:

Welcome to Day 7 of the #90DaysOfDevOps challenge! In today's blog, we'll delve into the world of package managers and their indispensable tools, APT (Advanced Package Tool) ๐Ÿ› ๏ธ and YUM (Yellowdog Updater Modified) ๐Ÿ› ๏ธ. Additionally, we'll explore the significant role played by systemctl and systemd in managing services on a Linux system.

Our primary focus for this session will be on the installation of Docker ๐Ÿณ and Jenkins ๐Ÿ—๏ธ using these powerful package managers. So, let's dive right in and explore the wonders of software management in the DevOps world!

What is a package and Package Manager in Linux?

In the vast realm of Linux, efficient software management is crucial for a smooth and seamless user experience. Package managers are the backbone of this process, enabling users to effortlessly install, update, and maintain various software packages. These packages are collections of software bundled together with essential metadata, including version details and dependencies, ensuring a hassle-free software deployment. Package maintainers play a crucial role in maintaining these packages, guaranteeing that the software remains up-to-date and fully functional.

In this blog, we will delve into two popular package managers in the Linux world - APT (Advanced Packaging Tool) and YUM (Yellowdog Updater, Modified). We will explore their functionalities and commands, as well as gain an understanding of the powerful systemd and systemctl for managing system services. Additionally, we will demonstrate how to install Docker and Jenkins using these package managers, bringing the theory into practical application.

APT (Advanced Packaging Tool)

APT is a robust and widely-used command-line package management system, serving as a front-end for the dpkg package management system. It is prevalent in Debian-based distributions such as Ubuntu and Linux Mint, making software management a breeze with its user-friendly commands.

To install a package using APT, execute the following command in the terminal: Command apt-get install package_name

Keeping your system up-to-date is crucial for security and performance reasons. To update the packages on your system, run the following commands:

sudo apt-get update
sudo apt-get upgrade

To remove a package, simply use the following command:

sudo apt-get remove package_name

YUM (Yellowdog Updater, Modified)

YUM is another widely-used open-source command-line package manager that operates with the RPM (Red Hat Package Manager) format. It is common in RPM-based distributions like Red Hat Enterprise Linux (RHEL) and CentOS, providing functionalities similar to APT but with different commands.

To install a package using YUM, use the following command:

sudo yum install package_name

Keeping your packages up-to-date is crucial, and YUM simplifies this process with the following command:

sudo yum update

To remove a package using YUM, use the following command:

sudo yum remove package_name

Understanding systemd and systemctl :

Systemd is a powerful software suite designed to unify service configuration and behavior across various Linux distributions. Its primary component is a "system and service manager," serving as an init system to manage user processes and bootstrap the user space. Systemctl, a command-line utility, interacts with systemd, enabling users to efficiently manage system and service configurations.

Systemctl offers administrators extensive control over services, including checking service statuses, starting, stopping, enabling, or disabling them. This streamlined management ensures better control over the operating system and enhances system reliability.

TASK -1 Installing Docker using Package Managers

Now, let's put our knowledge of package managers and systemctl into action by installing Docker and Jenkins on a Linux machine using APT.

Step 1: Update the packages using APT:

sudo apt update

Step 2: Install Docker on Ubuntu using APT:

sudo apt-get install docker.io -y

Step 3: Check the version of Docker:

sudo docker --version

TASK -2 Install Jenkins on Ubuntu using APT:

Step 1: Install Jenkins using the below command:

sudo apt-get install Jenkins

Step 2: Start Jenkins service:

sudo systemctl start jenkins

Step 3: Enable Jenkins to start on system boot:

sudo systemctl enable jenkins

Stopping the Jenkins Service:

To halt the Jenkins service, execute the following command:

sudo systemctl stop jenkins

The service will no longer be running on your system until you start it again.

Task -3 Difference between service and systemctl

The primary difference between the 'service' and 'systemctl' commands lies in their functionalities. 'service' is a high-level command used for starting, restarting, stopping, and checking the status of services in Unix and Linux systems.

On the other hand, 'systemctl' is more powerful, allowing you to perform a broader range of tasks related to system and service configurations.

Conclusion:

In conclusion, package managers are indispensable tools in the Linux ecosystem, simplifying the installation, updating, and removal of software packages. APT and YUM are two prominent package managers used in Debian-based and RPM-based distributions, respectively. Additionally, systemd and systemctl provide a standardized approach to managing system services, fostering consistency across Linux distributions. By leveraging these powerful tools, users can efficiently manage software installations and system services on their Linux machines, contributing to a smooth and productive computing experience.

ย