0% found this document useful (0 votes)
94 views

Jenkins Installation Steps

The document provides installation steps for setting up Jenkins on a server. It includes: 1) Installing required packages like Java, Git and downloading the Jenkins war file. 2) Starting the Jenkins service and accessing the initial admin password. 3) Installing recommended plugins and getting started with the Jenkins UI. 4) Additional steps like installing Maven, Tomcat and configuring them. 5) Commands to check if Jenkins is running and troubleshoot issues. 6) Examples of creating demo jobs on Jenkins to execute commands locally and remotely.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
94 views

Jenkins Installation Steps

The document provides installation steps for setting up Jenkins on a server. It includes: 1) Installing required packages like Java, Git and downloading the Jenkins war file. 2) Starting the Jenkins service and accessing the initial admin password. 3) Installing recommended plugins and getting started with the Jenkins UI. 4) Additional steps like installing Maven, Tomcat and configuring them. 5) Commands to check if Jenkins is running and troubleshoot issues. 6) Examples of creating demo jobs on Jenkins to execute commands locally and remotely.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

INSTALLATION STEPS

yum install wget unzip tree git -y


yum install java -y
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo

● rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key


● yum install jenkins -y
● service jenkins start
● browse url with public ip with port number 8080

http://54.243.5.107:8080/
you can see the jenkins page

copy the initial admin password from

[root@ip-172-31-86-155 opt]# cat /var/lib/jenkins/secrets/initialAdminPassword


f735142601ba4d71bd32692c4d08946c
and past on the UI at prompting place

install recommended plugins

So now, you are able to see the getting started page.

install

● cd /opt/
● wget --no-cookies --no-check-certificate --header "Cookie:
gpw_e24=http%3A%2F%2Fwww.oracle.com%2F;
oraclelicense=accept-securebackup-cookie"
"http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad
6ed6d1/jdk-8u181-linux-x64.tar.gz"
● tar xzf jdk-8u181-linux-x64.tar.gz
● cd /opt/jdk1.8.0_181/
cd sr/bin/java java /opt/jdk1.8.0_181/bin/java 2
● alternatives --config java
● vi ~/.bash_profile
● source ~/.bash_profile
● service jenkins start
● yum install git -y
● cd /opt
● wget
http://mirrors.fibergrid.in/apache/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin
.zip
● unzip apache-maven-3.5.4-bin.zip
● cd apache-maven-3.5.4
● pwd
● vi ~/.bash_profile
● source ~/.bash_profile
● mvn
● cd /opt/
● wget
http://www-eu.apache.org/dist/tomcat/tomcat-8/v8.5.33/bin/apache-tomcat-8.5.33.zip
● unzip apache-tomcat-8.5.33.zip
● cd apache-tomcat-8.5.33/
● ls -lrt
● cd conf
● ls -lrt
● cd bin
● ./startup.sh
● netstat -an | grep 8080
● vi context.xml
● vi tomcat-users.xml
● vi server.xml

==============================================================
To check the Jenkins server running or not

[root@ip-172-31-86-155 opt]# service jenkins status


or
ps -ef |grep jenkins

[root@ip-172-31-86-155 opt]# ps -ef |grep jenkins


jenkins 4122 1 5 03:55 ? 00:00:33 /etc/alternatives/java
-Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true
-DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/jenkins/jenkins.war
--logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war
--daemon --httpPort=8080 --debug=5 --handlerCountMax=100
--handlerCountMaxIdle=20
root 4274 4217 0 04:05 pts/0 00:00:00 grep --color=auto jenkins
[root@ip-172-31-86-155 opt]#

Exercise1:

Please create new jobs to get started as demo_job1

in build option select shell execute

with below content

save
It will fail even we use sudo command, because, all process running by jenkins user

So, add the jenkins user in sudoers file at bottom as below

[root@ip-172-31-86-155 opt]# cat /etc/sudoers

#includedir /etc/sudoers.d
ec2-user ALL=(ALL) NOPASSWD: ALL
jenkins ALL=(ALL) NOPASSWD: ALL
[root@ip-172-31-86-155 opt]#

Then build the job now, it will be successful

browse the url with public ip and will get http appache test page

Exersie:2

Now, we will try to do activity remote ssh execution or executing commands on remote
machine.

step1: Create another rhel machine

step2: install ssh plugins in jenkins server, show that it can talk with remote
machine

Jenkins-->Manage Jenkins--> Manage Jenkins-->available tab

in filter respective plugin example: ssh

and select it(ssh)


Step3: To access remote machine, need to be setting up credentials

Jenkins-->Credentials-->Global--> Add Credentials

In place of private key box, provide.pem file content and past in that box.

Step:3

Adding ssh sites,

Jenkins-->Manage Jenkins-->configure system

Click on check connection, you will gett connection was successfull if you provide
proper details.
Step4:

Create a job to execute on remote machine.

Jenkins-->New item-->Freestyle project

Create new job as remote_job1

save and build now. It should be successful.

To Verufy, browse url with remote machine public ip. It will disply hhtp appache page

Step5:
Now, try to create index file in remote machine location with some content
Save and Build it again. It should be successful. Browse the url and check it out

Download benefits and


==========================Master & Slave setup===============================

Jenkins

Step1: Set Credentials for slave machine in jenkins:

Step2: setting up slave:

Jenkins-->Manage Jenkins-->manage node

Select Manage Nodes


Add, remove, control and monitor the various nodes that Jenkins runs jobs on.

create new node---> provide node name and select option Permanent
Provide the details properly

Now, create job

jenkins--> New Item-->Free style job--> provide name "slavejob1" and click on ok
save and Build it after writing script on build page

Exercise 6:=================5th Day===========CI/CD==============


CI/CD pipe line:

2 ways

pipeline code: It uses Grove language

we need to write code in grovee langauage and in stages mode

build pipeine plugin

Exercise1:

Jenkins-->New item--slect pipeline and name something as pipelinejob2

using build pipeine plugin


Step1:
jenkins--->manage jenikins-->mange plugins---> serach build pipeline
install without restart

Create multiple jobs(3 now) like as below

job1: echo "continuous integration getting done"

job2: echo "continuous delivery getting done"

job3: echo "continuous deployment getting done"

go to each configure and Configure each job should trigger one after another job

then run the job. It will run successfully all jobs

Exercise:

configuring build periodically and check once it is running or not periodically

Github webhooking:
Login into github with your login credentials
Create one repo as demo_repo1
create one file as file2in above repo and commit it
step1: Go to repo on your github--> settings(top
right)-->webhooks(left side)-->addwebhook-->provide
jenkins server url and select application/json, select
everything option
Step2:

Creating credentilas from github

go to jenkins consle--Credentials--->global-->add credentials

step3:

create job to use with github-webhook

create new job

jenkins-->new-item--><name as: webhook_demo>

provide gthub details URL and credentials


Save the configuration

Now, change the gothub repo file . Once you modify the file, build will trigger automatically on
jenkins.
adding remote host and executing commands on remote machine

step1: install ssh plugin which will give capability of running commands on remote ssh servers.

manageJenkins -> managePlugins

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy