Day 7 of 90DaysOfDevOps : Understanding Package Manager and Systemctl
πΉ What is a Package Manager?
A package manager is a tool that helps you install, update, and remove software on your system. It can be a graphical app or a command-line tool like apt or yum.
π But whatβs a package? A package is an archive file containing everything needed to install a piece of software (like Docker or Jenkins) on your system. This includes executable files, configurations, and dependencies.
Popular Package Managers:
DEB-based (Debian/Ubuntu):
apt
,apt-get
RPM-based (Red Hat/CentOS):
yum
,dnf
πΉ Installing Docker and Jenkins on Ubuntu and CentOS
For Ubuntu (Using apt
) π§
Update the package list:
sudo apt update
Install Docker:
sudo apt install -y docker.io
Install Jenkins:
sudo apt install -y jenkins
For CentOS (Using yum
) π§
Install Docker:
sudo yum install -y docker
Install Jenkins:
sudo yum install -y jenkins
πΉ Managing Services with systemctl π οΈ
Once Docker and Jenkins are installed, you can use systemctl (part of systemd) to manage these services.
Checking Docker Service Status
sudo systemctl status docker
Stopping and Starting Jenkins
sudo systemctl stop jenkins # Stop Jenkins
sudo systemctl start jenkins # Start Jenkins
πΉ Automating Service Management π
Create a simple script to start or stop Docker and Jenkins as needed:
#!/bin/bash
echo "Choose an action: start or stop"
read action
sudo systemctl $action docker
sudo systemctl $action jenkins
echo "Docker and Jenkins have been $action-ed!"
πΉ Enabling and Disabling Services on Boot π
To automatically start Docker on boot but prevent Jenkins from starting:
# Enable Docker to start on boot
sudo systemctl enable docker
# Disable Jenkins from starting on boot
sudo systemctl disable jenkins
πΉ Checking Logs with journalctl π
View Docker logs:
sudo journalctl -u docker
View Jenkins logs:
sudo journalctl -u jenkins
Summary π
With package managers, you can quickly install and update software. Then, with systemctl and systemd, you can manage these services, automate actions, and control their startup behavior. Now you have a solid foundation to manage software and services like a pro in Linux!
Subscribe to my newsletter
Read articles from Pooja Naitam directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Pooja Naitam
Pooja Naitam
π Hello! I'm Pooja Naitam, a passionate DevOps fresher with a solid foundation in the field. I hold the AWS Certified Cloud Practitioner (CCP) certification, and I'm eager to apply my knowledge to real-world projects while continuously learning cutting-edge technologies. Let's connect and grow together in the exciting world of DevOps!