Day 7:Understanding package manager and systemctl

Day 7:Understanding package manager and systemctl

What is a package manager in Linux?

Package Managers are used to automate the process of installing, upgrading, configuring, and removing programs. There are many package managers today for Unix/Linux-based systems.

The package manager then finds the requested package from a known location and downloads it. Then installs the package and advise on any manual steps that it finds necessary.

There are several package managers available in Linux.YUM, APT, ZYpp, DNF

Every package manager has associated configuration files that point to repository locations. For example, in Ubuntu, /etc/apt/sources.list contains the locations of repositories.

What is a package?

A package includes the concerned software, which may be an application or shared library. If it's a development package, it will include source files to build your software that depends on a library.

Packages include metadata as well. This will include a summary, description, list of files, version, authorship, targeted architecture, file checksums, licensing, and dependent packages.

Different kinds of package managers

APT Package Manager:

APT (Advanced Package Tool) is a more advanced front-end for dpkg (Debian Package), the lowest-level package management system for Debian-based Linux distributions. APT is a powerful command-line package management tool providing an interface for better interactive usage. As with dpkg, APT can install, remove, and build packages.

The advanced functionality of APT is that it can update your packages and automatically install dependencies.

Used in Debian, Ubuntu, and other Debian-based distributions.

sudo apt-get update#update package lists

sudo apt-get install package_name#install a package

sudo apt-get upgrade#upgrade all installed packages

sudo apt-get remove package_name#remove a package

YUM Package Manager:

Just as APT is a more advanced front-end for dpkg, YUM (Yellow Dog Updater) is the most popular choice as a front-end for RPM, the basic package management software for RHEL operating systems.

YUM allows users to configure automated software updates and dependency resolution. It is possible to create local or offline copies of the repositories or access them via the Internet.

YUM can perform such operations as searching for packages in repositories, installing packages from repositories, installing packages from .rpm files, updating the system, removing packages, and downgrading packages.

Used in Red Hat, CentOS, and other Red Hat-based distributions.

sudo yum update#update package lists

sudo yum install package_name#install a package

sudo yum upgrade#upgrade all installed packages

sudo yum remove package_name#remove a package

ZYpp Package Manager:

ZYpp is the package management engine for OpenSUSE and SUSE Linux Enterprise. It is another dependency resolver for the RPM package management system. ZYpp is written in C++ and therefore is faster than YUM, which is written in Python.

Using ZYpp, you can use short commands that can be used instead of full commands. Zypper is ZYpp's command-line interface for installing, uninstalling, updating, and requesting software packages from a local or remote network.

sudo zypper refresh # update package lists

sudo zypper install package_name # install a package

sudo zypper update #upgrade all installed packages

sudo zypper remove package_name #remove a package

DNF Package Manager:

DNF (Dandified Packaging Tool) is a package manager that installs, updates and removes packages on RPM-based Linux distributions. It is a more advanced version of the YUM manager and is intended to be the replacement for YUM in RPM-based systems.

DNF was introduced in Fedora 18. Now, it is the default package manager of Fedora 22, CentOS8, and RHEL8.

dnf install package_name # install a package

dnf remove package-name #remove the package

dnf list # list information about all installed and available packages

dnf list --installed # list all packages installed on your system

Tasks:

  1. You have to install docker and Jenkins in your system from your terminal using package managers

    Write a small blog or article to install these tools using package managers on Ubuntu and CentOS

    Install docker on ubuntu:

    1. First, write apt-get update

    2. Then sudo apt-get install docker.io

    3. After installing docker check the status of docker -

      systemctl status docker

      Install docker on CentOS:

systemctl and systemd

Systemctl command manages both system and service configurations, enabling administrators to manage the os and control the status of services.

Systemctl is useful for troubleshooting and basic performance tuning.

The Systemctl command is the primary tool to manage systemd.

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

  1. Read about the commands systemctl vs service:

Systemctl command:

The systemctl command interacts with the SystemD service manager to manage the services. Contrary to service command, it manages the services by interacting with the SystemD process instead of running the init script.

Service command:

The service command guarantees a predictable running environment by removing most of the variables and setting the root path as the current working directory.

Thanks for Reading!!!!!!!