#Day7 of #90DaysofDevops challenge
Click here to view Day 7 Task.
What is a Package manager in Linux?
A package manager in Linux is a software tool that helps users manage software packages on their system. A package manager is responsible for installing, updating, and removing software packages, as well as resolving dependencies between different packages.
There are several popular package managers in Linux, including apt (used by Debian and Ubuntu), yum (used by Red Hat and CentOS), and pacman (used by Arch Linux). These package managers typically have command-line interfaces, as well as graphical interfaces, that make it easy for users to search for, install, update, and remove software packages.
What is a Package?
In Linux, a package is a bundle of files that are used to install and manage software on a system. A package typically contains the compiled code for the software, as well as any scripts, configuration files, and documentation necessary for the software to run properly.
Different kinds of Package Managers
Package Managers differ based on the packaging system but same packaging system may have more than one package manager.
For example, RPM has Yum and DNF package managers. for DEB, you have apt-get, aptitude command line based package managers.
Install docker and jenkins in your system from your terminal using package managers
docker installation :
i) Older versions of Docker went by the names of docker, docker.io or docker- engine. uninstall any such older versions before attempting to install a new version
'sudo apt-get remove docker docker-engine docker.io'
ii) Update the apt package index
'sudo apt-get update'
iii) Install docker
'sudo apt install docker.io'
iv) Verify that the Docker installation is successful by running the hello-world image
'sudo docker run hello-world'
Jenkins Installation
i) Add the Jenkins repository key to your system
'wget -q -O - pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -'
ii) Add the Jenkins repository to your system
'sudo sh -c 'echo deb pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
iii) Update the package database
'sudo apt-get update'
iv) Install Jenkins
'sudo apt-get install jenkins'
v) Start and verify that Jenkins is running
'sudo systemctl start jenkins'
'sudo systemctl status jenkins'
What are systemctl and systemd?
systemctl
and systemd
are tools used in modern Linux systems to manage system services and processes.
systemd
is a system and service manager for Linux operating systems. It is responsible for starting up and managing system services, handling power management, and performing many other tasks that were traditionally handled by the init
process. systemd
is designed to provide a more reliable and efficient system startup and management experience.
systemctl
is the command-line interface for interacting with the systemd
system and service manager. It allows you to manage and control the state of system services, including starting, stopping, restarting, enabling, and disabling them. You can also use systemctl
to view the status of services and get information about service dependencies and logs.
With systemctl
, you can easily manage and troubleshoot system services, monitor system health, and perform a variety of other administrative tasks. systemd
and systemctl
are widely used in modern Linux distributions and are an important part of the Linux ecosystem.
Check the status of docker service
'sudo systemctl status docker'
Stop the service Jenkins and post before and after screenshots
Before :
After :
'sudo systemctl stop jenkins'
'sudo systemctl status jenkins'
Read about the commands systemctl vs service
systemctl
and service
are both command-line tools used for managing services in Linux systems. However, there are some differences between the two.
service
is a legacy command that is still used in many Linux distributions. It is used to manage the system services by starting, stopping, restarting, or reloading them. It works by executing scripts located in the /etc/init.d
directory.
For example, if you want to start the Apache web server using service
, you would run the following command:
'sudo service apache2 start'
On the other hand, systemctl
is a more modern and powerful command that is used in newer Linux distributions. It is used to manage the systemd system and service manager, which replaces the traditional init system. systemctl
can perform the same tasks as service
, but it has additional functionality and features, such as the ability to view the status of a service, enable or disable a service at boot time, and more.
For example, if you want to start the Apache web server using systemctl
, you would run the following command:
'sudo systemctl start apache2'
Additionally, systemctl
has a number of subcommands that allow you to perform more advanced tasks, such as listing all running services, checking the status of a service, or getting information about a service's configuration.
Overall, while service
is still supported in many Linux distributions, systemctl
provides a more advanced and flexible way to manage services and is the preferred method in many modern Linux systems.
Thank you for reading! ๐
Nidhi