Jenkins 1692611849

Download as pdf or txt
Download as pdf or txt
You are on page 1of 48

Project – 4

Master slave configuration

Module-1 :

1.create ec2 instance one is master and one is slave


a. in master attatch 16 gb volume and assain port 8080
b. in slave attatch 8 gb volume and assain code related
port.
2. Connect to terminal for slave and create user and
passwd.

3.connect master server to terminal and install Jenkins


4. Give ssh permissions in master using below
commands
Configure Jenkins Master Node:
Copy the slave node’s public key to master node’s
known_hosts file.

sudo mkdir -p /var/lib/jenkins/.ssh


cd /var/lib/jenkins/.ssh
cd ..
sudo chmod 777 .ssh
cd .ssh
sudo ssh-keyscan -H SLAVE_NODE_PRIVATE_IP
>>/var/lib/jenkins/.ssh/known_hosts
sudo chown jenkins:jenkins known_hosts
sudo chmod 700 known_hosts

5.give ssh permissions in slave to use below comands


Configure Jenkins Slave Node:
Create user, ssh keys and copy it to authorized_keys.

sudo useradd jenkins-slave1


sudo passwd Jenkins-slave1
sudo su - jenkins-slave1
ssh-keygen -t rsa -N "" -f /home/jenkins-
slave1/.ssh/id_rsa
cd .ssh
cat id_rsa.pub > authorized_keys
chmod 700 authorized_keys
. and install java in slave mishene

6. Goto Jenkins and click on mansge Jenkins & click


nodes and add node connect master and slave in
Jenkins.
Click on new node

Add the related details


Add credentials

Copy rsa secret key


Phaste to credentials

And click on add


7.check the log
And to see output

Module – 2 :

1.create a free style project


2. add the slave and git repo and credentials

Copy the github ssh client


Add the git repo and ctedentials
3.Give the commands in excute shell

4. build the job and check output and deploy the


application
Module – 3 :

Part - 2
dePloy a Java aPPlication on a toMcat Server uSing Maven,
JenkinS and aWS

1.create instance for t2 large and assain port 8080 & 8089 or any.
2. Then connect to terminal

3. then you can install tomcat the tar files are in tomcat web page.
Then unzip the tar file using [tar xvzf “ file name like apache-tomcat-
11.0.0-mg.tar.gz”
Go into the file and go into the bin and start engine using ./startup.sh.

They ask java and then install java and start the engine.
Then browse the public ip assain port 8080.
4. change the port in server.xml and give the permissions in conf and
web apps.
A. web apps and open tomcat-user.xml and modify
Go to conf and /manager/Meta-DATA /open context.xml
Start the engine.

Then browse the ip address using port 8089


5.install Jenkins on terminal and start and enable Jenkins.

Go to manage Jenkins / tools / add maven


Go to manage Jenkins / plugins / available /deploy to container/maven
installer.
Create a free style project . add the repo and add the details
Then build the job
Then again browse the application to see out put web apps
Module - 3

.create two ec2 instances one is master and one is slave .


1. Master was connect to terminal and install Jenkins

Using below commands to install jenkions.


2. Slave connect to terminal and create user

3.Give permissions on user and password.Using sudo vi /etc/sudoers


and sudo vi /etc/ssh/sshd_config.
4.add ssh and give chmod permissions using
sudo useradd jenkins-slave1
sudo su - jenkins-slave1
ssh-keygen -t rsa -N "" -f /home/jenkins-slave1/.ssh/id_rsa
cd .ssh
cat id_rsa.pub > authorized_keys
chmod 700 authorized_keys

AND install java and git on slave.

5. Goto master and connect slave using


sudo mkdir -p /var/lib/jenkins/.ssh
cd /var/lib/jenkins/.ssh
cd ..
sudo chmod 777 .ssh
cd .ssh
sudo ssh-keyscan -H SLAVE_NODE_PRIVATE_IP
>>/var/lib/jenkins/.ssh/known_hosts
sudo chown jenkins:jenkins known_hosts
sudo chmod 700 known_hosts

Give the permissions on Jenkins using sudo vi /etc/sudoers


6. Goto slave and install tomcat and maven and git
Browse public ip
And change the port using go to /conf and open server.xml and change

Go to conf/open tomcat-user.xml
Go to webapps/manager/META-INF/open context.xml

Go to webapps/host-manager/META-INF/open context.xml
7. browse the public ip

8.Go to Jenkins add master and slaveMansge Jenkins/nodes/new node.


then connect master and slave in jenkins
9. then go to tools and add maven

10 And go to manage jenkins /pluggins / available pluggins and install


deploy to code and maven installer.
11. create a free style project and add git repo
Add maven in build steps and add war/ear and cradencials and
container in post build actions

Then deploy the code usind save and build now


12. then browse the public ip give changed port like 8089
Click on webapp

You might also like