Day 7 : Learning Package Manager & 'systemctl'

Day 7 : Learning Package Manager & 'systemctl'

What is Package, Package Manager, systemctl and service.

📦🏬What is a Package Manager?

Think of the Package Manager as a digital store or marketplace 🏬🎁 for software in your Linux system. It's like a collection of neatly organized packages, each containing a specific software application or tool.

📦What is a Package?

In Linux, a package is just a bundle containing a specific software application or tool. It's a small package that contains all of the files and instructions needed to install and run the software.🎁

📦🛠️What's inside of a package and how does it work?

The package usually includes the program itself, libraries, configurations, and any dependencies it relies on to work correctly.📦🤝 When you need new software or updates, the Package Manager helps you find and install them with ease. It fetches the required packages from a library of software available online.

📦Some Benefits of Package Manager

Easy Installation & Management

Using the Package Manager is effortless. With a simple command, you can install software and its necessary parts, making everything work together smoothly.

🔒Secure and Trustworthy

The Package Manager ensures the safety and reliability of software. It checks the authenticity of packages, acting like a gatekeeper 🔒👀 to prevent any potential risks.

🔄Updates with Ease

Keeping your software up-to-date is hassle-free with the Package Manager. A simple update command brings the latest improvements and bug fixes, just like keeping things fresh and current.

In summary, the Package Manager in Linux acts as a digital store for software, making installation and updates easy.👍 It ensures security, convenience, and reliability, offering a vast collection of software applications for your Linux system.💻💫

🌟🔧Different Kinds of Package Managers :

📦APT (Advanced Package Tool)

APT is responsible for managing packages in Debian-based systems. It helps you find and install software easily, taking care of dependencies like a thoughtful assistant.

🌽YUM (Yellowdog Updater Modified)

YUM is responsible for RPM-based systems. It fetches packages from a vast repository, ensuring smooth installation and updates.

🐕DNF (Dandified YUM)

DNF is like an upgraded version of YUM 🐕🔍, adding more efficiency and speed to package management on modern RPM-based systems.

✳Let's walk through a hands-on use case of a package manager, using apt, on Ubuntu:

Scenario: You want to install the popular web browser "Firefox" on your Ubuntu system.

Steps:

  1. Update Package Database: Open a terminal and update the package database to ensure you have the latest information about available packages:

     sudo apt update
    
  2. Search for the Package: Check if the package "firefox" is available using the package manager:

     apt search firefox
    
  3. Install the Package: If "firefox" is available, you can install it using the package manager:

     sudo apt install firefox
    
  4. Authenticate and Confirm: You'll be prompted to authenticate with your system password. Confirm the installation by typing 'Y' and pressing Enter.

  5. Wait for Installation: The package manager will download and install Firefox, along with any necessary dependencies.

  6. Access Firefox: Once installed, you can access Firefox by searching for it in the application menu or simply typing firefox in the terminal.

Using the apt package manager on Ubuntu, you've effortlessly added a new software package to your system, ensuring it's properly integrated and ready to use.

🔧🚀What are Systemctl and Systemd?

'Systemctl' and 'Systemd' play critical roles in managing and controlling various tasks on your computer in the vibrant world of Linux. They collaborate as a skilled manager and a well-coordinated team to ensure a smooth and organised computing experience.💻🔧

'systemctl' - Your Command Center 🔧

Imagine 'Systemctl' as your command centre, overseeing different services that run in the background of your Linux system. It starts, stops, enables, and disables services, keeping everything in order.

'systemd' - The Coordinated Team 🚀

Systemd is like a well-coordinated team, working together to manage crucial processes during your system's startup and operation. It ensures your system runs smoothly and perfectly in sync.

💠Think of it this way: systemctl is the remote control you use to manage your TV (services), and systemd is the team of experts working together to ensure your TV (system) functions flawlessly.⭐

Scenario: You want to manage the "nginx" web server using systemctl.

Steps:

  1. Check Service Status: Open a terminal and check the status of the "nginx" service using systemctl:

     systemctl status nginx
    
  2. Start the Service: If the service is not running, you can start it using systemctl:

     sudo systemctl start nginx
    
  3. Check Status Again: Check the status of the service again to ensure it's running:

     systemctl status nginx
    
  4. Stop the Service: Stop the "nginx" service using systemctl:

     sudo systemctl stop nginx
    
  5. Restart the Service: Restart the "nginx" service using systemctl:

     sudo systemctl restart nginx
    
  6. Enable Auto-Start: Enable the "nginx" service to start automatically at boot time:

     sudo systemctl enable nginx
    
  7. Disable Auto-Start: If needed, you can disable the auto-start of the "nginx" service:

     sudo systemctl disable nginx
    

Using systemctl and systemd, you've effectively managed the "nginx" service. You can apply similar steps to manage various other services on your Linux system.

In summary, systemctl is the control tool, while systemd is the behind-the-scenes team. They work hand-in-hand to ensure your Linux system functions smoothly and efficiently.🎯

📋Tasks:

💠Install 'Docker' in your system from your terminal using package managers on Ubuntu and CentOS.

The best way to install Docker is to follow the instructions given on their official site.

✳For Ubuntu:

  1. Update the apt package index and install packages to allow apt to use a repository over HTTPS:

     $ sudo apt-get update
     $ sudo apt-get install ca-certificates curl gnupg
    
  2. Add Docker’s official GPG key:

     $ 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
    
  3. Use the following command to set up the repository:

     $ 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
    
  4. Install Docker Engine, containerd, and Docker Compose:

     sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
    
  5. After installing, verify that the Docker Engine installation is successful by running the hello-world image.

      sudo docker run hello-world
    

    ✳For CentOS:

    1. Install the yum-utils package (which provides the yum-config-manager utility) and set up the repository.
    sudo yum install -y yum-utils
    sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
  1. Install Docker Engine, containerd, and Docker Compose:
    sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  1. Verify that the Docker Engine installation is successful by running the hello-world image.

     sudo docker run hello-world
    

💠Check the status of 'Docker' service in your system and post before and after screenshots.

❎Before:

✅After:


✉Endcard:

🎉 Thank you for joining me on this insightful journey into the world of DevOps!

❤ If you found this blog helpful and informative, don't forget to give it a like!

🔄 Share this valuable knowledge with your friends and colleagues, so they can also benefit from understanding the power of DevOps!

👉 Stay updated with my latest posts and never miss out on exciting content! Click that Follow button to join and stay in the loop!

Follow me on Linkedin --> abdallah-qamar 👔

Stay tuned for Day 8...👋

#DevOps #SoftwareDevelopment #Technology #FollowUs #LikeAndShare #StayInformed #90daysofdevops #linux 📚🔍🌈