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. ๐Ÿ› ๏ธ๐Ÿ’ป

Youโ€™ll often find me using the term โ€˜packageโ€™ in tutorials and articles, To understand package manager, you must understand what a package is. ๐Ÿ“š๐Ÿง 

What is a package?

A package is usually referred to an application but it could be a GUI application, command line tool or a software library (required by other software programs). A package is essentially an archive file containing the binary executable, configuration file and sometimes information about the dependencies. ๐Ÿ“ฆ๐Ÿ“„๐Ÿ”

Different kinds of package managers

Package Managers differ based on packaging system but same packaging system may have more than one package manager.

For example, RPM has Yum and DNF package managers. For DEB, you have apt-get, aptitude command line based package managers. ๐Ÿ“ฆ๐Ÿ”ง๐Ÿ”„

๐Ÿณ๐Ÿ” Checking Docker Service Status:

Before we proceed, make sure you have completed the above tasks to ensure that Docker is installed on your system. If you haven't installed Docker yet, follow the previous steps, and then come back to this point. Docker is an essential tool for containerization, and it's crucial to have it set up correctly.

To check the status of the Docker service in your system, follow these steps:

  1. Open a terminal or command prompt on your system.

  2. Type the following command and press Enter:

sudo systemctl status docker ๐Ÿ“ Note: The "sudo" command is used to run the "systemctl" command with administrative privileges.

  1. The output will display the current status of the Docker service. You might see information like active, inactive, or any error messages if something went wrong during the installation or starting process.

๐Ÿ”ด๐Ÿ”ต Stopping Jenkins Service and Screenshots:

Now, let's proceed to stop the Jenkins service and take before and after screenshots.

  1. First, let's stop the Jenkins service using the following command:

sudo systemctl stop jenkins

  1. Once the service is stopped, take a screenshot of the current state of your system. This will serve as the "before" screenshot, showing Jenkins running or any relevant details you wish to capture.

  2. After taking the "before" screenshot, proceed to start the Jenkins service again with this command:

sudo systemctl start jenkins

  1. Once the service is started, take another screenshot of your system. This will be the "after" screenshot, showing Jenkins in a stopped state or any changes that occurred after stopping the service.

๐Ÿ“ธ It's a good practice to take screenshots before and after making changes to your system, as visual evidence can be valuable for future reference or troubleshooting.

๐Ÿค” Understanding systemctl vs. service:

Before we conclude, let's briefly discuss the difference between systemctl and service commands. Both commands are used to manage services in Linux systems, but they have some distinctions.

๐Ÿ”ธ systemctl: This is a more modern and powerful command used to control system services in newer Linux distributions that use systemd. It allows you to start, stop, restart, enable, disable, and get the status of services. For example:

sudo systemctl start serviceName

sudo systemctl stop serviceName

sudo systemctl restart serviceName

sudo systemctl enable serviceName

sudo systemctl disable serviceName

sudo systemctl status serviceName

๐Ÿ”ธ service: This is an older command used to control services in Linux distributions that use the traditional System V init system. While it can still work on newer systems thanks to compatibility layers, systemctl is recommended for systemd-based systems. Examples of using the service command:

sudo service serviceName start

sudo service serviceName stop

sudo service serviceName restart

๐Ÿ“ It's essential to know the difference between these commands, especially if you're working with different Linux distributions or managing services on various systems.

That's it for now! You've completed the tasks of checking the Docker service status, stopping Jenkins with screenshots, and learning about systemctl and service commands. Keep exploring and experimenting with these tools to enhance your Linux skills! Happy coding! ๐Ÿ˜Š๐Ÿง

0
Subscribe to my newsletter

Read articles from Saurabh Mathuria directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Saurabh Mathuria
Saurabh Mathuria