Day 7 Task: Understanding package manager and systemctl

Day 7 Task: Understanding package manager and systemctl

What is a package manager in Linux?

A Linux package manager is a tool that helps users to install, remove, update, configure, and manage software packages on their operating system.

To understand a package manager, we must understand what a package is.

What is a package?

A package is a module that can be added to any program to add additional options, features, or functionality.

A package is usually referred to as an application but it could be a GUI application, command line tool or a software library (required by other software programs). A package is essentially an archive file containing the binary executable, configuration file and sometimes information about the dependencies.

Different kinds of package managers

Package Managers differ based on the packaging system but the same packaging system may have more than one package manager.

For example, RPM(Red Hat Package Manager) has Yum(Yellowdog Updater, Modified) and DNF, package managers. For DEB, you have apt-get, aptitude command line-based package managers.

To install docker and Jenkins in our system from our terminal using package managers

Docker installation:

step 1: sudo apt update (to update the system)

step 2: sudo apt install docker.io -y

step 3: docker --version (to check the version)

step 4: systemctl status docker (to check docker is in active state or not)

Jenkin installation :

To install Jenkins,we have to install java first -

$ sudo apt update

$ sudo apt install openjdk-11-jre

$ java -version

Jenkin -

-> sudo wget -O /etc/yum.repos.d/jenkins.repo \ pkg.jenkins.io/redhat-stable/jenkins.repo

-> sudo rpm --import pkg.jenkins.io/redhat-stable/jenkins.io-202..

-> sudo dnf upgrade

# Add required dependencies for the jenkins package

-> sudo dnf install java-11-openjdk

-> sudo dnf install jenkins

systemctl and systemd

systemctl :

The systemctl command in a Linux utility is used to manage the systemd service and service manager. we can use the systemctl command to inspect and control different aspects of the systemd system, including services and daemons.

systemd :

The programs that are launched at startup are controlled by systemd, the system and service manager. systemd is the first process to run at startup.

To check the status of services , we use below command

sudo systemctl status service_name

For example - sudo systemctl status docker

To stop the services, we use below command

sudo systemctl stop service_name

For example - sudo systemctl stop jenkins

To enable the services, we use below command

sudo systemctl enable service_name

For example - sudo systemctl enable jenkins

systemctl vs service commands

The systemctl command interacts with the SystemD service manager to manage the services. Contrary to service command, it manages the services by interacting with the SystemD process instead of running the init script