Day 7 - Package Manager And systemctl

What is a Package Manager in Linux?
A package manager in Linux is a software tool or system that helps users and administrators manage software packages, including their installation, removal, updating, and dependencies. It simplifies the process of installing and maintaining software on a Linux system by providing a centralized and organized way to handle software distribution.
What is a package?
A "package" typically refers to a pre-compiled software bundle that contains all the necessary files, resources, and metadata required for the installation, configuration, and management of a software application or library. These packages are organized and maintained by the Linux distribution or package manager to simplify the process of installing and maintaining software on a Linux system.
Types of Package Managers
Package managers come in various flavors, and their usage can differ based on the packaging system used by a specific Linux distribution. To further complicate matters, the same packaging system might have multiple package managers. Here are a few examples:
1. RPM-based Package Managers:
Yum: Yum is a popular package manager used in RPM-based distributions like CentOS and Red Hat Enterprise Linux.
DNF: DNF is the next-generation package manager that succeeded Yum and is commonly used in modern RPM-based distributions.
2. DEB-based Package Managers:
apt-get: Apt-get is a command-line package manager for DEB-based distributions, such as Ubuntu and Debian.
aptitude: Aptitude is another command-line package manager that offers enhanced functionality over apt-get.
Installing Docker and Jenkins Using Package Managers
On Ubuntu:
1. Install Docker: Open your terminal and run the following commands-
sudo apt-get update
sudo apt-get install docker.io
2. Install Jenkins: To install Jenkins on Ubuntu, use the following commands:
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins
On CentOS:
- Install Docker: On CentOS, Docker can be installed using the following commands:
sudo yum install docker
sudo systemctl start docker
sudo systemctl enable docker
2. Install Jenkins: To install Jenkins on CentOS, run the following commands:
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
sudo yum install jenkins
sudo systemctl start jenkins
sudo systemctl enable jenkins
Exploring systemctl and systemd
systemctl: This command is used to examine and control the state of the "systemd" system and service manager. It allows you to start, stop, restart, enable, and disable services on your Linux system.
systemd: systemd is a system and service manager that has become the standard for Unix-like operating systems, with widespread adoption across various Linux distributions. It provides a robust and efficient way to manage services, logging, and system initialization.
System Service Management
To check the status of the Docker service in your system, use the following command:
sudo systemctl status docker
To stop the Jenkins service and capture before and after screenshots, use the following commands:
sudo systemctl stop jenkins
# Capture screenshots here
sudo systemctl start jenkins
# Capture screenshots again


