DevOps KT

icon picker
Jenkins

SO
Security Operations
Last edited 453 days ago by Ram Kumar

Installation of Jenkins

Install Jenkins on Ubuntu 20.04
Step1:
Create Shell script file for installing jenkins

vi install.sh
Enter the Installation script in the file.
#!/bin/bash

sudo apt install default-jre -y
java -version

sudo apt install default-jdk -y
javac -version

wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt update
sudo apt upgrade -y
sudo apt install jenkins -y
sudo apt upgrade -y
sudo systemctl start jenkins
sudo systemctl status jenkins
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Step2:
Give the permission for script file
chmod +x install.sh

Step3:
Run the script file to installl it
./install.sh

Setting up Jenkins

To set up your installation, visit Jenkins on its default port, 8080, using your server domain name or IP address: http://your_server_ip_or_domain:8080
You should receive the Unlock Jenkins screen, which displays the location of the initial password:
Unlock Jenkins screen
In the terminal window, use the cat command to display the password:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Copy the 32-character alphanumeric password from the terminal and paste it into the Administrator password field, then click Continue.
The next screen presents the option of installing suggested plugins or selecting specific plugins:
Customize Jenkins Screen
We’ll click the Install suggested plugins option, which will immediately begin the installation process.
Jenkins Getting Started Install Plugins Screen
When the installation is complete, you’ll be prompted to set up the first administrative user. It’s possible to skip this step and continue as admin using the initial password from above, but we’ll take a moment to create the user.
Note: The default Jenkins server is NOT encrypted, so the data submitted with this form is not protected. Refer to to protect user credentials and information about builds that are transmitted via the web interface.
Jenkins Create User
Enter the name and password for your user:
You’ll receive an Instance Configuration page that will ask you to confirm the preferred URL for your Jenkins instance. Confirm either the domain name for your server or your server’s IP address:
Jenkins Instance Configuration
After confirming the appropriate information, click Save and Finish. You’ll receive a confirmation page confirming that “Jenkins is Ready!”:
Jenkins is ready screen
Click Start using Jenkins to visit the main Jenkins dashboard:
Welcome to Jenkins Screen
Plugins to be Installed:
Configure Systems Settings:
Untitled.png
Jenkins server details
Untitled.png
For User name triggering in EMAIL:

Untitled.png
Jenkins Shared Libs:
pasted image 0.png
Select checkbox in Git parameter
Untitled.png
Emailext Notification settings:
Using TLS:
Create one APP password in GMAIL and add it in jenkins credentials.
Untitled.png

Using SSL:
Untitled.png
Slack Integration:
Open slack:
Select APPs
Untitled.png

Search and select
Untitled.png
Click configure
Add to slack
Untitled.png
Then follow below steps for integration in jenkins
Setup Instructions
Here are the steps necessary to add the Jenkins CI integration.
Note: These instructions are for v2.8. To install an older version, go down to Previous Setup Instructions.
Step 1
In your Jenkins dashboard, click on Manage Jenkins from the left navigation.
Untitled.png
Step 2
Click on Manage Plugins and search for Slack Notification in the Available tab. Click the checkbox and install the plugin.
Untitled.png
Step 3
After it's installed, click on Manage Jenkins again in the left navigation, and then go to Configure System. Find the Global Slack Notifier Settings section and add the following values:
Team Subdomain: <workspace name> (automatically generated in slack)
Integration Token Credential ID: Create a secret text credential using 4E8YeWaQlkd69ipqumdUoLgjK as the value
The other fields are optional. You can click on the question mark icons next to them for more information. Press Save when you're done.
Note: Please remember to replace the Integration Token in the screenshot below with your own.
Untitled.png
Step 4
For each Project that you would like receive notifications for, choose Configure from the project's menu.
Untitled.png
Step 5
Then you'll need to add Slack Notifications to the Post-build Actions for this project.
Untitled.png

Step 6
In the Slack Notifications section, choose the events you'd like to be notified about.
Expand
Untitled.png
Copy token and add in the
Untitled.png
Manage Jenkins > Manage Credentials> Add the token in the credentials
Manage Jenkins > Configure system >
Untitled.png
Now save the setting

Sprint Deployment in Jenkins CI

Goto Jenkins using the ip xxx.xxx.12.7:8080
Login to Jenkins with given credentials
Select the Application ExpressTruckTax
To build the Jenkins CI of the Application refer this link Below,
Sprint Deployement:
Stage Deployement:
UAT Deployement:
Sandbox Deployement:
Prod Deployment:
pasted image 0.png
Then Select ETT-CI
pasted image 0.png
In Which Environment to build in Jenkins Select Sprint/Stage
pasted image 0.png
Then Select ETT-ApiWeb or ETT-WIWO
pasted image 0.png
pasted image 0.png
pasted image 0.png
pasted image 0.png
Finally CI build success in the jenkins
pasted image 0.png
After the CI-Build success Then run CD Build
pasted image 0.png
Then Select Which Environment to Deploy the Build
pasted image 0.png
Then Select CD-Sprint to Build the Application
pasted image 0.png
Select Build with Parameters option in Jenkins Navigation Bar
pasted image 0.png
Then fill the details to deploy the application in Sprint Environment.
pasted image 0.png
Finally CD Build Deployed to Sprint Server
pasted image 0.png

Same procedure for All Environments to Deploy the Applications.
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.