Docker and jenkins installation step by step. day -07 0f #90DaysofDevops challenge.
This article clarifies package manager, docker and Jenkins installation, and the distinction between systemctl and service.

Task A - Explain package and package managers in Linux.
1 .What is a package manager in Linux?
Imagine your computer is like a big playground with lots of toys (software programs) you can play with. Sometimes you want new toys to play with, and other times you want to share your toys with friends.
A package manager in Linux is like a magical toy shop or a toy-sharing service for your computer. It's a special program that helps you easily find, install, and manage all the software (toys) you need or want to use on your Linux computer.
Instead of searching the internet for each individual software toy and manually downloading and installing them, you can just ask the package manager what you want, and it will find and install it for you. This way, you save time and effort.
The package manager also takes care of keeping your toys up to date. Whenever a new version of a toy is available, the package manager will let you know and update it with just a few clicks.
Moreover, if you want to remove a toy you no longer need, the package manager can help you with that too. It makes sure all the pieces of the toy are cleaned up properly, so you don't leave any mess behind.
In short, a package manager is like a helpful toy shop for your computer, making it easy to find, install, and manage all the software you want to play with. It takes away the hassle and keeps your computer's toy collection in order.
2. What is a package?
In the context of a package manager in Linux, a package is a neatly bundled and organized collection of software files and information that make it easy to install, manage, and uninstall software on your computer.
Think of a package as a gift box that contains everything needed to set up a specific software program. It includes the actual software code, configuration files, documentation, and sometimes other dependencies (like additional toys required to make the main toy work properly).
Each package is designed to work smoothly with your Linux system and is often tested by the Linux distribution maintainers to ensure it is safe and reliable.
When you use a package manager to install software, it goes to its magical toy shop (online repositories or servers), finds the appropriate package for the software you want, and then downloads and installs it onto your computer. The package manager also takes care of setting everything up correctly, so you can start using the software right away.
The beauty of packages is that they simplify the process of managing software on your Linux computer. Instead of manually searching, downloading, and configuring each software application, you can rely on packages and the package manager to handle all of that for you, making software management a breeze!
3. What are Different kinds of package managers?
There are several different kinds of package managers used in various operating systems and distributions. Let's take a look at some of the main types:
APT (Advanced Package Tool): APT is a package manager used primarily in Debian-based Linux distributions like Debian itself, Ubuntu, Linux Mint, and others. It uses the
.debpackage format and relies on online repositories to fetch and install software.dpkg: While not a package manager itself,
dpkgis a lower-level tool used in conjunction with APT in Debian-based systems. It handles the installation and removal of individual.debpackages.RPM (Red Hat Package Manager): RPM is a package manager used mainly in Red Hat-based Linux distributions like Red Hat Enterprise Linux (RHEL), CentOS, Fedora, and others. It utilizes the
.rpmpackage format.DNF (Dandified Yum): DNF is a modern and improved version of the YUM package manager used in Fedora and other RPM-based systems. It handles package installation, dependency resolution, and updates.
Pacman: Pacman is the package manager used in Arch Linux and its derivatives, such as Manjaro. It uses the
.pkg.tar.xzpackage format and is known for its simplicity and speed.Homebrew: Homebrew is a popular package manager for macOS. It allows users to install software packages and libraries easily through the command line.
Chocolatey: Chocolatey is a package manager for Windows that enables users to install and manage software packages using a command-line interface.
Snap: Snap is a universal package manager used in various Linux distributions, such as Ubuntu, Debian, Fedora, and more. It provides sandboxed applications and is designed to work across different distributions.
Flatpak: Flatpak is another universal package manager for Linux that focuses on providing sandboxed applications, allowing them to run on various distributions.
Conda: Conda is a package manager widely used in the data science and scientific computing community. It is language-agnostic and works on Windows, macOS, and Linux, allowing the installation of libraries and software packages.
Each package manager has its strengths and is tailored to work with specific operating systems or distributions. The choice of package manager often depends on the distribution or OS you are using and the type of software you wish to install and manage.
Task -B
You have to install Docker and Jenkins in your system from your terminal using package managers
Install from a package
If you can’t use Docker’s apt repository to install Docker Engine, you can download the deb file for your release and install it manually. You need to download a new file each time you want to upgrade Docker Engine.
Select your Ubuntu version in the list.
Go to
pool/stable/and select the applicable architecture (amd64,armhf,arm64, ors390x).Download the following
debfiles for the Docker Engine, CLI, containerd, and Docker Compose packages:containerd.io_<version>_<arch>.debdocker-ce_<version>_<arch>.debdocker-ce-cli_<version>_<arch>.debdocker-buildx-plugin_<version>_<arch>.debdocker-compose-plugin_<version>_<arch>.deb
Install the
.debpackages. Update the paths in the following example to where you downloaded the Docker packages.$ sudo dpkg -i ./containerd.io_<version>_<arch>.deb \ ./docker-ce_<version>_<arch>.deb \ ./docker-ce-cli_<version>_<arch>.deb \ ./docker-buildx-plugin_<version>_<arch>.deb \ ./docker-compose-plugin_<version>_<arch>.debThe Docker daemon starts automatically.
Verify that the Docker Engine installation is successful by running the
hello-worldimage.$ sudo service docker start $ sudo docker run hello-worldThis command downloads a test image and runs it in a container. When the container runs, it prints a confirmation message and exits.
You have now successfully installed and started Docker Engine.
INSTALLING JENKINS USING PACKAGE MANAGER
Jenkins official website
Jenkins requires Java 11 or newer
Beginning with Jenkins 2.357 (released on June 28, 2022) and the forthcoming 2.361.1 LTS release, Jenkins requires Java 11 or newer. Additionally, beginning with Jenkins 2.355 (released on June 14, 2022) and Jenkins 2.346.1 LTS (released on June 22, 2022), Jenkins supports Java 17. Plugins have already been prepared in JENKINS-68446. Use the Plugin Manager to upgrade all plugins before and after upgrading to Jenkins 2.357.
apt-get install fontconfig openjdk-11-jre
yum install fontconfig java-11-openjdk
zypper install dejavu-fonts fontconfig java-11-openjdk
By virtue of not requiring any custom repositories, this is certainly the simplest method (and the one used by the Jenkins project’s packaging tests), but it does not give the user a high degree of control over the Java runtime environment. As mentioned previously, the official Jenkins Docker images use Adoptium/Eclipse Temurin (as does the Jenkins infrastructure project). Enthusiastic users may wish to install Java from Adoptium or another vendor. Adoptium recently began providing Linux installation packages, as described in a piece by George Adams. Ultimately, the choice of which Java vendor to use is your own, as long as that vendor provides Java 11 or Java 17. Refer to your chosen Java vendor for installation instructions.
Once you have installed a suitable version of Java, configure Jenkins to use that Java runtime. The most straightforward way is to configure that version of Java as the default version of Java at the operating system (OS) level:
update-alternatives --config java
alternatives --config java
update-alternatives --config java
Alternatively, users who do not wish to change the default version of Java can customize the JAVA_HOME or JENKINS_JAVA_CMD environment variable as part of the Jenkins systemd(1) service unit. Refer to the Managing systemd services section of the Jenkins documentation for more information.
After that go to the jenkins official website
Then go to the the download option .
Then Jenkins download and deployment
Page will open
: scroll down the page and select jenkins for different version like ubuntu, debian, openSuse, fedora, redhat.
: you have to select
Then type the following command
Jenkins Debian Packages
Important Notice: Beginning with LTS 2.387.2 and weekly 2.397, releases will be signed with a new GPG key.
Administrators must install the new key on their servers before attempting to update Jenkins.

This is the Debian package repository of Jenkins to automate installation and upgrade. To use this repository, first add the key to your system:
curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee \
/usr/share/keyrings/jenkins-keyring.asc > /dev/null
2. Then add a Jenkins apt repository entry:
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
3. Update your local package index, then finally install Jenkins:
sudo apt-get update
sudo apt-get install fontconfig openjdk-11-jre
sudo apt-get install jenkins
4. [optional ]The apt packages were signed using this key:
pub rsa4096 2023-03-27 [SC] [expires: 2026-03-26]
63667EE74BBA1F0A08A698725BA31D57EF5975CA
uid Jenkins Project
sub rsa4096 2023-03-27 [E] [expires: 2026-03-26]
You will need to explicitly install a supported Java runtime environment (JRE), either from your distribution (as described above) or another Java vendor (e.g., Adoptium).
After step 3 CHECK THE RUNNING STATUS OF JENKINS BYTH E FOLLOWING COMMAND
A: Sudo sysytemctl status jenkins
If the Jenkins is active then open the local host ,if its is not active then type this command 👍
B: Sudo systemctl start jenkins
Then check again status,
C: Sudo sysytemctl status jenkins
It should display the terminal running like this 👍
Post installation
1. Now you have to go to the local host port no. 8080
Like this http://localhost:8080/login?from=%2F
Copy the address and paste it into the terminal with the following command:
sudo more /var/lib/jenkins/secrets/initialAdminPassword
After the command if it is asking the password then type the user password for kulwinder and enter .
In next line it will display the administrator password for jenkins page which is opened on the localhost:8080
Copy this password paste it here
TASK
check the status of docker service in your system
stop the service jenkins and post before and after screenshots
read about the commands systemctl vs service
eg. systemctl status docker vs service docker status
1 .check the status of docker service in your system

- stop the service jenkins and post before and after screenshots.
before

after

TASK-3 Read about the commands systemctl vs service.
eg. systemctl status docker vs service docker status
Difference between service and systemctl.
systemctl makes sure that service runs in the background. Sysytemctl manages the background process.
But service commands only manage services..
If you run systemctl start docker it always runs in background even when you shutdown the system
But if you run the service command to start docker it will not run in the background and it will be inactive when you shut down the system.
If you want an service to be in restart mode you have to use
systemctl
Thank you for reading the blog.
We welcome any and all recommendations. A big thank you!



