Understanding of package manager and systemctl in Linux.

Understanding of package manager and systemctl in Linux.

ยท

5 min read

Package manager:

A package manager in Linux is a tool that allows users to install, remove, upgrade, configure, and manage software packages on an operating system. Package managers can be graphical applications like a software center or command line tools like apt-get or Pacman.

Package managers can:

  • Search, download, install, remove, and update software applications.

  • Keep track of software updates from specific repositories (repos) in the Linux system.

  • Allows you to install new or upgraded software directly across a network.

  • Tell you what software package a particular file belongs to or what files a package contains.

List of package managers in Linux:

  1. apt (Advanced Package Tool) - A package management system primarily used in the Debian family of Linux distributions, including Ubuntu, Linux Mint, and Debian itself. apt allows users to install, upgrade, and remove software packages through a command-line interface or a graphical package manager.

  2. Pacman - Pacman is the default package manager for Arch Linux, a minimalist, rolling-release distribution. It provides a simple and efficient way to install, update, and manage packages on an Arch Linux system. Pacman is known for its fast operation and built-in dependency resolution.

  3. DNF(DNF Package Manager) - DNF is a package manager used in the Red Hat family of distributions, including Fedora, CentOS, and RHEL (Red Hat Enterprise Linux). It replaces the older YUM package manager and offers improvements in speed, dependency resolution, and overall performance.

  4. pip (Pip Installer) - Pip is the standard package manager for Python, used to install and manage third-party packages for the Python programming language. It simplifies the process of finding, downloading, and installing Python packages from the Python Package Index (PyPI) or other package repositories.

  5. brew (Homebrew Package Manager) - Brew is a package manager designed for macOS systems. It provides a simple way to install and manage software packages, libraries, and development tools directly from the command line. Brew is known for its ease of use and extensive library of community-supported packages.

  6. yum (Yellowdog Updater Modified) - Yum is a package manager used in some older versions of Linux distributions, such as older versions of CentOS and RHEL. It has been replaced by dnf in newer versions. Yum allows users to install, update, and remove packages and handles dependencies automatically.

  7. zypper - Zypper is the default package manager for openSUSE and SUSE Linux Enterprise. It provides similar functionality to other package managers, allowing users to install, update, and remove software packages.

  8. portage - Portage is the package manager used in Gentoo Linux, a highly customizable, source-based distribution. Portage compiles packages from source code when installing and allows users to customize the compilation options for maximum flexibility.

  9. APK (Alpine Package Keeper) - APK is the package manager used in Alpine Linux, a lightweight distribution commonly used in containerized environments. APK is designed to be small and fast and provides package management for the Alpine Linux system.

  10. Chocolatey - Chocolatey is a package manager for Windows. It allows users to install, upgrade, and manage software packages from the command line or through a graphical user interface. Chocolatey has a vast community repository of software packages that can be easily installed on Windows systems.

Package:

A package in Linux is a compressed software archive file containing all the files included with a software application that provides any functionality.

systemctl and systemd:

Systemd and systemctl are core components of modern Linux operating systems that manage system services, processes, and other aspects of system initialization and management. They have replaced the traditional SysV init system on many Linux distributions.

Systemd:

Systemd is a system and service manager that provides a range of features for managing processes and services on a Linux system. It is designed to improve the initialization process and offer better control and monitoring of system services.

The systemd command allows users to interact with the systemd system and service manager, and provides a way to manage command line arguments for various systemd-related tasks.

Some key features of systemd include:

  • Service Management: It allows you to define and control system services using unit files. Each service or target in the system is represented by a unit file, which specifies how the service should be started, stopped, and managed.

  • Dependency Management: Systemd handles service dependencies, ensuring that services are started or stopped in the correct order.

  • Logging: Systemd includes its own logging system, called systemd-journald, which centralizes system logs and provides advanced logging features.

  • Cgroup Management: It manages control groups (cgroups), allowing resource management and monitoring of processes and services.

  • Security: Systemd includes various security features, such as service sandboxing and the ability to drop privileges for improved security.

Systemctl:

Systemctl is a command-line utility used to interact with systemd. It allows you to manage system services and view their status. Common systemctl commands include:

systemctl start service-name: Starts a service.

systemctl stop service-name: Stops a service.

systemctl restart service-name: Restarts a service.

systemctl status service-name: Displays the status of a service.

systemctl enable service-name: Enables a service to start at boot.

systemctl disable service-name: Disables a service from starting at boot.

systemctl list-units --type=service: Lists all active services.

Some common use cases for systemctl include system maintenance, troubleshooting, and deploying applications.

Task :

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

    Installing Docker On Ubuntu:

    The following are the commands we need to add in CLI to install docker.

    Installing Docker On CentOS:

    On CentOS, you can use the yum package manager to install Docker. Follow these steps:

    1. Update the package list:sudo yum update

    2. Install the required dependencies:sudo yum install -y yum-utils device-mapper-persistent-data lvm2

    3. Add Docker's repository:sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

    4. Install Docker:sudo yum install -y docker-ce docker-ce-cli containerd.io

    5. Start the Docker service and enable it to start on boot:sudo systemctl start docker sudo systemctl enable docker

    6. Verify the Docker installation:sudo docker --version

Installing jenkins On Ubuntu:

To install following commands needs to enter in CMD.

For more please refer following links:

https://www.jenkins.io/doc/book/installing/linux/#debianubuntu

https://docs.docker.com/engine/install/ubuntu/

see you on Day 8....๐Ÿ˜Š!!!!!

ย