📚Day 7 - Understanding Package Manager and Systemctl

📚Day 7 - Understanding Package Manager and Systemctl

💡What is a Package Manager in Linux?

A package manager in Linux is a tool that allows users to install, remove, upgrade, configure, and manage software packages on an operating system.

💡What is a Package in Linux?

In simple terms, a package in Linux is like a neatly wrapped box that contains a piece of software along with all the instructions needed to install, manage, and remove that software on your computer.

💡Different kinds of Package Managers

There are various kind package managers used in different Linux distributions:

  1. apt (Advance Package Tool): It is used in Debian-based system like Ubuntu and Debian. It's a high-level package management tool that works with the dpkg package format.

      sudo apt update # Update package lists
      sudo apt install package_name # Install a package
      sudo apt remove package_name # Remove a package
    
  2. yum (Yellowdog Updater, Modified): It Works with RPM to manage packages on Red Hat-based systems. It simplifies package management tasks and resolves dependencies.

      sudo yum install package_name # Install a package
      sudo yum remove package_name # Remove a package
    
  3. dpkg (Debian Package): The low-level package manager for Debian-based systems. It handles the installation and removal of individual packages.

      sudo dpkg -i package.deb #Install a package
      sudo dpkg -r package_name #Remove a package
    
  4. RPM (Red Hat Package Manager): It is Used in Red Hat-based systems such as Red Hat Linux, CentOS, and Fedora. RPM manages packages in these distributions.

      sudo rpm -ivh package.rpm #Install a package
      sudo rpm -e package_name #Remove a package
    

🔨Tasks:

🏷Docker Installation on your terminal using package managers.( Step by Step)

  • ◼️Installation of Docker on Ubuntu
sudo apt update # Update the Package
sudo apt-get install docker.io # Install Docker on Ubuntu
  • ◼️Check the status of docker service in your system
sudo service docker status # Check Docker Status

● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2024-02-02 05:50:50 UTC; 5min ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 2507 (dockerd)
      Tasks: 7
     Memory: 32.7M
        CPU: 318ms
     CGroup: /system.slice/docker.service
             └─2507 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
  • ◼️To Enable the Docker
sudo systemctl enable docker # To Enable the Docker

**Finally Docker works Proeperly.**

🏷Jenkins Installation on your terminal using package managers.( Step by Step)

  • ◼️Update Package List

         sudo apt update #Update Package List
    
  • ◼️Install Java Development Kit (JDK): Jenkins require Java to run.

        sudo apt install -y openjdk-11-jdk #Install Java 11
        java --version #Check Java Install or not
    
  • ◼️For Installing the Jenkins.

        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
    
  • ◼️Enable the Jenkins Service.

        sudo systemctl enable service
    

  • ◼️Start the Jenkins Service

        sudo systemctl start jenkins
    
  • ◼️Check Jenkins is Active or Not

        sudo systemctl status jenkins
    

  • ◼️If Jenkins is not active it shows

  • ◼️To Access your Jenkins Dashboard,

    1. Go to your EC2 Instance then,

    2. Go to security group -> Edit inbound Rules -> Add rule (8080) -> Anywhere-IPv4 -> Save it.

  • ◼️Then copy your EC2 Public IPv4 address, Go to Web Browser & paste [your_ip:8080]

  • ◼️You will get above path, Copy it & go to your terminal, Use cat before path.

    cat /var/lib/jenkins/secrets/initialAdminPassword

  • ◼️Paste it. You will get Administrator Password, Paste it on Jenkins Dashborad & click on Continue.

  • ◼️Then install plugins.

  • ◼️Finally your Jenkins Dashboard Open Successfully.🎊

💡systemctl and systemd

systemctl is used to examine and control the state of “systemd” system and service manager. systemd is system and service manager for Unix like operating systems(most of the distributions, not all).

🛫Conclusion

In summary, Linux package managers guarantees efficient software management through streamlined installations and dependency handling. Simultaneously, mastering systemctl within the systemd ecosystem ensures robust control over system services, managing dependencies, and providing centralized status monitoring.

Happy Learning :)