DevOps Learning Journey Day 7
What is a Package Manager in Linux?
If you're new to Linux, you might hear the term "package manager" a lot. But what does it mean, and why is it important?
A package manager is a tool that helps you install, update, and manage software on your Linux system. It makes it easy to handle software packages, which are bundles of programs and their dependencies (the other software they need to work).
In this article, we'll break down what package managers do, explain what packages are, and show you how to use package managers on Ubuntu and CentOS to install popular tools like Docker and Jenkins.
Understanding Packages
Before we dive into package managers, let's define what a "package" is. In Linux, a package usually refers to a software application. This could be a program with a graphical user interface (GUI), a command-line tool, or a software library that other programs depend on.
A package is essentially a compressed file that contains everything needed for the software to run, including:
Executable Code: The actual program that gets run.
Configuration Files: Settings that determine how the software behaves.
Dependencies: Information about any other software the package needs to work properly.
In short, packages are the building blocks of software in Linux!
Types of Package Managers
There are different types of package managers, each suited for specific Linux distributions. Sometimes, the same packaging system may have several package managers. Here are some key examples:
RPM-based Package Managers:
Yum: This is a popular package manager used in RPM-based distributions like CentOS and Red Hat Enterprise Linux.
DNF: DNF is the newer version of Yum and is used in modern RPM-based distributions.
DEB-based Package Managers:
apt-get: This command-line package manager is used for DEB-based distributions like Ubuntu and Debian.
aptitude: This is another command-line package manager that offers more features than apt-get.
Now, let’s get started with some hands-on practice by using these package managers to install Docker and Jenkins on Ubuntu and CentOS!
Installing Docker and Jenkins Using Package Managers
On Ubuntu:
Install Docker: Open your terminal and run the following commands:
sudo apt-get update sudo apt-get install docker.io
Install Jenkins: Use these commands to install Jenkins:
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add - sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' sudo apt-get update sudo apt-get install jenkins
On CentOS:
Install Docker: Use the following commands:
sudo yum install docker sudo systemctl start docker sudo systemctl enable docker
Install Jenkins: Run these commands:
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key sudo yum install jenkins sudo systemctl start jenkins sudo systemctl enable jenkins
Exploring systemctl and systemd
systemctl: This command manages the state of the systemd service manager, allowing you to start, stop, and control services.
systemd: This is the standard system and service manager for many Linux distributions, making it easier to manage services and system initialization.
Managing Services
To check the status of the Docker service:
sudo systemctl status docker
To stop Jenkins, capture screenshots, and then start it again:
sudo systemctl stop jenkins # Capture screenshots here sudo systemctl start jenkins # Capture screenshots again
Summary
Package managers are essential for managing software in Linux, helping keep your system organized and up to date. Understanding systemctl and systemd is also important for effective service management. With these tools, you're ready to navigate the Linux environment with confidence!
"I believe this article will be beneficial, allowing you to uncover fresh insights and gain enriching knowledge."
Happy Learning🙂
Parth Sharma
Subscribe to my newsletter
Read articles from Parth Sharma directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by