Day 7 Task: Understanding package manager and systemctl

Day 7 Task: Understanding package manager and systemctl

Day 7 of 90daysofdevops

What is 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 in an efficient manner. A package manager works with packages, data within archive files, and software distributions.

Packages include metadata like the name of the software, description of its objective, checksum (a cryptographic hash function preferably), dependency list, vendor, and version number essential for the software to properly run.

What is Package

A package is a collection of files and information that is bundled together to install or distribute software. Each package contains the files needed to install and run a particular piece of software, as well as information about dependencies and installation instructions.
Linux packages can take various formats depending on the package manager and distribution. For example, Debian-based distributions such as Ubuntu use .deb packages, while Red Hat-based distributions such as Fedora use .rpm packages

Different Kind of Package Manager

  1. YUM An old-time RPM font-end favorite, known and understood by many but slowly being replaced by DNF.

  2. APT A popular DPKG front-end with a complete dependency resolution and package management.

  3. Pacman A popular Arch-Linux package manager that allows using a pre-built package or build-it-yourself.

  4. Zypp/Zypper A popular front-end to RPM used in OpenSUSE and SUSE Linux Enterprise. Zypper is knowns for its SAT solver, a fantastic dependency issue solution.

  5. DNF The popular replacement for yum. It is now the default package manager in Fedora 22 and Red Hat Linux 8.

  6. Gentoo’s Portage Portage provides a fantastic way to manage packages to one of the most flexible yet challenging Linux distributions.

  7. Honorable Mentions We add three honourable mentions to our best Linux Package manager list: eoPKG, NIX, and Snap.

Install Docker

Remove any docker fine running in the system

sudo apt-get remove docker docker-engine docker.io

Check if the system is up-to-date.

sudo apt-get update

Install Docker

sudo apt install docker.io

Install all the dependency packages

sudo snap install docker

Check the installed version of docker

docker --version

Install Jenkins

Jenkins requires the Java Runtime Environment (JRE).

Install JAVA

sudo apt install openjdk-11-jdk -y

It is recommended to install Jenkins using the project-maintained repository, rather than from the default Ubuntu repository. The reason for that is because the Jenkins version in the default Ubuntu repository might not be the latest available version, which means it could lack the latest features and bug fixes.

Add the Jenkins repository key: To ensure that the Jenkins package comes from a trusted source, add the Jenkins repository key to your system with the following command.

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

Add the Jenkins repository to your system:

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'

Update your package manager's cache:

sudo apt update

Now Install Jenkins after successfull installation of JAVA in your system

sudo apt install jenkins

After installation, start the Jenkins service and check status:

sudo systemctl start jenkins
sudo systemctl status jenkins

Opening the Firewall

sudo ufw allow 8080
sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status

systemctl and systemd

The systemctl command manages both system and service configurations, enabling administrators to manage the OS and control the status of services. Further, systemctl is useful for troubleshooting and basic performance tuning.

systemd is a suite of basic building blocks for a Linux system. It provides a system and service manager that runs as PID 1 and starts the rest of the system.

Check the status of docker service in your system

systemctl status docker

Stop the service jenkins and post before and after screenshots

sudo systemctl status jenkins

sudo systemctl stop jenkins

Read about the commands systemctl vs service

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, stop and restart a daemon or services by calling the script. Usually, all scripts are stored in /etc/init. d directory. It runs a script in as predictable environment as possible.

systemctl status jenkins

service jenkins status

Thankyou for reading!! many more in a queue

~Nikunj Kishore Tiwari

Great initiative by the #trainwithshubham community. Thank you Shubham Londhe for Guiding Us.

#devops #90daysofdevops #allaboutdevops #linux