Day 7 Task: Understanding package manager and systemctl-Linux

Day 7 Task: Understanding package manager and systemctl-Linux

What is a package manager in Linux?

What are package managers In Linux Package Managers are essentially?software applications?that help users to Search, Download, Install, Remove, and Update software applications on their computer operating system. These can be either Command Line tools or a complete Graphical User Interface application.

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.

Task-1: You have to install docker and Jenkins in your system from your terminal using package managers

Steps to install Docker in Ubuntu operating System

  1. Open the terminal of your ubuntu os
  2. Remove any?docker files?that are running in the system, using the following command:? sudo apt-get remove docker docker-engine docker.io
  3. Check if the system is up-to-date using the following command:? sudo apt-get update
  4. Install Docker using the following command:? sudo apt install docker.io
  5. Install all the dependency packages using the following command:?? sudo snap install docker
  6. Before testing Docker, check the version installed using the following command: ?docker --version or docker -v

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Steps to install Jenkins in Ubuntu operating System

Step 1: Install Java

Jenkins requires the Java Runtime Environment (JRE).

1.?Check if you already have java?installed on your Ubuntu system:?java --version

2. Depending on which Java version you want to install, Java 8 or 11, run one of the following commands:

To install OpenJDK 8, run:? sudo apt install openjdk-8-jdk -y?

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

Step 2: Add Jenkins Repository

It is recommended to install Jenkins using the project-maintained repository, rather than from the default Ubuntu repository. The reason for that is because the Jenkins version in the default Ubuntu repository might not be the latest available version, which means it could lack the latest features and bug fixes.

1. Start by importing the GPG key. The GPG key verifies package integrity but there is no output. Run:

curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo tee /usr/share/keyrings/jenkins-keyring.asc > /dev/null

2. Add the Jenkins software repository to the source list and provide the authentication key:

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

Step 3: Install Jenkins

1. Update the system repository

sudo apt update

2. Install Jenkins by running:

sudo apt install jenkins -y

3. To check if Jenkins is installed and running, run the following command:

sudo systemctl status jenkins?

A bright green entry labeled?active (running)?should appear in the output, indicating that the service is running.

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Stop the service Jenkins and post before and after screenshots.

Before stop Jenkins service:

Use- sudo systemctl status jenkins

No alt text provided for this image

After stop Jenkins service:

Use- 1. First stop jenkins service: sudo systemctl stop jenkins

2. Then Check jenkins service: sudo systemctl status jenkins

No alt text provided for this image

Difference between systemctl and service command

  1. The?systemctl?command interacts with the SystemD service manager to manage the services. In?service?command, it manages the services by interacting with the SystemD process instead of running the init script.
  2. service is adequate for basic service management, while directly calling systemctl gives greater control options.
  3. systemctl is the main utility to control daemons/services in systemd, while the service command is the traditional utility in the SysVinit world.

To start, stop, and restart the service, we can run the respective commands with?systemctl:

1. To start Jenkins service Syntax:? sudo systemctl start jenkins

2. To stop Jenkins service Syntax:? sudo systemctl stop jenkins

3. To check Jenkins status Syntax:? sudo systemctl status jenkins

4. To enable Jenkins service Syntax:? sudo systemctl enable jenkins

To start, stop, and restart the service, we can run the respective commands with?service:

1. To start Jenkins service Syntax:? sudo service jenkins start

2. To stop Jenkins service Syntax:? sudo service jenkins stop

3. To check Jenkins status Syntax:? sudo service jenkins status

4. To enable Jenkins service Syntax:? sudo service jenkins enable


Thank you for reading this article...

Happy Learning!

Nitu Patil

Python Programming | SQL | Linux | MySQL | Flask | Django | Git & Github |

2 年

????

Shital Chaudhari

RPA Developer | Python | Data Analytics|Automation Anywhere 360 | MS SQL

2 年

Really informative....simply explained ??

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

Deepak Patil的更多文章

社区洞察

其他会员也浏览了