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 thrilling #90DaysOfDevOps challenge. In this blog, we will embark on an exploration of the package manager and its essential tools, such as APT (Advanced Package Tool) π οΈ and YUM (Yellowdog Updater Modified) π οΈ, alongside delving into the significance of systemctl and systemd. Our primary objective will be to install Docker π³ and Jenkins ποΈ using package managers. For Docker installation, we shall configure the repository, while for Jenkins, we'll leverage APT on Ubuntu. Furthermore, we'll gain proficiency in checking the status of the Docker service, halting the Jenkins service, and comprehending the distinctions between systemctl and service commands. So, let's delve into this exciting journey and harness the potential of streamlined software management within the Linux environment! π
π¦ What is a package?
In Linux, a package is a software distribution format that contains all the necessary files and information π required to install and manage a specific piece of software. Packages typically include the executable binaries πΎ, libraries π, configuration files π, and documentation π needed to run the software on a Linux system π§.
π§° What is a package manager in Linux?
In Linux, a package manager is a tool that automates the installation, updating, and removal of software packages. It simplifies software management by handling dependencies and ensures consistent and reliable installations across the system. Users can access a centralized repository to find and install software easily. Package managers enhance system stability and security by efficiently managing software components.
A package manager is a tool that is used to install, upgrade, manage and remove packages. It is responsible to manage dependencies and to track all installed packages.
π οΈ Different kinds of package managers
There are two popular package managers APT (Advanced Package Tool) and YUM (Yellowdog Updater Modified).
APT (Advanced Package Tool): APT is widely used in Debian-based distributions like Ubuntu and is known for its user-friendly command-line interface. This package manager simplifies the process of interacting with the package management system, making it easier for users to perform various operations. π οΈ
With APT, you can effortlessly install, update, and remove packages using simple commands:
To install a package:
sudo apt-get install package_name
To update packages:
sudo apt-get update
followed bysudo apt-get upgrade
To remove a package:
sudo apt-get remove package_name
One of the significant advantages of APT is its automatic resolution of package dependencies. When you install a package, APT ensures that all required dependencies are also installed, preventing any conflicts or issues.
YUM (Yellowdog Updater Modified): YUM is commonly used in Red Hat-based distributions like CentOS and Fedora. Similar to APT, YUM provides a command-line interface for managing packages, making it convenient for users to handle software installations. π οΈ
To install a package:
sudo yum install package_name
To update packages:
sudo yum update
followed bysudo apt-get upgrade
To remove a package:
sudo yum remove package_name
One of the key features of YUM is its ability to manage package dependencies seamlessly. When you install or update a package using YUM, it automatically resolves dependencies, ensuring that all required packages are downloaded and installed correctly.
π Understanding systemctl and systemd
In Linux, "systemctl" and "systemd" are essential tools that help manage how programs and services run on the computer. Imagine your computer is like a big orchestra, with many different musicians playing their instruments (which are the programs and services). "systemd" is like the conductor, coordinating and keeping everything in order.
"systemctl" is like a remote control that allows you to interact with the conductor (systemd). You can use "systemctl" to start or stop programs, check their status (whether they are running or not), and even enable them to start automatically when the computer boots up.
systemctl: Systemctl
is a command-line utility used to manage system services in Linux distributions that adopt the systemd init
system. Systemd
is a system and service manager that provides advanced features such as process management, logging, and service dependencies.
Commands:
π
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
For example, let's say you have a music player program on your computer. Using "systemctl," you can start the music player to play your favorite songs, stop it when you want the music to stop, or check if it's currently playing. "systemctl" also helps your computer manage all kinds of services, like web servers, email services, or even programs that run in the background to keep your system running smoothly.
π³ Task 1: Installing Docker and Jenkins Using Package Managers
π Time to apply our package manager expertise! We'll now install Docker and Jenkins on Ubuntu using package managers. Let's dive in and get our hands dirty! π»
β’ Installing Docker on Ubuntu using APT
Update the package lists: π
sudo apt update
Install the Docker repository: π¦
sudo apt-get install docker.io -y
To check the version of the docker: π
docker version
β’ Installing Jenkins on Ubuntu using APT
To install Jenkins on Ubuntu using APT, follow these steps:
Jenkins requires Java to run, so we'll update the Debian apt repositories, install OpenJDK 17, and check the installation with the commands:
sudo apt update sudo apt install openjdk-17-jre java -version
Next, letβs install the Jenkins Long-Term Support release by using the below commands:
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
Start the Jenkins service:
sudo systemctl start jenkins
Enable Jenkins to start on system boot:
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 2: Checking the Status of the Docker Service
Now that Docker is set up on your system, let's see how to check its status using the "systemctl" command.
To check the status of the Docker service, simply run this command: π
systemctl status docker
The output will show you important details about Docker, such as whether it's running, enabled, and any recent log entries related to its activity. This helps you ensure that Docker is up and running smoothly on your system. ππ
π Task 3: Stopping the Jenkins Service
To stop the Jenkins service, you can use the following command:
sudo systemctl stop jenkins
Running this command will halt the Jenkins service, bringing it to a stop. It will no longer be running on your system until you start it again.
π‘ Difference between systemctl and service
systemctl
and service
are both commands used to manage services in Linux, but they have some differences in their functionality and usage.
systemctl:
systemctl
is a more modern and πΈ powerful service management utility introduced with systemd, which is the default init system in many modern Linux distributions.It provides β¨ extensive features for controlling services, including starting, stopping, restarting, enabling (starting at boot), disabling (not starting at boot), and checking the status of services.
Example: To check the status of the Docker service using
systemctl
, you would use the following command:systemctl status docker
service:
service
is a legacy command used in init-based systems (SysVinit) to manage services.It is still available in many Linux distributions for backward compatibility but is being phased out in favor of
systemctl
.service
provides a simpler interface for starting, stopping, and restarting services, but it has fewer features compared tosystemctl
. β³Example: To check the status of the Docker service using
service
, you would use the following command: πservice docker status
π Conclusion π
Congratulations on successfully completing Day 7 of the exhilarating #90DaysOfDevOps challenge! π Today, we dived into the fascinating world of packages and package managers, understanding their vital role in the Linux ecosystem. π¦ By exploring various package managers and mastering systemctl and systemd, we have gained the confidence to effortlessly handle services. π With Docker and Jenkins seamlessly installed using package managers, we have embraced simplicity and automation in our journey. π³π§ Now, you have the capability to monitor Docker's status and halt Jenkins with ease. π Furthermore, we have learned to differentiate between systemctl and service, ensuring proper and efficient service management. π‘ Keep up the fantastic work, and get ready for more thrilling adventures that lie ahead! πͺπ
Stay in the loop with my latest insights and articles on cloud βοΈ and DevOps π by following me on Hashnode, LinkedIn linkedin.com/in/sahil-kamble-40898b208
Thank you for reading! π Your support means the world to me. Let's keep learning, growing, and making a positive impact in the tech world together.