Day 8 Task: Understanding package manager and systemctl




  • What is a package manager in Linux?

In simpler words, a package manager is a tool that allows users to install, remove, upgrade, configure and manage software packages on an operating system. The package manager can be a graphical application like a software center or a command lines tool like apt-get or pacman.

You’ll often find me using the term ‘package’ in tutorials and articles, To understand package manager, you must understand what a package is.

  • What is a package?

A package is usually referred to as 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

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

For example, RPM has Yum and DNF, package managers. For DEB, you have apt-get, aptitude command line-based package managers.

  1. Tasks

  • Task 1: Install docker and Jenkins in your system from your terminal using package managers.

-???????Here are the steps to install docker and Jenkins, but this installation is for Ubuntu OS.

Docker Installation on Ubuntu:

  • Set up the repository

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 \

lsb-release



2.?????Add docker’s official GPG key


$ sudo mkdir -p /etc/apt/keyrings
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /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 \
? $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null        


Now, here begins the docker installation process,

1.?????Update the?apt?package index:

 $ sudo apt-get update         


2.?????Install Docker Engine, containerd, and Docker Compose.

$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin        


3.?????Verify that the Docker Engine installation is successful by running the?hello-world?image:

$ sudo docker run hello-world        


  • Jenkins Installation on Ubuntu:

Repository Setup :

1.?????Let's add the Jenkins official key using this command:


$ curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo tee \

/usr/share/keyrings/jenkins-keyring.asc > /dev/null


2.?????Let's add the repository using this command:


$ 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


Installation:

1.?????update the apt package index

$ sudo apt-get update


2.?????Install Jenkins

$ sudo apt-get install Jenkins


3.?????You can verify the installation by the following command:

$ Jenkins –version


Task 2: Systemctl vs Service


-???????systemctl?is basically a more powerful version of?the service.

-???????With?service,?you can only do commands related to the service (i.e.?status,?reload,?restart) whereas with?systemctl?you can use more advanced commands such as:


“systemctl is-failed name.service # check if service failed to load

要查看或添加评论,请登录

Mukesh Chaudhary的更多文章

社区洞察

其他会员也浏览了