What is a Package Manager?
In Linux Package Manager is an automated tool or software that allows users to install, remove, update, configure, and manage software packages on an operating system. It deals with the packages.
A package manager helps you manage the software that is installed in your computer and allows you to easily track what new software is installed, upgrade the software to newer versions, or remove the software that you don't need anymore.
Why do we need a Package Manager?
As a DevOps Engineer, we need a package manager to reduce the complexity for end-users by automating the management of software packages. It includes installation, upgrading, configuration, and removal of software. It ensures that the installations of software are consistent, reliable, and efficient across different environments.
How does Package Manager work?
A package manager is a tool that automates the management of software on a computer system.
Users configure the package managers to access the repositories where software packages are stored.
When users search for software, the package manager obtain metadata from the repositories, including version numbers and dependencies.
Dependency resolution ensure the installation of all required software components alongside with the requested package.
During installation, the package manager downloads and installs the package and its dependencies, and perform additional configuration if needed.
It has the capability to perform additional actions after software installation, manage upgrades to newer versions of installed packages, and handle the removal of software packages from the system.
Package managers track dependencies to maintain system stability and perform periodic cleanup tasks.
Overall, package managers make it easier to manage software on your computer and make sure everything runs smoothly, no matter what kind of computer you're using.
Package:
A package contains all the necessary data required for the installation and maintenance of the software package.
Repository:
The repositories hold packages made for different versions and types of Linux. They're filled with lots of packages created by the people who make Linux, but sometimes other projects also manage their packages.
Dependencies:
Some packages need additional software installed already on the system to work properly. The software or resources that a package relies on are known as its dependencies.
Types of Package Manager
Apt: It is a package management system for Debian, Ubuntu, and other similar Linux distributions. It is known as an advanced package tool.APT can install, remove, and build packages. We can use
apt
as well asapt-get
There are some commands that we used using apt:
apt update
: To update the latest version of all the packages installed in our system from the repositories.apt upgrade
: To check the list of available upgrades and then upgrade the packages one by one.apt install package_name
: To install the package with the name package_name.apt remove package_name
: To remove the package with the name package_name.apt purge package_name
: To completely remove the package as well as the dependencies and configuration of the packages.
Yum: It is a package management tool for a variety of older RHEL-based distributions (such as CentOS 7) and older versions of Fedora. It is known as "Yellowdog Updater, Modified".
It is mainly used in Red Hat Enterprise Linux. It is a high-level package manager who can perform functions such as dependency resolution.
There are some commands that we used using yum:
yum update package
: To automatically fetch and install all the updates available for your system.yum install package
: To install the package with the named package.yum remove package
: To remove the package with the named package.
DNF: It is used to install, update, remove, and manage software packages on their Linux systems. It is the successor to YUM. It is known as Dandified YUM.
Install docker on Ubuntu
By using these two commands we can install docker on our system
(i) sudo apt update
(ii) sudo apt-get install docker.io -y
If we have to check the service that our docker is running or not we can check through systemctl status docker
or service docker status
From both command, we can see the status of docker.
Here we can see our docker is running.
Difference between systemctl and Service
Both systemctl and service are tools for managing services on Linux computers, but they work little differently.
In simple terms, we can understand it as systemctl is for newer Linux systems. We can do lots of things like starting and stopping services, making sure they start when the computer boots up, and checking if they're running.
Service is for older Linux systems. It's simpler and mostly just starts and stops services.
So, if you're using a newer Linux system, you'll probably use systemctl. But if it's an older system, you might use service instead.
Summary:
We learn about the concept of package manager in detail. We see its use in DevOps engineer life. In last we see the difference between systemctl and service commands.