Day 7: Understanding package manager and systemctl

What is a package manager in Linux?
A package manager is a software tool that helps users install, remove, update, and configure software packages on a Linux system. Package managers can be command line tools (CLI) or graphical user interface (GUI) applications.
What is a Package?
In Linux, a package is an essential compressed archive file that contains all the files that come with a software application. Packages can be:
Command-line utilities
GUI applications
Software libraries
Different kinds of package managers?
There are several package managers 📦 used in Linux to handle the installation, update, and removal of software packages. Here are some of the most common ones:
APT (Advanced Package Tool): APT is used in Debian-based distributions such as Ubuntu. It uses
.debpackages and includes tools likeapt-getandaptitudefor package management.YUM (Yellowdog Updater Modified): YUM is employed in Red Hat-based distributions like CentOS and Fedora. It uses
.rpmpackages and provides commands likeyumfor package management.DNF (Dandified YUM): DNF is the successor to YUM and is used in newer versions of Fedora and CentOS. It offers improvements over YUM in terms of performance and dependency resolution.
Pacman: Pacman is the package manager for Arch Linux and its derivatives. It uses its own package format (
.pkg.tar.xz) and provides commands likepacmanfor package management.Zypper: Zypper is used in openSUSE and SUSE Linux Enterprise. It manages packages in the
.rpmformat and offers features like package installation and dependency resolution.Snap and Flatpak: These are universal package formats that work across various Linux distributions. Snap is developed by Canonical and used in Ubuntu, while Flatpak is a cross-distribution format that can be used on multiple Linux flavors.
Each package manager has its own set of commands and features, tailored to the specific needs and package formats of the respective Linux distributions🐧.
Tasks
Installing Docker in Ubuntu
sudo apt-get update sudo apt-get install ca-certificates curl gnupg sudo install -m 0755 -d /etc/apt/keyrings curl -fsSLhttps://download.docker.com/linux/ubuntu/gpg| sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg sudo chmod a+r /etc/apt/keyrings/docker.gpgecho "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg]https://download.docker.com/linux/ubuntu"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get updatesudo apt-get install docker-ce docker-ce-clicontainerd.iodocker-buildx-plugin docker-compose-plugin




Installing Jenkins in Ubuntu
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc
https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key 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 jenkinsMake sure you have java installed in your machine.
Check the status of the docker service in your system then stop the service


systemctl vs service
The "systemctl status docker" command is used to check the status of the Docker service on a Linux system. It provides information about whether Docker is running, its current state, and any recent log messages related to Docker. Here's how to use it:
Open a terminal window.
Type the following command:
Press Enter.

The "service docker status" command is used to check the status of the Docker service on a Linux system using the
servicecommand, which is commonly used in some Linux distributions. However, the more modern and widely used command to check the status of Docker is "systemctl status docker." Here's how you can use both commands:Open a terminal window.
Type the following command:
Press Enter. This command will provide detailed information about the Docker service, including its current status, process ID, and recent log messages

This command will display information about the Docker service, including whether it is active and running, its process ID (PID), and any recent log messages that can help diagnose issues with Docker.
Please feel free to drop any queries if you have any.
Happy Learning!!!




