Day 7 - Simplifying Software Management on Linux: A Guide to Package Managers and Systemctl (Dec 3, 2023)
Introduction: Managing software on a Linux system involves the use of package managers and tools like systemctl. In this guide, we'll explore the basics of package managers and demonstrate how to install Docker and Jenkins using package managers on Ubuntu and CentOS. Additionally, we'll delve into the functionalities of systemctl and compare it with the traditional 'service' command.
Understanding Package Managers: In the Linux ecosystem, a package manager is a crucial tool that simplifies the installation, removal, upgrade, configuration, and management of software packages. Packages, in this context, refer to applications, whether they are GUI applications, command line tools, or software libraries essential for other programs. These packages are archive files containing binaries, configuration files, and sometimes dependency information.
Different Linux distributions adopt various packaging systems, each with its own set of package managers. For instance, RPM-based distributions like CentOS use Yum and DNF, while Debian-based systems like Ubuntu utilize apt-get and aptitude.
Installing Docker and Jenkins:
On Ubuntu: To install Docker and Jenkins on Ubuntu, open the terminal and use the following commands:
sudo apt-get update
sudo apt-get install docker.io
sudo apt-get install jenkins
On CentOS: For CentOS, you can use the Yum package manager:
sudo yum install docker
sudo yum install jenkins
These commands will download and install Docker and Jenkins along with their dependencies.
Understanding Systemctl and systemd: Systemctl is a command-line tool used to examine and control the state of the "systemd" system and service manager. Systemd, in turn, is a comprehensive system and service manager for Unix-like operating systems. It has become the standard initialization system for most Linux distributions.
Check Docker Service Status: To check the status of the Docker service, use the following command:
systemctl status docker
Stop Jenkins Service: To stop the Jenkins service, use the command:
sudo systemctl stop jenkins
Compare systemctl vs service: The 'systemctl' and 'service' commands both manage services, but 'systemctl' is more feature-rich and is compatible with the modern 'systemd' init system. For instance:
systemctl status docker
service docker status
The 'systemctl' command provides more detailed information and additional control options compared to the traditional 'service' command.