Deploying Jenkins on Azure VM

In this blog we will deploy jenkins on Azure Virtual machine

  1. Create azure resource group

  2. create Virtual machine(ubuntu) with default configurations and download the pem file

  3. Download git bash

Steps to connect to VM

  1. open Git bash and execute the below commands

  2. ssh -i give path to the pem file and vm user name along with ip

    ex: ssh -i C:/Users/md.yasmeen.khan/Downloads/first-vm_key.pem azureuser@172.156.267.78

    Note: the pem file we downloaded has all open permissions.. we need to change the permissions by using the below command

  3. chmod 600 C:/Users/md.yasmeen.khan/Downloads/first-vm_key.pem

  4. Run the same command again i.e: ssh -i C:/Users/md.yasmeen.khan/Downloads/first-vm_key.pem azureuser@172.156.267.78

Steps to install jenkins

1.Java (JDK)-- pre requisite

install java

sudo apt update

sudo apt install openjdk-11-jre

Verify Java is Installed

java -version

Now, you can proceed with installing Jenkins by using below commands

curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee
/usr/share/keyrings/jenkins-keyring.asc > /dev/null echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc]
https://pkg.jenkins.io/debian binary/ | sudo tee
/etc/apt/sources.list.d/jenkins.list > /dev/null

sudo apt-get update

sudo apt-get install jenkins

now, if we want to check if the jenkins is running or not, we can check this by using the below command

ps -ef |grep jenkins

if we want to access jenkins on VM we can use the ip address of VM along with the https port in the following format

http://172.172.194.103:8080


-- it will not work as we did not allow http port enabled

steps to enable the 8080 port

-- go to networking option for the particular VM

--click on inbound port rule

select the options as per the picture below

-- Click on add

now the entered url will work

Congratulations

We have successfully installed jenkins on VM