Day 4: Linux Package Manager

In this blog, we will understand package manager and systemctl. Package manager allows us to easily install new software, upgrade the software to newer versions, or remove software that you previously installed.

1: Package Management:

The package manager can be a graphical application like a software center or a command line tool like apt-get or Pacman. A package manager 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, a package is a format that contains all the necessary files and information that are required to install and manage a specific application.

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.

APT (Advanced Package Tool) - APT is a command-line tool, which works with Ubuntu’s Advanced Packaging Tool (APT). Some examples used for the apt utility include:

  • sudo apt-get install package_name - Install the Package

  • sudo apt-get update followed by sudo apt-get upgrade - Update the Package

YUM (YellowDog update Manager) - YUM provides a command-line interface for managing packages in RHEL.

  • sudo yum install package_name - Install the package

  • sudo yum update & sudo apt-get upgrade - Update the Package

  • sudo yum remove package_name - Remove the Package

RPM (Red Hat Package Manager) - It is an open-source package manager (default) and the most famous utility of package management for Red Hat-based systems such as Fedora, CentOS, and RHEL.

  • sudo apt install rpm - Install the Package

Below is some example of installing Docker & Jenkins using Package Manager.

TASK 1: Installing Docker on Ubuntu using APT:

  1. Open the terminal on Ubuntu:

  2. Check if the system is up-to-date:

    sudo apt update

  3. Install Docker using the following command:

    sudo apt-get install docker.io -y

    • check the version installed using the following command: docker --version

TASK 2: Install Jenkins with Ubuntu

Step 1: Install Java

Jenkins requires the Java Runtime Environment (JRE).

  1. java --version To check the latest Java version if Java is already installed on the system.

2. Install OpenJDK 8, : sudo apt install openjdk-8-jdk -y

install OpenJDK 11, run: sudo apt install openjdk-11-jdk -y

Step 2 : Add Jenkins

1. Import GPG Key by using the below command

The GPG key verifies package integrity but there is no output.

COPY

    curl -fsSL https://pkg.jenkins.io/debian/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 binary/ | sudo tee \
      /etc/apt/sources.list.d/jenkins.list > /dev/null

2. Update and install the Jenkins

sudo apt update

sudo apt install jenkins -y

Step 3 : Stop the service jenkins and post before and after screenshots.

Before:

After:

TASK 3:

systemctl and service are both commands used to manage services in Linux, but they have some differences in their functionality and usage.

systemctl: The systemctl command interacts with the SystemD service manager to manage the services.

services: It manages the services by interacting with the SystemD process.

It provides controlling services like Start, Stop, restart, enable, and disable.

systemctl start jenkins - This is a command to start the Jenkins services.

Service jenkins status - This is a command to check the status of Jenkins Services.

Thank you for reading this Blog.

Happy Learning! :)

0
Subscribe to my newsletter

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

Written by

RAKESH REVASHETTI
RAKESH REVASHETTI

I'm Rakesh, a DevOps engineer who enjoys automation, continuous integration and deployment. With good hands-on experience in DevOps & cloud technology, i'm proficient in various tools and technologies related to infrastructure automation, containerization, cloud platform, monitoring and CI/CD.