Package manager and systemctl

Package manager and systemctl

·

2 min read

What is a package?

A package is usually referred to 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.

What is a package manager in Linux?

In simpler words, a package manager is a tool that allows users to install, remove, upgrade, configure and manage software packages on an operating system. The package manager can be a graphical application like a software centre or a command line tool like apt-get

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 has Yum and DNF, package managers. For DEB, you have apt-get, aptitude command line-based package managers.

Docker installation on Linux

sudo apt-get update
sudo apt-get install docker.io

Jenkins installation on Linux

  • Java installation: To install Jenkins, java is a pre-requisite
sudo apt-get update
sudo apt install openjdk-11-jre

  • Jenkins installation
curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee \
  /usr/share/keyrings/jenkins-keyring.asc > /dev/null
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
  https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
  /etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkins

systemctl

systemctl is a system controller which controls all the services that are installed in the system. In the actual scenario, systemtcl works through systemd wherein 'd' stands for daemon processes( background processes running for any tool) thereby helping us to modify, update or control these tools

For example, docker tool has dockerd process running in the background, ssh has sshd proces running in the background.

The below command can be used to check the status of any service

systemctl status docker

here the systemctl accesses dockerd proccess to check the status of the service

Similarly to stop the docker service, the command below can be used

 systemctl stop docker

Service

Service can be used for the same operation as systemctl with a change in syntax.

service docker status

Systemctl vs Service

The main difference between systemctl and service is that systemctl provides an extra function of automatically re-starting the services when the system suddenly shuts down due to any unintended internal or external factors

the following command helps in automatically starting the services

systemctl enable docker