How to Setup Jenkins Master & Slave Agent in Ec2 Ubuntu with SSH-KEY AUTH

Create two machine using Ubuntu 22.04.4

Rename a master ec2

update

Install Java

Check java version

Add Jenkins key

Update

Install Jenkins

Enable Jenkins

Start, Status Jenkins

In Slave

Rename hostname

Update

Check java version

Login as a root

Change directory /opt

Make directory

Give full permission jenkins-slavenode

Create a ssh key gen

Copy id_rsa.pub key

id_rsa.pub key paste to authorized key

In Jenkins create a node

remote directory

Give salve machine ip

Add Jenkins credential

Give id_rsa key

Launch agent

Sucessful

Now create a simple pipeline

Build now

see the index.html file created in slave node

Console output

Add one more file

See two files

console output