Jenkins and docker

Day7

Que 1) install docker and jenkins in your system from your terminal using package managers Answer :- Docker and Jenkins have been installed on the system using a package manager, Shown in below images.

Que 2) Write a small blog or article to install these tools using package managers on Ubuntu and CentOS Answer :- To install docker and Jenkins on ubuntu do following steps :- i) install docker -: Step 1: Update the Package Repository sudo apt-get update

Step 2: Install Prerequisite Packages :- The apt package manager requires a few prerequisite packages on the system to use packages over HTTPS. Run the following command to allow Ubuntu to access the Docker repositories over HTTPS:

sudo apt install apt-transport-https ca-certificates curl software-properties-common -y

Step 3: Add GPG Key :- A GPG key verifies the authenticity of a software package. Add the Docker repository GPG key to your system by running:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

The output should state OK, verifying the authenticity.

Step 4: Add Docker Repository :- Run the following command to add the Docker repository to apt sources:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"

Step 5: Specify Installation Source: Execute the apt-cache command to ensure the Docker installation source is the Docker repository, not the Ubuntu repository. The apt-cache command queries the package cache of the apt package manager for the Docker packages we have previously added.

apt-cache policy docker-ce

Step 6: Install Docker Install Docker by running:

sudo apt install docker-ce -y

ii) instaling jenkins :- step 1) update the system’s APT cache repository: sudo apt update

step 2) Type the command given below to install OpenJDK 11:

sudo apt install openjdk-11-jdk step 3) Jenkins can easily be installed on Ubuntu by importing and adding the GPG keys to the system. Now you got to add GPG keys:

wget -p -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -

step 4) After adding GPG keys, add the Jenkins package address to the sources list by typing the command given below:

sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

step 5) After enabling the Jenkins repository, simply update the system’s APT cache once.

sudo apt update

step 6) Let’s move forward and do the real work of installing Jenkins.

sudo apt install jenkins

Que 3) check the status of docker service in your system (make sure you completed above tasks, else docker won't be installed) Answer :- Check if Docker is installed, the daemon started, and the process is enabled to start on boot. Run the following command:

sudo systemctl status docker

Que 4) stop the service jenkins and post before and after screenshots Answer :- stop jenkins server using the following command :

sudo systemctl stop jenkins