Day 7 - Understanding package manager and Systemctl📦

TABLE OF CONTENTS
Introduction📚
What is a package?📦
What is a package manager in Linux?🧧
Different kinds of package managers 🎁
Understanding systemctl and systemd 🧿
Task 1: Installing Docker and Jenkins Using Package Managers 🐳
Task 2: Checking the Status of the Docker Service🐋
Task 3: Stopping the Jenkins Service 👨🏻🍳
Difference between systemctl and service✍🏻
Conclusion📒
Introduction📚
Welcome to day 7 of the #90daysofDevOps Challenge. let's explore some new topics like Package Manager 📦 along with commands like systemctl and systemd. To upgrade ourselves in the package manager we install docker🐳 and Jenkins.👨🏻🍳 then watch the status of the docker service🐋. understand the difference between systemctl and Service Command. So Let's start with Package management in Linux🧧.
What is Package?📦
In Linux, a "package" is basically a bundle of software that you can easily install and manage on your system. 💻Think of it like a gift box that contains everything you need to use a particular software program.🎁 This can include the program itself (whether it's a graphical application or a command line tool), configuration files, and any other files that the program needs to run. Sometimes a package might also include information about other software that needs to be installed before the package can be used.🧧 The package manager takes care of all the details of installing and managing these packages for you, so you don't have to worry about downloading and installing everything manually. It's like having a personal assistant to handle all the software-related tasks on your system!🍁
Different kinds of package managers🧧
Different Linux distributions use different packaging systems to manage software packages. For example, Debian-based distributions use the .deb packaging system, while Red Hat-based distributions use the .rpm packaging system. However, even within a single packaging system, there may be multiple package managers available.
For instance, the .rpm packaging system has two popular package managers, Yum and DNF. Both of these tools can be used to install, update, and manage software packages that use the .rpm format.📒
Similarly, the .deb packaging system used by Debian and Ubuntu has several command line-based package managers available, including apt-get and aptitude. These tools make it easy to install and manage software packages from the Debian repositories.✳
Overall, the specific package manager you choose to use will depend on the Linux distribution you are using, the packaging system it employs, and your personal preferences as a user.📕
Understanding systemctl and systemd💻
Systemctl - The systemctl command manages both system and service configurations, enabling administrators to manage the OS and control the status of services. Further, systemctl is useful for troubleshooting and basic performance tuning.📕
Systemd - Systemd is a system and service manager for Linux, compatible with SysV and LSB init scripts. Systemd provides Aggressive parallelization capabilities. Uses socket and D-Bus activation for starting services. Offers on-demand starting of daemons and keeps track of processes using Linux groups.📝
The Commands are follows as:
sudo systemctl start service_name
sudo systemctl stop service_name
sudo systemctl restart service_name
sudo systemctl enable service_name
sudo systemctl disable service_name
Task 1: Installing Docker and Jenkins Using Package Managers🐳
Now we will install Docker and Jenkins using Ubuntu.
Install Docker using Ubuntu
- Update the
aptpackage index and install packages to allowaptto use a repository over HTTPS:
sudo apt update
- Install Docker Repository
sudo apt-get install docker.io -y
3. To check the version of the docker
docker version
You have now successfully installed and started Docker Engine.
Installing Jenkins on Ubuntu
To install Jenkins on Ubuntu using package managers, follow these steps:
- Install Java on your Linux system by running the commands:
#Installs jdk 11
sudo apt-get install openjdk-11-jdk -y
#Update the package list
sudo apt-get update
#Test if Java has been installed, this will display the version of java.
java -version
- Add the Jenkins repository key to your system:
curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee \
/usr/share/keyrings/jenkins-keyring.asc > /dev/null
3. Add the Jenkins apt repository entry to your package sources:
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
4. Update your package list :
sudo apt-get update
5. Install Jenkins:
sudo apt-get install jenkins
6. Start Jenkins:
sudo systemctl start jenkins
- Check Jenkins status:
sudo systemctl enable jenkins
Jenkins should now be installed and running on your Ubuntu system. You can access it by opening your web browser and navigating to http://localhost:8080💻.
Task 3: Stopping the Jenkins Service
To stop Jenkins service we use the following command,
sudo systemctl stop jenkins
Run this command on your system and it will stop the service of Jenkins.
Difference between systemctl and service💻
Service - service is an "high-level" command used for starting and stopping services in different unixes and linuxes. Depending on the "lower-level" service manager, service redirects on different binaries.
For example, on CentOS 7 it redirects to systemctl, while on CentOS 6 it directly calls the relative /etc/init.d script. On the other hand, in older Ubuntu releases it redirects to upstart
service is adequate for basic service management, while directly calling systemctl give greater control options.
service status docker
Systemctl - systemctl is basically a more powerful version of service.
With service you can only do commands related to the service (i.e. status, reload, restart)
systemctl start docker
Conclusion🍁
We have completed our Day 7 of the #90daysofDevOps challenge. we explore how can we use the package manager to install packages. using commands like systemctl, service we can check or monitor our docker and Jenkins service. learned the difference between service and systemctl. now we know the proper use of package management.🎁
Stay connected with me for new blogs on linux, cloud☁ and DevOps technology.
Thank you for reading🙏 Keep learning and Keep Growing.



