Installing Jenkins
Installing Jenkins on Linux (Ubuntu)
PREREQUISITE
For installing jenkins please make sure to perform below prerequisite steps, if you already done with them, no need to do it again
1. Update your server
Use the below command to ensure your system package manager is up to date:
2. Installing java
Install Java-Java 8 runtime environments, both 32-bit and 64-bit versions are supported.
sudo apt install openjdk-8-jdk

For moving further after prerequisite for installing jenkins, follow the below steps:-
1. Repository key need to added to the system.
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
If the above command shows error in downloading or it shows some repository portion missing, then execute the below command
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -

2. After adding key to system, the system returns OK. Next, We’ll append the Debian
package repository address to the server’s sources.list
echo deb https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list

3. When both of these are in place, We’ll run update so that apt-get will use the new repository:

4. We’ll install Jenkins and its dependencies: – On Debian and Debian-based distributions like Ubuntu you can install Jenkins through apt command.
sudo apt-get install jenkins

Setting Up Jenkins
Setting Up Jenkins open the browser, type the domain or IP address followed by port 8080, http://your_ip_or_domain:8080, and screen (unlock Jenkins screen) similar to the following will be displayed

In the terminal, type the following cat command to see the password:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Copy the password from the terminal and paste it into the “Administrator password” field and then click continue. After that the screen presents the option of install suggested plug-in or select specific plug-in (as per best practices, click on install suggested plug-in)

It’s time to create an admin account to login to Jenkins:

Save and Finish