Day 7 Task: Understanding package manager and systemctl

Table of contents

What is Package Manager in Linux?

In Linux, a package manager is a software tool that is used to manage the installation, removal, and updating of software packages. A package manager provides a central repository of software packages, from which users can easily download and install applications.

The package manager keeps track of all the installed packages and their dependencies, ensuring that everything is up-to-date and compatible with the current system. This makes it easy to install new software and keep it updated, without having to worry about manual installation, configuration, or dependency management.

There are several package managers available in Linux, with the most common ones being:

  • APT (Advanced Package Tool): Used in Debian, Ubuntu, and other Debian-based distributions.

  • YUM (Yellowdog Updater Modified): Used in Red Hat, CentOS, and other Red Hat-based distributions.

  • Pacman: Used in Arch Linux and its derivatives.

  • Zypper: Used in openSUSE and SUSE Linux Enterprise.

Most package managers also provide a command-line interface, which allows users to easily install, update, and remove packages from the terminal. In addition, many Linux distributions also include graphical package managers, which provide a user-friendly interface for managing software packages.

Overall, package managers are a key component of Linux systems, providing a powerful and convenient way to manage software packages, keep systems up-to-date, and ensure that everything runs smoothly.

What is Package?

In Linux, a package is a compressed archive file that contains software, documentation, and metadata necessary for installation and management of software applications. A package typically includes the software application code, libraries, configuration files, and other related files.

Packages are designed to make it easy to install and manage software on Linux systems. The package manager system retrieves packages from software repositories and installs them on the system. The package manager system also manages dependencies, ensuring that all required components and libraries are installed along with the software package.

Packages are often distributed in a standard format, such as .deb (used in Debian, Ubuntu, and other Debian-based distributions) or .rpm (used in Red Hat, CentOS, and other Red Hat-based distributions). These standard formats enable package managers to work across different Linux distributions, making it easier to manage software across multiple systems.

In addition to software applications, packages can also include system updates, security patches, and other types of software components. This helps ensure that the entire Linux system stays up-to-date and secure, not just individual applications.

Different kind of package Managers

There are several different kinds of package managers available in Linux, each with its own unique features and functionality. Here are some of the most common types of package managers:

  1. Command-line package managers: These are package managers that are used via the terminal or command-line interface. Examples of command-line package managers include APT, YUM, Pacman, and Zypper.

  2. Graphical package managers: These are package managers that have a graphical user interface (GUI) for managing packages. Examples of graphical package managers include Synaptic, GNOME Software, and Discover.

  3. Language-specific package managers: These are package managers that are designed for specific programming languages, such as Ruby, Python, and Node.js. Examples of language-specific package managers include Bundler, pip, and npm.

  4. Source-based package managers: These are package managers that install software from source code, rather than from pre-built binary packages. Examples of source-based package managers include Portage (used in Gentoo) and ABS (used in Arch Linux).

  5. Container package managers: These are package managers that are used to manage software packages inside containers, which are isolated environments that can be used to run applications. Examples of container package managers include Docker and Kubernetes.

Each type of package manager has its own advantages and disadvantages, and the choice of package manager often depends on the specific needs of the user or organization. Some users prefer the flexibility and control of command-line package managers, while others prefer the ease-of-use of graphical package managers. Similarly, some developers prefer language-specific package managers that are tailored to their programming language of choice, while others prefer source-based package managers that give them more control over the installation process.

You have to install docker and jenkins in your system from your terminal using package managers

Install Docker by running the following command:

Installing Jenkin on Linux mahcine:

  1. Add the Jenkins repository key to your system:

  2. Add the Jenkins repository to your system's package sources:

  3. Update the package database with the new repository information:

  4. Install Jenkin:

  5. Start the Jenkins service:

systemctl and systemd

systemctl and systemd are two related components in modern Linux systems that are responsible for managing system services and processes.

systemd is a system and service manager for Linux, which replaces the traditional SysVinit system initialization system. It provides a range of features, including parallel startup of services, on-demand starting of daemons, process tracking using cgroups, and more.

systemctl is a command-line tool that is used to control and manage system services on Linux systems that use systemd. It can be used to start, stop, restart, enable, disable, and check the status of system services.

Some common systemctl commands include:

  • systemctl start <service>: starts a system service

  • systemctl stop <service>: stops a system service

  • systemctl restart <service>: restarts a system service

  • systemctl enable <service>: enables a system service to start automatically at boot time

  • systemctl disable <service>: disables a system servcheck the status of docker service in your system (make sure you completed above tasks, else docker won't be installed)ice from starting automatically at boot time

  • systemctl status <service>: checks the status of a system service

In summary, systemd is the underlying system and service manager on Linux systems that use it, and systemctl is a command-line tool that provides an interface for managing system services using systemd.

1. check the status of docker service in your system (make sure you completed above tasks, else docker won't be installed)

To check the status of docker, we will use the command as below: