Day 7 : Understanding package manager and systemctl

Day 7 : Understanding package manager and systemctl

What is a package manager in Linux?

A package manager in Linux is a set of software or tools that allows the user to manage packages effectively. The user can install, upgrade, remove, and configure packages using the supported package manager on the Linux operating system.

It comes automates the above operations. Package managers are a fundamental component of most Linux distributions and play a crucial role in making software installation and management more efficient and reliable.

Common package managers in Linux include:

APT (Advanced Package Tool): Used in Debian and Ubuntu-based distributions.
YUM (Yellowdog Updater, Modified): Used in Red Hat and CentOS-based distributions.
DNF (Dandified YUM): An improved version of YUM, used in newer Red Hat distributions.
RPM Package Manager: Created by Red Hat. RPM is the Linux Standard Base packaging format and RPM have YUM and DNF package managers.

What is a package?

Package is the collection of software applications, metadata, descriptions and essential files for software installation and management on the system. It could be a GUI application, command line tool or a software library.

A package is essentially an archive file containing the binary executable, configuration file and sometimes information about the dependencies.

Task : You have to install docker and jenkins in your system from your terminal using package managers.

  1. Update your Linux system.

    Here sudo apt-get update command is used to update the process and packages in Linux system, where sudo - represents run as administrator/superuser.

  2. Install docker in your system.

We used sudo apt-get install docker command to install docker in our terminal.

So, as a devops engineer you can install, remove or update any packages.

  1. To install jenkins on our terminal.

    For that, we need to install Java as pre-requisties as Jenkins is a java based application.

    -use sudo-apt get update to update system followed by :

    now to do version check whether java is installed or not:

And finally just use the below command which you can get from official jenkins website.

curl -fsSL https://pkg.jenkins.io/debian/jenkins.io.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 binary/ | sudo tee \   /etc/apt/sources.list.d/jenkins.list > /dev/nullsudo apt-get update sudo apt-get install jenkins

Start jenkins

sudo systemctl enable jenkins
sudo systemctl start jenkins
sudo systemctl status jenkins

Now see the status of jenkins after running all above commands: which should be running.

Systemctl and systemd :

The systemctl command is a command-line utility that interacts with the systemd system and service manager. It is the primary tool used to control and manage systemd services, allowing users to start, stop, enable, disable, and check the status of services.

Some common systemctl commands include:

  • Start a service:- systemctl start SERVICE_NAME

  • Stop a service:- systemctl stop SERVICE_NAME

  • Restart a service:- systemctl restart SERVICE_NAME

  • Enable a service to start at boot:- systemctl enable SERVICE_NAME

  • Disable a service from starting at boot:- systemctl disable SERVICE_NAME

  • Check the status of a service:- systemctl status SERVICE_NAME

  • List all running services:- systemctl list-units –type=service

Systemd is an init system used in Linux distributions to bootstrap user space components and manage system processes. It was designed to overcome the limitations of traditional init systems, such as SysV and Upstart, and to simplify the process of managing system services.

Here ends up the day7. Hope you enjoyed reading it out and it adds some knowledge to you.

Thanks

#day7 #linux #devops