"Day 8: Navigating the Heart of Linux: Package Managers and Service Control 🚀💻"
Welcome back to the 90DaysDevOpsChallenge! On day 8, we're diving into the world of Linux package managers. If you've ever wondered how software is installed, upgraded, or removed on a Linux system, you're in the right place. Let's demystify package managers and explore their significance in the realm of DevOps and system administration.
What is a package manager in Linux?
In simpler words, a package manager is a tool that allows users to install, remove, upgrade, configure and manage software packages on an operating system. The package manager can be a graphical application like a software center or a command line tool like apt-get or pacman.
You’ll often find me using the term ‘package’ in tutorials and articles, To understand package manager, you must understand what a package is.
What is a package?
"A package is usually referred to an application but it could be a GUI application, command line tool or a software library (required by other software programs). A package is essentially an archive file containing the binary executable, configuration file and sometimes information about the dependencies."
Key Functions of Package Managers:
Package Installation: Install new software packages and their dependencies with a single command.
Dependency Resolution: Automatically resolve dependencies required by software packages during installation.
Package Removal: Safely remove software packages and their associated files from the system.
Package Upgrading: Upgrade installed software packages to newer versions seamlessly.
Repository Management: Interact with software repositories to download and install packages from centralized servers.
Package Verification: Verify the integrity of downloaded packages to ensure they have not been tampered with.
Popular Package Managers:
APT (Advanced Package Tool): Used in Debian-based distributions like Ubuntu. Commands include
apt
,apt-get
, andaptitude
.YUM (Yellowdog Updater, Modified): Common in Red Hat-based distributions such as Fedora and CentOS. Managed using the
yum
command.Pacman: Found in Arch Linux and its derivatives. Package management is done through the
pacman
command.Here we learn, Package Management with apt:
Input:
sudo apt install apache2
Output:
Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: apache2-bin apache2-data apache2-utils Suggested packages: apache2-doc apache2-suexec-pristine | apache2-suexec-custom The following NEW packages will be installed: apache2 apache2-bin apache2-data apache2-utils 0 upgraded, 4 newly installed, 0 to remove and 123 not upgraded. Need to get 1,462 kB of archives. After this operation, 6,765 kB of additional disk space will be used. Do you want to continue? [Y/n] Y
Input:
apt show apache2
Output:
Package: apache2 Version: 2.4.41-4ubuntu3.6 ...
- Service Control with systemctl:
Input:
sudo systemctl start apache2
Output:
* Starting Apache httpd web server apache2
Input:
sudo systemctl stop apache2
Output:
* Stopping Apache httpd web server apache2
Input:
sudo systemctl status apache2
Output:
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2024-02-27 14:15:36 PST; 2min 17s ago
Docs: https://httpd.apache.org/docs/2.4/
Main PID: 13123 (apache2)
Tasks: 55 (limit: 4915)
Memory: 11.7M
CGroup: /system.slice/apache2.service
├─13123 /usr/sbin/apache2 -k start
├─13125 /usr/sbin/apache2 -k start
└─13126 /usr/sbin/apache2 -k start
Conclusion
Linux package managers are indispensable tools in the DevOps toolkit, simplifying software management and ensuring system reliability. Understanding how package managers work and leveraging their capabilities can streamline deployment processes, enhance system security, and promote collaboration among DevOps teams🚀💻.
#90DaysOfDevopsChallenge #HappyLearning🎉.