Amazon Linux 2

How to easily install Jenkins in AWS EC2 – 2021

Hi Everyone!

In this tutorial, you will learn how to install Jenkins – one of the most popular CI/CD tools!

Jenkins is a self-contained, open-source automation orchestrator server that, together with other DevOps Tools, automates your DevOps tasks such as building, testing, and provisioning infrastructure.

For example, you can configure Jenkins to publish artifacts to a Nexus server automatically, and they then become available to other developers or other job pipelines

This tutorial will show you how to install Jenkins in AWS EC2 Linux 2 instance and install Java 11 (java-openjdk 11) to ensure that your Jenkins installation runs smoothly.

I recently created this tutorial and verified the steps worked in AWS, but if you run into any issues or have any questions, please post your questions below.

If you prefer, you can watch the Video here and see the step by step instructions in the video below:

Installing Jenkins and Java 11 in AWS EC2 Instance

The video will show you:

  • How to create an AWS EC2 LINUX 2 Instance
  • How to open the 8080 Port on the Security Groups of your instance
  • How to SSH or PUTTY into your instance

Note:  The amazon-linux-extras command only work on instances created with the AWS EC2 LINUX 2 AMIs and will not run on AWS EC2 LINUX

Below you will find the step by step instructions of the commands executed in the video

Step 1: Install Java Open JDK

sudo amazon-linux-extras install -y java-openjdk11

Step 2: Verify Java 11 is installed

java -version

You should see something similar to this:
openjdk version "11.0.7" 2020-04-14 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.7+10-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.7+10-LTS, mixed mode, sharing)

Step 3: Add the Jenkins Repo

sudo wget -O /etc/yum.repos.d/jenkins.repo

Step 4: Add the Jenkins keys to download the Jenkins build

sudo rpm --import

Step 5: Install the Jenkins Build in the AWS Instance

sudo yum install -y jenkins

Step 6: Enable the Jenkins service to start

sudo chkconfig jenkins on

You should see something similar to this:
Starting jenkins (via systemctl):                          [  OK  ]

Step 7: Start Jenkins

sudo service jenkins start

Step 8: Open your local browser and enter the IP of your EC2 Instance



Step 9: To get the initial password, open or cat your initial admin password file:

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

In Summary…

This tutorial showed you how to install Jenkins and java 11 in an AWS EC2 Linux 2 instance.

The Video tutorial walked you step by step on creating the AWS EC2 Instance, configure your security groups for Jenkins. Last, we SSH into the Jenkins AWS instance and completed all of the commands to configure Jenkins, including installing java 11.

Did this tutorial work for you?

Don’t you love a tutorial that works? Help improve the search engines by sharing this page or gifting us a “like” so that others can swiftly install Jenkins as well.

1 thought on “How to easily install Jenkins in AWS EC2 – 2021”

Leave a Comment

Your email address will not be published. Required fields are marked *

− 5 = 1