Package manager and systemctl
Introduction
In Linux, a package manager is a software tool that simplifies the installation, updating, and removal of software packages on the operating system. It is a central component of most Linux distributions and is designed to handle the complexities of software dependencies, version management, and package installation with ease.
The primary purpose of a package manager is to make software management more efficient and convenient for both users and system administrators. Instead of manually downloading, compiling, and installing software from various sources, users can rely on the package manager to handle all these tasks automatically.
Examples of Package Managers in Linux:
Debian/Ubuntu: APT (Advanced Package Tool) is the package manager used in Debian-based distributions like Ubuntu. It uses
.deb
packages.Red Hat/CentOS/Fedora: yum(Yellowdog Updater, Modified) is used in Red Hat-based distributions like CentOS and Fedora. It uses
.yum
packages.
Task 1: Installing Docker and Jenkins
I am using Linux Ubuntu flavor:
Installing Docker
Note: Both apt and apt-get serve the same purpose
-
Installing Jenkins
Note: For Jenkins to run first install Java and then Jenkins
-
Go to the official Jenkins website to install the Ubuntu version of Jenkins
curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee \
/usr/share/keyrings/jenkins-keyring.asc > /dev/null
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkins
check version to make sure its downloaded
systemctl and systemd
systemctl is used to examine and control the state of “systemd” system and service manager. systemd is system and service manager for Unix like operating systems(most of the distributions, not all).
Common systemctl
Commands:
systemctl start service_name
: Start a service.systemctl stop service_name
: Stop a service.systemctl restart service_name
: Restart a service.systemctl enable service_name
: Enable a service to start on boot.systemctl disable service_name
: Disable a service from starting on boot.systemctl status service_name
: View the status of a service.systemctl is-enabled service_name
: Check if a service is enabled on boot.systemctl list-units
: List all units (services, sockets, devices, etc.) in the system
Task 2: check the status of docker service in your system
Task 3: stop the service Jenkins and post before and after screenshots
Before:
After:
systemctl vs service
systemctl
is a command-line utility introduced with Systemd, the modern init system used in many Linux distributions. It offers advanced service management features, such as parallel startup, dependency tracking, and resource management through cgroups. Systemd services are defined and controlled through unit files, ensuring a consistent experience across distributions like Ubuntu, CentOS, Fedora, and Debian.
On the other hand, the service
command is a legacy approach from SysVinit, the traditional init system used in older Linux distributions. While still available in some modern distributions for compatibility, it provides basic service management capabilities through init scripts located in /etc/init.d/
. For optimal service management and a consistent experience, systemctl
is the recommended method, especially on Systemd-based distributions.
In conclusion, package managers, such as apt
and yum
, serve as indispensable tools for software management on Linux, providing users with a convenient and efficient way to install, update, and remove packages. Their dependency resolution capabilities ensure smooth installations, while their streamlined interfaces simplify the user experience.
Moreover, systemctl
plays a pivotal role in modern service management, offering advanced features like parallel startup, dependency tracking, and resource management, resulting in faster boot times and optimal system performance. By embracing these powerful tools, developers and system administrators can enhance their productivity, maintain system integrity, and create a more streamlined and efficient computing environment on Linux. The combination of robust package managers and advanced service control significantly contributes to a smoother and more enjoyable computing journey for all Linux users.
Subscribe to my newsletter
Read articles from Geethika Bedadhala directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by