Konvergen.AI
Published in

Konvergen.AI

Jenkins for Node.js App on AWS EC2 Part 1: Installing Jenkins on EC2

What are we going to build?

In this article?

  • EC2 Setup
  • Installing Jenkins
  • Configuring Firewall Settings
  • Setting up EC2 Security Groups
  • Complete Jenkins First Setup

Prerequisites:

  • You have an Amazon Web Services account, if not please sign up, and for first time users you will be eligible for the free tier. The AWS Free Tier enables you to gain free, hands-on experience with AWS.
  • Your Amazon EC2 Key Pairs are set up, if not please click here to follow Amazon’s walkthrough on Creating a Key Pair Using Amazon EC2.

EC2 Setup

  • Log into your AWS console search for and select EC2
  • Select Launch Instance
  • Step 1: Choose an Amazon Machine Image (AMI) Select the free tiered Ubuntu Server 16.04 LTS
  • Accept the defaults for Step 2: Choose an Instance Type and choose Next
  • Accept the defaults for Step 3: Configure Instance Details
  • Once completed select Add Storage and accept the defaults for Step 4: Add Storage
  • Accept the defaults for Step 5: Add Tags
  • Step 6: Configure Security Group and choose Create a new security group
  • Confirm that port 22 is configured to allow access to your VM
  • Finally select Review and Launch
  • Step 7: Review Instance Launch

Installing Jenkins

sudo add-apt-repository ppa:webupd8team/java
sudo apt update
sudo apt install oracle-java8-installer
sudo apt install oracle-java8-set-default
javac -version
cd /tmp && wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
echo 'deb https://pkg.jenkins.io/debian-stable binary/' | sudo tee -a /etc/apt/sources.list.d/jenkins.list
cd
sudo apt update
sudo apt install jenkins
sudo systemctl stop jenkins.service
sudo systemctl start jenkins.service
sudo systemctl enable jenkins.service
sudo systemctl status jenkins

Configuring Firewall Settings

sudo ufw allow 8080
sudo ufw allow 22
sudo ufw status
sudo ufw enable

Setting up EC2 Security Groups

Complete Jenkins First Setup

sudo cat /var/lib/jenkins/secrets/initialAdminPassword
http://JENKINS.SERVER.IP:8080/restart

Jenkins has been successfully installed!!!

Next Part: Part 2

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store