Day 7 Task: Understanding package manager and systemctl
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.
π§ Key Functions:
Installation: π Easily add new software to your computer. Just tell the package manager what you want, and it takes care of the rest!
Dependency Resolution: 𧩠Handles the connections between different software pieces. No worries about missing pieces; the package manager puts everything together for you.
Updates: π Keeps your software up-to-date. With a simple command, you can update all your programs or just the ones you choose.
Removal: ποΈ When you're done with a program, the package manager helps you remove it neatly, making sure nothing is left behind.
Information: π Get details about available software. Want to know more about a program? The package manager provides all the information you need.
π Examples of Package Managers:
APT (Advanced Package Tool): π οΈ Used by Ubuntu and other Debian-based systems.
YUM (Yellowdog Updater, Modified): π Common in Red Hat-based systems like Fedora and CentOS.
zypper: π Found in openSUSE and SUSE Linux Enterprise.
Pacman: πΉ The go-to for Arch Linux users.
Each package manager has its own way of doing things, but they all share the goal of making your Linux experience smooth and simple!
What is a packageπ¦?
A package is a compressed archive that includes software, files, and installation information.
Used for convenient and standardized software distribution and management.
There are different package management systems used by various Linux distributions. Two commonly used package management systems are:
Debian Package Management (APT): Used by Debian-based distributions such as Debian itself, Ubuntu, and their derivatives. The package files have a
.deb
extension.Common package management commands include:
apt-get
: π¦Command-line tool for handling packages.dpkg
: π§°Low-level package management tool for Debian packages.
Red Hat Package Management (RPM): Used by Red Hat-based distributions such as Red Hat Enterprise Linux (RHEL), CentOS, Fedora, and others. The package files have a
.rpm
extension.Common package management commands include:
yum
π« (Yellowdog Updater, Modified): Used in older versions; it has been largely replaced bydnf
.dnf
π(Dandified YUM): Modern package manager for RPM-based distributions.
π οΈ Putting Knowledge into Practice: Installing Docker and Jenkins
Now that we've got a grasp of what package managers are and how they work let's put this knowledge into practice. Your tasks for today are to install Docker and Jenkins on your system using package managers. We'll cover installation on both Ubuntu and CentOS.
π³ Installing Docker on Ubuntu/Debian-based systems
For Ubuntu/Debian-based systems:
# Update package list
sudo apt update
# Install Docker
sudo apt install docker.io
For CentOS/RHEL-based systems:
# Install Docker
sudo yum install docker
Install Jenkins:
For Ubuntu/Debian-based systems:
# Update package list
sudo apt update
sudo apt install openjdk-11-jdk
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt update
# Install Jenkins
sudo apt install jenkins
For CentOS/RHEL-based systems:
sudo yum install java-11-openjdk
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
sudo yum install jenkins
After completing these installations, you'll have Docker and Jenkins up and running on your system, thanks to the power of package managers.
systemd
andsystemctl
in Linux π§
1. systemd:
π Init System:
systemd
is like the captain of your computer, making sure everything starts smoothly.π οΈ Service Manager: It's the supervisor for all the little workers (services) running on your system.
β‘ Parallelization: Helps your system start things up faster by doing multiple tasks at the same time.
π Logging: Keeps a journal of what's happening on your system so you can check it later.
2. systemctl:
systemctl
is a command-line tool that interacts with the systemd
manager. It allows you to control services, view their status, enable or disable them, and more.
π Commands:
start
systemctl start <service>: Press the "Start" button for a service.stop
systemctl stop<service>: Hit "Stop" to halt a service.restart
systemctl restart <service>: For the times you want to give a service a quick reset.status
systemctl status<service>: Check what a service is up to.enable
systemctl enable<service>: Tell a service to start automatically when you turn on your computer.disable
systemctl disable<service>: Stop a service from auto-starting.
Here are some tasks to get you started:
Check the status of the Docker service on your system:
For Ubuntu/Debian-based systems:
sudo systemctl start docker sudo systemctl enable docker sudo systemctl status docker
For CentOS/RHEL-based systems:
sudo systemctl start docker sudo systemctl enable docker sudo systemctl status docker
Stop the Jenkins service and capture before and after screenshots to observe the service's status change.
To stop the Jenkins service, run the following command:
sudo systemctl stop jenkins
Before stopping Jenkins:
After stopping Jenkins server
Stay tuned for more exciting challenges and continue to build your DevOps expertise. πͺπ₯
Happy Learning! π
~Ashwini π
Subscribe to my newsletter
Read articles from Ashwini Savare directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Ashwini Savare
Ashwini Savare
Hi there! I'm a passionate individual deeply fascinated by the world of cloud computing, DevOps practices, and AWS. As a dedicated cloud enthusiast, I immerse myself in the ever-evolving landscape of cloud technologies, staying up-to-date with the latest trends and advancements. I find immense joy in leveraging the power of cloud platforms, especially AWS, to design scalable and robust solutions that meet modern-day business needs. DevOps has captured my heart with its holistic approach to software development and operations. I firmly believe in the power of collaboration, automation, and continuous improvement to streamline the software delivery process. With my strong foundation in DevOps principles, I strive to bridge the gap between development and operations teams, fostering a culture of efficiency and innovation. Join me on this exhilarating expedition as we unravel the intricacies of cloud technologies, dive deep into DevOps practices, and unleash the true potential of AWS. Together, let's explore, learn, and empower one another to thrive in this ever-evolving tech landscape.