Day 7 : Understanding package manager and systemctl

Day 7 : Understanding package manager and systemctl

1. What is a package manager in Linux?

A package management system or package manager is a group of software tools. It automates the installation process, upgrading process, configuration process, and removal process of the computer programs for an operating system of the computer efficiently. A package manager works with packages, data within archive files, and software distributions.

2. What is a package?

A package in Linux is a compressed software archive file containing all the files included with a software application that provides any functionality.

Packages include metadata like the name of the software, description of its objective, checksum, dependency list, vendor, and version number essential for the software to properly run.

3. Different kinds of package managers:

Linux Distribution

Linux Package Manager

REHL

Yum

Ubuntu / Debian

Apt

Arch

Pacman

Gentoo

Portage

Zyper

Open Suse

1. DPKG (Debian Package Management System): Dpkg is a base package management system for the Debian Linux family, it is used to install, remove, store, and provide information about .deb packages.

APT is a dependency resolver for Debian-based systems, including Ubuntu. In conjunction with dpkg, the package manager, APT provides an easy way to update, upgrade, install, and remove software.

2. RPM (Red Hat Package Manager): RPM is the Linux Standard Base packing format and a base package management system created by RedHat.

YUM is a dependency resolver for the underlying package manager, RPM. YUM is the default package management system in several Red Hat-based derivatives.

1.Install docker and Jenkins in your system from your terminal using package managers

A. Installing docker on Ubuntu:

  1. Update the system first by using the below command:

    sudo apt-get update

  2. Instal docker using the command given:

    sudo apt install docker.io -y

  3. Install the dependencies using the below command

    sudo snap install docker

  4. To check if docker is installed and running, run the following command:

    sudo systemctl status docker

B. Installing Jenkins on Ubuntu:

Step 1: Install Java

Jenkins requires the Java Runtime Environment (JRE).

1. Depending on which Java version you want to install, Java 8 or 11, run one of the following commands

To install OpenJDK 8, run - sudo apt install openjdk-8-jdk -y

To install OpenJDK 11, run - sudo apt install openjdk-11-jdk -y

Step 2: Add Jenkins Repository

1. Start by importing the GPG key. The GPG key verifies package integrity but there is no output.

curl -fsSL pkg.jenkins.io/debian-stable/jenkins.io.key | sudo tee /usr/share/keyrings/jenkins-keyring.asc > /dev/null

2. Add the Jenkins software repository to the source list and provide the authentication key:

echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null

Step 3: Install Jenkins

1. Update the system repository

sudo apt update

2. Install Jenkins by running:

sudo apt install jenkins -y

3. To check if Jenkins is installed and running, run the following command:

sudo systemctl status jenkins

2.systemctl and systemd:

The systemctl command in a Linux utility is used to manage the systemd service and service manager.
systemd is an init system and system manager. It runs with PID 1 and it is the one responsible for starting the rest of the system.

3.Difference between systemctl and service :

The systemctl command interacts with the systemd service manager to manage the services.

In service command, it manages the services by interacting with the systemd process instead of running the init script.

The syntax for systemctl and service is as shown below:

  1. To check Jenkins status syntax using systmectl: systemctl status jenkins

  2. To check Jenkins status syntax using service: service jenkins status