#Day7:- 90 Days DevOps Challenge @Understanding Package Manager And Systemctl

#Day7:- 90 Days DevOps Challenge @Understanding Package Manager And Systemctl

A Comprehensive Overview of Package Managers and Systemctl in Linux Systems

📦What is a package manager in Linux?🐧

A package manager is a handy tool used in Linux systems to install, manage, update, and remove software packages. It simplifies the process of handling software by automating the installation and resolving dependencies (additional software required for the package to work properly). 🚀

Example: One popular package manager in Linux is "apt" used in Debian and Ubuntu-based systems. To install a package using "apt," you can simply open a terminal and type:

sudo apt install packageName

Replace packageName with the name of the software you want to install. The package manager will take care of the rest! 😎

🧳What is a package?📦

A package is like a gift box that contains various software or programs bundled together. It makes it easy to distribute and install software on your computer. Packages typically include the software's code, libraries, and other necessary files.

Example: 📦🐧 If you use a package manager like "apt" on Debian/Ubuntu or "dnf" on Fedora, you can use it to download and install packages like "vim" (a text editor) with a single command, taking care of all dependencies and setup automatically.

🔰Beginner-Friendly Example: 🎁 Imagine a "Photo Editing Package" that includes a photo editing program, filters, fonts, and tools to enhance your images.

📦Different kinds of package managers:

Package Managers differ based on packaging systems, but the same packaging system may have more than one package manager. 📦🤖

For example, RPM has two popular package managers - Yum and DNF. 🐧🔍 For DEB packages, you can use apt-get or aptitude as command-line-based package managers. 📝💻 These package managers act as your trusty companions, helping you find, install, and manage software efficiently on your Linux system.👨‍💻

🏃‍♂️Let's use Ubuntu's package managers to install Docker and Jenkins! 🐧📦🚀

🐳Installing Docker:

In this case, Docker can be installed by using the following command: sudo apt install docker.io in the terminal.

Absolutely! After running the sudo apt install docker.io command, don't forget to execute the following commands to ensure Docker runs smoothly on your Ubuntu system:

  1. Start the Docker service:

     sudo systemctl start docker
    
  2. Enable Docker to start on boot:

     sudo systemctl enable docker
    
  3. Check the Docker status:

     sudo systemctl status docker
    

When you run the docker status command, it will show you the following output, confirming that Docker is installed properly on your system. 🐳💻

🧣Installing Jenkins:

🔰Use the steps to install Jenkins on Ubuntu using the apt package manager👨‍💼:

1️⃣ Install Java Development Kit (JDK) if you haven't already, as Jenkins requires Java to run. Download it from the official Jenkins website.#Just copy and paste the commands in your terminal.

:

2️⃣ Now install Jenkins for Ubuntu:

Copy the above code and paste into your terminal.

  1. Start the Jenkins service:

     sudo systemctl start jenkins
    
  2. Enable Jenkins to start on boot so that it launches automatically after a system reboot:

     sudo systemctl enable jenkins
    
  3. Status Of Jenkins:

     sudo systemctl status jenkins
    

    🔰📝NOTE:- After executing the status command it will give you the below output to ensure that your Jenkins is installed properly in your terminal🐢.

  4. To access the Jenkins web interface, open your web browser and navigate to: localhost:8080 You will be prompted to unlock Jenkins by entering the initial administrator password. Retrieve the password from the following file:

    NOTE:- In the place of local host you can put your ipv4 address.e.g.:- http://10.58.100.187:8080/.
    💫Before accessing Jenkins, add port 8080 to your instance's security group.

    💫Then run the provided URL in your web browser for Jenkins setup. 🌐🔧

    After run the url you will get the below output:-

    Copy the 🍎red line and paste on the terminal by adding sudo cat in the prefix.

  5. Now copy the displayed code.

  6. Paste on Jenkins administrator password.

  7. Follow the on-screen instructions to complete the Jenkins setup, including installing suggested plugins and creating an admin user

😕How To Stop A Jenkins🧣

As Previously we have used "sudo systemctl start jenkins" to start the jenkins similarly we will use the "sudo systemctl stop Jenkins" to stop the Jenkins

Before Stop:

After Stop:

That's all about Jenkins and ready to automate your continuous integration and continuous delivery processes on your Ubuntu system. 🚀🤖

🔧 What is Systemctl and Systemd ?🔧

💫Systemctl is like the master control 🎛️ for managing services on your Linux system. It's a command-line tool that allows you to start, stop, restart, enable, disable, and monitor services effortlessly.

💫Systemd, on the other hand, is the superhero 🦸 behind the scenes, a powerful system and service manager. It's responsible for initializing the system during boot 🚀 and managing all processes, making sure your Linux system runs smoothly. 😊💻

🔧 systemctl vs. service - Understanding the Difference 🔧

🧑‍💻Systemctl and service are both commands used to manage services on a Linux system, but they have some differences in usage and capabilities. 🐧🛠️

🔹 Systemctl: Systemctl is a more modern and advanced command that comes with the Systemd init system, which is commonly used in newer Linux distributions. It provides extensive control and management over services and targets. Some common systemctl commands include:

  • 🚀 systemctl start <service>: Start a service.

  • 🛑 systemctl stop <service>: Stop a service.

  • 🔁 systemctl restart <service>: Restart a service.

  • 📅 systemctl enable <service>: Enable a service to start on boot.

  • 🚫 systemctl disable <service>: Disable a service from starting on boot.

  • ℹ️ systemctl status <service>: Check the status of a service.

🔹 Service: Service is a command that was commonly used with traditional init systems like SysV init. It is simpler in syntax compared to systemctl. Though service is still available in many distributions, systemctl has become the standard for managing services. Some common service commands include:

  • ▶️ service <service> start: Start a service.

  • ⏹️ service <service> stop: Stop a service.

  • 🔄 service <service> restart: Restart a service.

  • 📊 service <service> status: Check the status of a service.

In summary, while both systemctl and service can manage services, systemctl is more feature-rich and is recommended for use on systems that utilize Systemd as their init system. However, the service command is still available and can be used on systems that have not yet transitioned to Systemd. 🤝👨‍💻

🥅🔚Conclusion

In day 7 of the #90DaysDevOps challenge, we learned about Linux package managers and their role in installing, managing, and configuring software packages. We explored different package managers like Yum, DNF, apt-get, and aptitude.

Additionally, we understood the significance of systemctl and systemd in managing system services. We installed Docker and Jenkins using package managers on both Ubuntu and CentOS.

Lastly, we compared systemctl and service commands for service management. Overall, the day was filled with valuable insights into package management and system control in Linux. 📦🐧🔧🐳

Feel free to reach out if you have any questions or need further assistance🚀 by following me on Hashnode, LinkedIn (linkedin.com/in/mahesh-verma-441178250), and GitHub (https://github.com/maheshverma123)