Understanding package manager and systemctl (day-7-task)

Understanding package manager and systemctl (day-7-task)

  • What is a package manager in Linux?

In Linux, a package manager is a software tool that helps manage the installation, removal, and updating of software packages on a system.

  • What is a package?

In the context of software, a package is a collection of files and metadata that make up a software application or library.

A package is usually referred to an application but it could be a GUI application, command line tool or a software library (required by other software programs). A package is essentially an archive file containing the binary executable, configuration file and sometimes information about the dependencies.

  • Different kinds of package managers

    (Examples of package managers in Linux)

apt-get and dpkg in Debian/Ubuntu,

yum and rpm in Red Hat and CentOS,

pacman in Arch Linux, and

zipper in OpenSUSE.

1.You have to install docker and jenkins in your system from your terminal using package managers.

Here are the commands to install Docker and Jenkins on Ubuntu using package managers:

To Install Docker:

  1. Update the system package list:
sudo apt-get update
  1. install docker.io:
sudo apt-get install docker.io
  1. check the status of the docker service

     sudo systemctl status docker
    

  2. Give permissions to docker by adding current user in docker group .

      sudo usermod -a -G docker $user
    
  3. Reboot system

sudo reboot

#docker is successfully installed and permissions are given.

To Install Jenkins:

  1. Update the package list:
sudo apt-get update
  1. Install OpenJDK (To install java it is mandetory) :
sudo apt-get install openjdk-11-jrk
  1. Add the Jenkins repository to APT sources:
curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee \
  /usr/share/keyrings/jenkins-keyring.asc > /dev/null
  1. Add the Jenkins repository to APT sources:
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
  1. Update the package database with the Jenkins packages:
sudo apt-get update
  1. Install Jenkins:
sudo apt-get install jenkins
  1. Start the Jenkins service:
sudo systemctl start jenkins
  1. Check the status of the Jenkins service:
sudo systemctl status jenkins
  • stop the service jenkins and post before and after screenshots

  • Before

  • After

Note: These commands assume that you are running Ubuntu as your operating system. The package manager used is APT. If you are using centOs use "yum install" in the place of "apt-get install" .

2.systemd

systemd is a system and service manager for Linux operating systems that has replaced the traditional SysV init scripting system. It is responsible for starting and managing system services, controlling system resources, and providing interfaces for system state management.

3.systemctl

systemctl is a command-line interface that allows users to interact with systemd to manage system services and system state. Here are some examples of systemctl commands:

  • systemctl start <service> - Start a system service.

  • systemctl stop <service> - Stop a system service.

  • systemctl restart <service> - Restart a system service.

  • systemctl enable <service> - Set a system service to start automatically at boot.

  • systemctl disable <service> - Prevent a system service from starting automatically at boot.

  • systemctl status <service> - Check the status of a system service.

  • systemctl reload <service> - Reload the configuration of a system service without stopping or starting it.

  • systemctl mask <service> - Mask a system service, preventing it from being started or enabled.

  • systemctl unmask <service> - Unmask a system service, allowing it to be started or enabled.

These commands can be useful for managing system services on Linux systems, including starting, stopping, and monitoring services as well as configuring which services start at boot.

Thank you,