Day 7 of 90 Days of DevOps: Understanding package manager and systemctl

Day 7 of 90 Days of DevOps: Understanding package manager and systemctl

·

3 min read

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 lines 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 as 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.

The Role of Package Managers in Linux

Package managers are fundamental tools that automate the process of managing software on Linux systems. They handle the installation, upgrade, configuration, and removal of software packages, ensuring that software dependencies are satisfactorily resolved. This automation significantly simplifies the process of maintaining a Linux system, allowing administrators to manage software efficiently and reliably.

Different kinds of package managers

Package Managers differ based on the packaging system but the 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.

Basic Commands of Package Managers

  • Installation: Install a package. E.g., apt install <package_name> for APT.

  • Update: Refresh the repository index to get the latest version of packages. E.g., apt update for APT.

  • Upgrade: Upgrade all the system’s packages to their latest versions. E.g., apt upgrade for APT.

  • Removal: Remove a package from the system. E.g., apt remove <package_name> for APT.

systemctl and systemd

systemctl is used to examine and control the state of “systemd” system and service manager. systemd is system and service manager for Unix-like operating systems(most of the distributions, not all).

Key Features of systemctl

  • Service Management: Start, stop, restart, and check the status of services.

  • System Initialization: Define and manage services and processes that run at system boot.

  • Logging and Monitoring: Access system logs and monitor the status of services and units.

Some Basic Packages Updation and Commands

sudo apt install docker.io #It is used to install docker by using the root preoilages 

sudo systemctl status docker #Used ton check the status of docker service or docker daemon running or not

sudo systemctl stop docker # To stop the docker service

sudo systemctl restart docker #TO Restart a service

sudo systemctl enable docker # Used to start the service once the system reboots

Conclusion

Understanding package managers and systemctl is essential for effective Linux system administration. Package managers simplify software management, ensuring that systems stay updated and secure, while systemctl provides powerful control over system services and resources. Mastering these tools allows administrators to maintain robust, efficient, and reliable Linux environments, paving the way for smooth operations and minimized downtime.