Skip to main content

Command Palette

Search for a command to run...

Day 7: Understanding package manager and systemctl

Published
3 min read
Day 7: Understanding package manager and systemctl

What is a package manager in Linux?

A package manager is a software tool that helps users install, remove, update, and configure software packages on a Linux system. Package managers can be command line tools (CLI) or graphical user interface (GUI) applications.

What is a Package?

In Linux, a package is an essential compressed archive file that contains all the files that come with a software application. Packages can be:

  • Command-line utilities

  • GUI applications

  • Software libraries

Different kinds of package managers?

There are several package managers 📦 used in Linux to handle the installation, update, and removal of software packages. Here are some of the most common ones:

  1. APT (Advanced Package Tool): APT is used in Debian-based distributions such as Ubuntu. It uses .deb packages and includes tools like apt-get and aptitude for package management.

  2. YUM (Yellowdog Updater Modified): YUM is employed in Red Hat-based distributions like CentOS and Fedora. It uses .rpm packages and provides commands like yum for package management.

  3. DNF (Dandified YUM): DNF is the successor to YUM and is used in newer versions of Fedora and CentOS. It offers improvements over YUM in terms of performance and dependency resolution.

  4. Pacman: Pacman is the package manager for Arch Linux and its derivatives. It uses its own package format (.pkg.tar.xz) and provides commands like pacman for package management.

  5. Zypper: Zypper is used in openSUSE and SUSE Linux Enterprise. It manages packages in the .rpm format and offers features like package installation and dependency resolution.

  6. Snap and Flatpak: These are universal package formats that work across various Linux distributions. Snap is developed by Canonical and used in Ubuntu, while Flatpak is a cross-distribution format that can be used on multiple Linux flavors.

Each package manager has its own set of commands and features, tailored to the specific needs and package formats of the respective Linux distributions🐧.

Tasks

  1. Installing Docker in Ubuntu

    sudo apt-get update sudo apt-get install ca-certificates curl gnupg sudo install -m 0755 -d /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg sudo chmod a+r /etc/apt/keyrings/docker.gpg

    echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update

    sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

  1. Installing Jenkins in Ubuntu

    sudo wget -O /usr/share/keyrings/jenkins-keyring.asc
    https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc]
    https://pkg.jenkins.io/debian-stable binary/ | sudo tee
    /etc/apt/sources.list.d/jenkins.list > /dev/null
    sudo apt-get update
    sudo apt-get install jenkins

    Make sure you have java installed in your machine.

  2. Check the status of the docker service in your system then stop the service

  3. systemctl vs service

    The "systemctl status docker" command is used to check the status of the Docker service on a Linux system. It provides information about whether Docker is running, its current state, and any recent log messages related to Docker. Here's how to use it:

    1. Open a terminal window.

    2. Type the following command:

    3. Press Enter.

      The "service docker status" command is used to check the status of the Docker service on a Linux system using the service command, which is commonly used in some Linux distributions. However, the more modern and widely used command to check the status of Docker is "systemctl status docker." Here's how you can use both commands:

      1. Open a terminal window.

      2. Type the following command:

      3. Press Enter. This command will provide detailed information about the Docker service, including its current status, process ID, and recent log messages

This command will display information about the Docker service, including whether it is active and running, its process ID (PID), and any recent log messages that can help diagnose issues with Docker.

Please feel free to drop any queries if you have any.

Happy Learning!!!

More from this blog

My DevOps Journey

16 posts