Package Manager in Linux


What is a package manager?
๐ฆ A package manager in Linux is like a magical ๐งโโ๏ธ assistant that helps you find, install, update, and remove software easily! It's like having a personal ๐๏ธ store for all your software needs!
๐ญ Repositories: Package managers have access to vast collections of software called repositories. These are like online stores with tons of free and open-source software ready to be installed.
๐ Searching: You can search for software packages by name or keywords using the package manager. It's like searching for products in an online marketplace.
โ Installation: When you find the software you want, you simply ask the package manager to install it. It takes care of all the complex steps like downloading, verifying, and setting up the software for you.
๐ Updates: The package manager also keeps your software up-to-date. It regularly checks for updates and lets you know when new versions are available. Upgrading is as easy as clicking a button.
โ Removal: If you no longer need a software package, you can ask the package manager to remove it, and it'll clean up all the related files for you.
๐ Dependencies: Sometimes, the software relies on other software to work correctly. Package managers handle these dependencies automatically, ensuring that everything works smoothly together.
๐ Security: Package managers verify the authenticity of the software you install, reducing the risk of malicious or compromised packages.
๐ Convenience: With a package manager, you save time and effort. No need to visit different websites, download installers, or worry about updates. Everything is streamlined and managed in one place.
What is a package?
๐ฆ In Linux, a package is like a ๐ gift box filled with all the necessary goodies to install and use software hassle-free! It's a handy way to organize and distribute software
๐ฆ Definition: A package is a single file or archive that holds all the ๐ files and ๐ information required for a software program.
๐งฉ Dependencies: Sometimes, software needs other pieces (dependencies) to work correctly. Packages include these dependencies, like having all the ๐งฉ puzzle pieces in one box.
๐ Installation: When you want to use the software, you can easily install the package. It's like unwrapping the ๐ gift and setting up the software for you.
๐ Updates: Packages can be updated to newer versions. Just like getting the latest ๐ book edition with extra chapters and improvements.
โ Removal: If you no longer need the software, you can remove the package. It's like cleaning up and putting everything back in the box.
๐ Security: Packages are designed to be safe and secure. They come from trustworthy sources, like getting products from reputable ๐ stores.
๐ Repositories: Packages are typically stored in repositories, which are like big online ๐ฌ marketplaces. The package manager knows where to find the right package for you.
Different kinds of package managers?
๐ฆ APT (Advanced Package Tool) - APT is like a handy ๐ ๏ธ command-line Swiss Army knife, working with Ubuntu's Advanced Packaging Tool. Here are some examples of its use:
Install the Package:
sudo apt-get install package_name
๐๐ฆ (Getting and unboxing the software gift!)Update the Package:
sudo apt-get update
followed bysudo apt-get upgrade
๐๐ฆ (Refreshing the software gift box and getting the latest version!)
๐ YUM (YellowDog Update Manager) - YUM is like a friendly ๐ dog providing a command-line interface for managing packages in RHEL. Here are some examples of its use:
Install the Package:
sudo yum install package_name
๐๐ฆ (Fetching and unwrapping the package gift!)Update the Package:
sudo yum update
&sudo apt-get upgrade
๐๐ฆ (Refreshing the package gift box and getting the updates!)Remove the Package:
sudo yum remove package_name
โ๐ฆ (Removing the package gift from your system!)
๐ RPM (Red Hat Package Manager) - RPM is like a well-known ๐ gift box manager, the default package manager for Red Hat-based systems like Fedora, CentOS, and RHEL. Here's how you use it:
- Install the Package:
sudo apt install rpm
๐๐ฆ (Unpacking the RPM gift!)
๐ณ Docker Installation using Package Managers ๐ฆ
Docker, the containerization marvel, allows us to encapsulate applications and dependencies in lightweight containers. Let's install Docker on both Ubuntu and CentOS using their respective package managers.
๐ Ubuntu Installation (using apt):
Open your terminal and update package lists:
codesudo apt update
Install Docker using apt:
codesudo apt install docker.io
Verify Docker installation:
codedocker --version
๐ CentOS Installation (using yum):
Open your terminal and update package lists:
codesudo yum update
Install Docker using yum:
codesudo yum install docker
Start Docker service:
codesudo systemctl start docker
Enable Docker to start on boot:
sudo systemctl enable docker
Verify Docker installation:
codedocker --version
๐๏ธ Jenkins Installation using Package Managers ๐ฆ
Jenkins, the automation powerhouse, empowers us to build, test, and deploy projects. Let's install Jenkins on both Ubuntu and CentOS using their respective package managers.
๐ Ubuntu Installation (using apt):
Add Jenkins repository key:
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
Add Jenkins repository to sources list:
sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
Update package lists:
sudo apt update
Install Jenkins using apt:
sudo apt install jenkins
Start Jenkins service:
sudo systemctl start jenkins
Enable Jenkins to start on boot:
sudo systemctl enable jenkins
๐ CentOS Installation (using yum):
Add Jenkins repository to yum repository list:
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins.io/redhat-stable/jenkins.repo
Import Jenkins repository key:
sudo rpm --import http://pkg.jenkins.io/redhat-stable/jenkins.io.key
Install Jenkins using yum:
sudo yum install jenkins
Start Jenkins service:
sudo systemctl start jenkins
Enable Jenkins to start on boot:
sudo systemctl enable jenkins
๐ Systemctl vs Service: Unveiling the Differences โ๏ธ
In the Linux realm, both systemctl and service commands are powerful warriors that handle services, but they have some differences in their functionality and usage. Let's explore their unique traits! ๐
๐ Systemctl: The SystemD Champion ๐ก๏ธโ๏ธ
Systemctl is a fearless warrior that directly interacts with the SystemD service manager, wielding its might to manage services with finesse! ๐ช
โจ Functionality:
Start, stop, and restart services with ease.
Enable or disable services to control their behavior.
๐ ๏ธ Usage:
Start Jenkins services: ๐ฅ
systemctl start jenkins
Check Jenkins services status: ๐
systemctl status jenkins
๐ง Service: The Trusty Ally ๐คโ๏ธ
Service is a loyal ally that manages services by interacting with the SystemD process, complementing systemctl in its mission! ๐ค
โจ Functionality:
Start, stop, and restart services smoothly.
Enable or disable services with precision.
๐ ๏ธ Usage:
Start Jenkins services: ๐ฅ
service jenkins start
Check Jenkins services status: ๐
service jenkins status
Conclusion :
Both "systemctl" and "service" commands are powerful tools for managing services in Linux. While "systemctl" directly interacts with the SystemD service manager, "service" complements it by interacting with the SystemD process. Both commands provide essential functionalities to start, stop, restart, enable, and disable services. Choose the command that suits your preferences and distribution, and embrace their power to become a Linux hero! ๐ง๐ช #LinuxMagic #ServiceManagement #SystemctlVsService
๐ข Stay in the โ๏ธ cloud loop and blast off into the ๐ DevOps universe! Join me on Hashnode, where I share my latest insights and articles about all things cloud and DevOps. Let's connect on LinkedIn (https://www.linkedin.com/in/nirmal-mahale-605565215/) and explore the boundless possibilities of the tech cosmos together. ๐ And hey, if you want to peek under the hood of my projects, hop on over to my GitHub (https://github.com/nirmal7030). ๐ ๏ธ
Subscribe to my newsletter
Read articles from Nirmal Mahale directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Nirmal Mahale
Nirmal Mahale
Passionate about Python, Cloud Computing, and DevOps. Architecting robust cloud solutions, mastering AWS & Azure, and automating with cutting-edge DevOps tools. Join me on this journey of innovation and collaboration. Let's shape the future together!