Understanding Package Manager & Systemctl

Ahmed NisarAhmed Nisar
3 min read

What is a package manager in Linux📦🐧?

In simpler words, a package manager is like a digital toolbox that empowers users to easily:

🔹 Install 📥 🔹 Remove 🗑️ 🔹 Upgrade 🔄 🔹 Configure ⚙️ 🔹 Manage 🛠️

software packages on an operating system🖥️. It's like a software store for your Linux system! Package manager📦 come in two flavors:

➡️ Graphical Application 🖼️ - Think of it like a Software Center 🏬 where you can browse and pick your favorite apps with a click!

➡️ Command Line Tool ⌨️ - Get techy with commands like apt-get or pacman. 🤓 It's like speaking the language of computers!

What is a package📦?

A package is like a digital box! 📦 It's usually an application, but it can also be a GUI application 🖼️, a command line tool ⌨️, or even a software library 📚 (needed by other software programs). Imagine it as an archive file containing:

🔹 Binary Executable 🧙‍♂️ 🔹 Config Files 📜 🔹 Dependency information🧩

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 instance:

🔹 RPM has Yum & DNF package managers⌨️🔧 🔹 DEB, has apt-get, aptitude command line-based package managers⌨️🔧

Docker & Jenkins Installation Ubuntu & Redhat Distributions

You have to install 🐳docker and Jenkins in your system from your terminal using 📦package managers on 🐧Ubuntu and CentOS

  • Ubuntu Distribution

    • Docker

      • Check if docker is installed or not, then update & upgrade the system packages.

      • Installing the docker

      • Check if docker is installed

    • Jenkins

      • Jenkins requires Java to run, yet certain distributions don’t include this by default. First, install Java and then Jenkins.

      •   sudo apt update
          sudo apt install openjdk-17-jre
        
      •     curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee \
              /usr/share/keyrings/jenkins-keyring.asc > /dev/null
            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
        
      • Check if Jenkins is installed

  • Centos Distribution

    • Docker

      • Check if docker is installed or not, then update & upgrade the system packages.

        • Installing the docker

        • Check if docker is installed

      • Jenkins

        • Jenkins requires Java to run, yet certain distributions don’t include this by default. Initially, install the wget package to enable it to fetch the Jenkins repository, and subsequently, install Java & Jenkins.

        •     sudo yum install wget
              sudo wget -O /etc/yum.repos.d/jenkins.repo 
                  https://pkg.jenkins.io/redhat-stable/jenkins.repo
              sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
              sudo dnf upgrade
              # Add required dependencies for the jenkins package
              sudo dnf install java-17-openjdk
              sudo dnf install jenkins
              sudo systemctl daemon-reload
          
      • Check if Jenkins is installed

  • systemctl, service and systemd

    🔍systemctl: This command-line tool is like the conductor of an orchestra, helping you manage and observe the status of services and your system as a whole. It's used to interact with the 🧰systemd init system.

    ⚙️service: Relies on traditional init scripts for service management in older systems. It is like an old-school operator connecting calls. It's used to manage services on some 🖥️Linux distributions, especially those using the older System V init system like CentOS 6 and earlier.

    🧰systemd: Imagine it as the brain of the operation! It's a 🖥️system and service manager that handles how your computer starts up, shuts down, and manages various processes while it's running. It's like the heart of a Unix-like operating 🖥️system, ensuring everything works together harmoniously.

  • Tasks

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

    2. Stop the service Jenkins and post before and after screenshots

      Before:

      After:

0
Subscribe to my newsletter

Read articles from Ahmed Nisar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ahmed Nisar
Ahmed Nisar

AWS Devops | Linux | Docker | Jenkins | Terraform | Kubernetes | Ansible |