Understanding package manager and systemctl

Understanding package manager and systemctl

What is a package📦🐧?

A Software Package📦 is a compressed archive that has all the necessary files required to run an app. There is also a high chance that the app depends on other apps (meaning the app has dependencies). So, to run the app, dependencies need to be installed too and this is exactly the first issue faced by almost every beginner when he moves from Windows💻 to some Linux Distribution💻

What are package managers in Linux?

In Linux a package is a compressed software archive file that contains all the files that comes with a software application that delivers any kind of functionality, this can be any kind of command line utility, GUI application or software library.

Experienced Linux users will very rarely download software from websites or any other location. The primary reasons for this included aspects such as ease of use, security and the fact that most Linux distributions have a list of sources where users can download free open-source software packages.

To check whether APT Package Manager is installed on your distribution,

The tool for downloading, installing and updating software in Linux is termed a Package Manager*.*

Different kinds of package managers

The package usually includes a manifest of dependencies that must be satisfied for a software application to execute as expected on any given Linux computer

Common Package Managers in Linux include:

  • dpkg (Debian Package Manager)

  • APT (Advanced Package Tool)

  • rpm (RedHat Package Manager)

  • yum (Yellowdog Update Modified)

  • dnf (Dandified Yum)

  • Homebrew

  • zypper

  • flatpak

  • pacman

  • snap

  • synaptic

Packages also contain scripts that need to be executed if a package is requested to be removed. Ensuring that everything that is associated with the execution of the package is cleared up.

To Install Jenkins & Docker

To install docker-:

Docker is an application that simplifies the process of managing application processes in containers.

step 1:

Check if the system is up-to-date.

sudo apt update

install docker

#sudo apt install <software package name>
sudo apt install docker.io

Check the installed version of the docker

docker --version

Install Jenkins using the package manager

Jenkins is an open-source automation server that automates the repetitive technical tasks involved in the continuous integration and delivery of software.Jenkins requires the Java Runtime Environment (JRE).

First, add the repository key to your system:

wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key |sudo gpg --dearmor -o /usr/share/keyrings/jenkins.gpg

The gpg --dearmor command is used to convert the key into a format that apt recognizes.

Next, let’s append the Debian package repository address to the server’s sources.list:

sudo sh -c 'echo deb [signed-by=/usr/share/keyrings/jenkins.gpg] http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

After both commands have been entered, run apt update so that apt will use the new repository.

sudo apt update

Finally, install Jenkins and its dependencies:

sudo apt install jenkins

now that Jenkins is installed, start it by using systemctl:

What is systemctl?

The systemctl command is a systemd utility used to manage services, get information about service unit files and service states, and therefore a useful utility to know for managing services on the server while systemd is an array of components for Linux OS.

sudo systemctl start jenkins.service

Since systemctl doesn’t display status output, we’ll use the status command to verify that Jenkins started successfully:

sudo systemctl status jenkins

What is Systemd?

Systemd is an init system used in Linux distributions to bootstrap user space components and manage system processes

Systemctl and Systemd

systemctl and service are both command-line tools used for managing services in Linux systems.
The systemctl command manages both system and service configurations, enabling administrators to manage the OS and control the status of services. systemctl is useful for troubleshooting and basic performance tuning.
The service command starts, stops, and restarts a daemon or service by calling the script. Usually, all scripts are stored in /etc/init. d directory. It runs a script in as predictable an environment as possible.

Managing Services Starting, stopping, restarting, and reloading services Service statuses.

Check the status of the docker service🐳🔍 in your system

🔴🔵Stop the service Jenkins and post before and after screenshots

sudo systemctl status jenkins.service

sudo systemctl start jenkins.service

To stop the service we write:

sudo systemctl stop jenkins.service

Usually, after changing a configuration for a service we need to restart it, with systemctl, we restart the service as follows:

sudo systemctl restart jenkins.service

Enabling and disabling services🤔

Sometimes we use services frequently so it is convenient to start the service automatically immediately the system boots up.
For this we use enable with systemctl:

For example, to start Jenkins service every time the system boots up we write:

sudo systemctl enable jenkins.service
sudo systemctl disable jenkins.service

Thanks for reading my article. Have a nice day**❤️**.

I hope you enjoyed reading this blog. I have one request to all: give it a try on your own with some complicated scenarios like having permutations and combinations of permissions 😂. It'll definitely be helpful in your entire career.

Subscribe to my newsletter by visiting my site and also have a look at the consolidated list of all my blogs.

Cheers!