Understanding package manager and systemctl: #Day7 of 90DayofDevOps
Title:
Understanding Package Managers in Linux: Simplifying Software Installation and Management
Tasks:
You have to install docker and jenkins in your system from your terminal using package managers.
Write a small blog or article to install these tools using package managers on Ubuntu and CentOS.
check the status of the docker service in your system (make sure you completed the above tasks, else docker won't be installed)
stop the service Jenkins and post before and after screenshots
read about the commands systemctl vs service
eg. systemctl status docker
vs service docker status
Introduction:
In the world of Linux, one of the most powerful and indispensable tools for software management is the package manager. Whether you are a seasoned Linux user or a curious beginner, understanding what a package manager is and how it works can significantly enhance your Linux experience. This blog post aims to demystify package managers, explore their benefits, and provide insights into how they make software installation and management a breeze in the Linux ecosystem.
What is a package manager in Linux?
A package manager is a powerful tool designed to handle the installation, removal, and maintenance of software packages on a Linux-based operating system.
What is a package?
In Linux, a package refers to a software distribution format that contains all the necessary files, metadata, and instructions needed to install and manage a specific application or software component.
Different kinds of package managers:
There are different package managers based on the Linux distribution, but the two most popular ones are:
APT (Advanced Package Tool):
Distribution:
Used in Debian and Debian-based distributions like Ubuntu, Linux Mint, and others.
Package Format
: .deb (Debian package).
Command Line Tool:
apt-get (legacy) and apt (modern) are commonly used.
example
:
'sudo apt-get install package_name'
'sdo apt-get update && sudo apt-get upgrade'
'sudo apt-get remove package_name'DPKG:
Distribution
: Used in Debian and Debian-based distributions.
Package Format:
.deb (Debian package).
Command Line Tool:
dpkg is the primary command-line package manager, used directly for local package management.
example
:
'sudo dpkg -i package_name.deb'
'sudo dpkg -r package_name'YUM (Yellowdog Updater, Modified):
Distribution
: Used in Red Hat-based distributions like CentOS, Fedora, and Oracle Linux.
Package Format:
.rpm (RPM package).
Command Line Tool:
yum is the command-line package manager.example
:
'sudo yum install package_name'
'sudo yum update apckage_name'
'sudo yum remove package_name'
Task1: You have to install docker and jenkins in your system from your terminal using package managers.
You can install Docker by using the command sudo apt install
docker.io
in the terminal.
And you can check the status after installing Docker using the command -systemctl status docker
Installing Jenkins on Linux server:
- Install JDK '
sudo apt install openjdk-17-jre
'
Installing Jenkins on Ubuntu (referring :https://www.jenkins.io/doc/book/installing/linux/)
Checking status:
Go to the security groups of the server and add an inbound rule for port 8080 If you see the below page on port 8080, then you have successfully installed Jenkins on ubuntu
Copy location to know the Jenkins Administrator password
Copy and paste password here
Enter into Jenkins UI Page
To stop Jenkins Service
Read about the commands systemctl vs service
eg. systemctl status docker
vs service docker status
systemctl and service are two commands commonly used in Linux for managing system services, but they operate differently and are associated with different service management systems.
service Command:
The service command is a simple and user-friendly way to manage services on older Linux systems that use the SysVinit system. SysVinit is an older init system that was widely used in various Linux distributions before the adoption of systemd.
With the service command, you can start, stop, restart, enable, disable, and check the status of system services.
For example: sudo service apache2 start.
systemctl Command:
systemctl is a powerful and modern service management tool that comes with the systemd init system. systemd is the default init system in many modern Linux distributions, including Ubuntu since version 15.04, Debian since version 8, CentOS/RHEL since version 7, and many others. systemctl provides more advanced features and better integration with the Linux system. It can manage both System V-style (SysV) init scripts and native systemd unit files.
With systemctl, you can start, stop, restart, enable, disable, reload, and check the status of services.
For example: sudo systemctl start apache2
In summary, while the service command is still available and useful on systems that use SysVinit, systemctl is the preferred and more powerful option on systems that utilize systemd.
Thank you for the time to read this blog. Happy Learning!!!