Installation of Jenkins

Installation of Jenkins

ยท

3 min read

Let's move one step ahead in our Journey of DevOps, so in this blog, we will see the installation and setup of Jenkins in an AWS EC2 instance server.

In the previous blog, we understand the fundamentals of Jenkins, its uses, architecture, and some features of Jenkins. If you haven't read about it please go check it out here - Introduction to Jenkins

Pre-requisites to install Jenkins:

  • An AWS account to set up and launch the EC2 instance server

  • Java Runtime (JDK) to be installed

Installing Jenkins on an EC2 server:

Step 1: I hope you all know how to create an AWS account and launch an EC2 instance server. If not you check the steps to launch the server here - AWS EC2 hosting.

Step 2: After the successful creation and connection with a t2.micro (for free tier) EC2 instance, it's recommended and good practice to update all the packages of the server.

#Update all the packages

sudo apt update

Step 3: In this step, we will install the Java (OpenJDK) to install Jenkins. To install OpenJDK copy the below code and paste it in your terminal.

#to install openjdk
sudo apt install openjdk-11-jdk -y

#to check the java version
java --version

Step 4: So now we have Java installed in our instance it's the final step to install Jenkins. To install Jenkins copy the below code and paste it on your terminal.

sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
  https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key

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

sudo apt-get update

sudo apt-get install jenkins -y

#to verify if jenkins is installed
sudo systemctl status jenkins

Now our Jenkins is successfully installed and it's in an active (running) state.

Step 5: So to work with Jenkins make sure to allow the Inbound Port rule and add port 8080 in your server security group.

Step 6: Copy the public IP address of your EC2 instance with the port number 8080 as shown below

<public-ip-address-ec2>:8080

So now our Jenkins landing page is live and we have to enter the administrator password to unlock Jenkins. You can get the password by entering the below code in the terminal.

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Once you get the password, copy and paste it into your browser to Unlock Jenkins.

Step 7: After successfully unlocking Jenkins, on the next page Install the suggested plugins and wait for the plugins to get installed.

Step 8: Next add all the configuration details like the username, name, and password to continue the process.

Step 9: Click Save & Continue, then finish all the remaining steps and Start using Jenkins

Congratulations, we have successfully installed and configured Jenkins on our EC2 Instance server.

This is the main dashboard of Jenkins.

You can also install Jenkins and try it on your local host machine by simply downloading the .war file and extracting it to get an executable file.

Step 10: In this final step, after exploring and installing Jenkins it's time to terminate the EC2 instance and delete the resources. (VERY IMPORTANT SO THAT YOU WILL NOT INCUR ANY CHARGES).


So that's a wrap-up for this blog where we understood the process of installing and configuring Jenkins on an EC2 server.

In the upcoming blogs, we will do some basic hands-on labs on Jenkins. Try to explore more related to the working of CI/CD pipelines.

Until then stay tuned and I hope you like my blogs and have subscribed to my hashnode channel for getting updates of my blogs.

THANK YOU!! HAPPY LEARNING!! ๐Ÿ˜Š

ย