Day 7 Task: Understanding package manager and systemctl

Package Manager:
Linux has several package managers that are used to install and manage software packages. Here are some of the popular package managers for Linux:
Advanced Package Tool (APT) - APT is the default package manager for Debian and its derivatives, such as Ubuntu and Linux Mint. It uses .deb packages.
Yellowdog Updater Modified (YUM) - YUM is the default package manager for Red Hat Enterprise Linux (RHEL) and its derivatives, such as CentOS and Fedora. It uses .rpm packages.
Pacman - Pacman is the package manager for Arch Linux and its derivatives. It uses .pkg.tar.xz packages.
Zypper - Zypper is the default package manager for SUSE Linux Enterprise and openSUSE. It uses .rpm packages.
Portage - Portage is the package manager for Gentoo Linux. It uses .ebuild scripts to build and install software packages from source code.
These package managers provide a simple and efficient way to install, update, and remove software packages on Linux. They also handle dependencies and ensure that all required software components are installed, which makes it easier to manage software on a large scale.
Task: Installing docker and Jenkins in your system from your terminal using package managers
Installing Docker:
- Update the package list:
sudo apt-get update
- Install the required packages to allow the use of Docker repositories over HTTPS:
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
- Add Docker's official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- Add the Docker repository to the APT sources:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- Update the package list again:
sudo apt-get update
- Install Docker:
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
- Verify that Docker is installed correctly by running the following command:
sudo docker run hello-world
Installing Jenkins:
- Add the Jenkins repository key:
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
- Add the Jenkins repository to the APT sources:
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
- Update the package list:
sudo apt-get update
- Install Jenkins:
sudo apt-get install -y jenkins
Check the status of the docker service in your system:
$systemctl status docker

Stop the service Jenkins and post before and after screenshots:
$sudo systemctl stop jenkins


Systemctl vs Service
Both
systemctlandserviceare command-line utilities in Linux that are used to manage system services, but they have some differences in their usage and functionality.serviceis a traditional SysV init command used to manage services on older Linux systems. It is still included in many modern Linux distributions for compatibility reasons. Theservicecommand can be used to start, stop, restart, and check the status of a service, among other things.systemctlis a newer and more powerful command used to manage services on modern Linux systems that use systemd as their init system. Thesystemctlcommand can be used to start, stop, restart, reload, and check the status of a service, as well as enable or disable a service so that it starts automatically at boot time.One of the key differences between
serviceandsystemctlis thatsystemctlis more granular in its control of services. It allows us to manage individual units, such as services, targets, timers, and sockets.systemctlalso provides more detailed information about services and their dependencies, making it easier to troubleshoot issues.Overall, if you are using a modern Linux system with systemd,
systemctlis likely the better option for managing services. However, if we are using an older Linux system or need to manage a specific service that only supportsservice, then we may need to useserviceinstead.




