DevOps

Install Jenkins on AWS EC2

Jenkins is a self-contained Java-based program, ready to run out-of-the-box, with packages for Windows, Mac OS X and other Unix-like operating systems. As an extensible automation server, Jenkins can be used as a simple CI server or turned into the continuous delivery hub for any project.

Prerequisites

1. EC2 Instance
   With Internet Access
   Security Group with Port `8080` open for internet
2. Java v1.8.x

Install Java

We will be using open java for our demo, Get the latest version from

http://openjdk.java.net/install/

> yum install java-1.8*
> yum -y install java-1.8.0-openjdk-devel

Confirm Java Version and set the java home

> java -version
> find /usr/lib/jvm/java-1.8* | head -n 3
> JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-
> export JAVA_HOME
> PATH=$PATH:$JAVA_HOME

# To set it permanently update your .bash_profile
> vi ~/.bash_profile


The output should be something like this

[root@~]# java -version
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

Install Jenkins

You can install jenkins using the rpm or by setting up the repo. We will set up the repo so that we can update it easily in the future.


Get the latest version of jenkins from,

https://pkg.jenkins.io/redhat-stable/

and install

> yum -y install wget
> sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
> sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
> yum -y install jenkins

Start Jenkins

# Start jenkins service
> service jenkins start

# Setup Jenkins to start at boot,
> chkconfig jenkins on

Accessing Jenkins

By default jenkins runs at port `8080`, You can access jenkins at

http://YOUR-SERVER-PUBLIC-IP:8080

Configure Jenkins

– The default Username is `admin`
– Grab the default password
– Password Location:`/var/lib/jenkins/secrets/initialAdminPassword`
– `Skip` Plugin Installation;
– Change admin password
– `Admin` > `Configure` > `Password`
– Configure `java` path
– `Manage Jenkins` > `Global Tool Configuration` > `JDK`
– Create another admin user id

Ali Imran
Over the past 20+ years, I have been working as a software engineer, architect, and programmer, creating, designing, and programming various applications. My main focus has always been to achieve business goals and transform business ideas into digital reality. I have successfully solved numerous business problems and increased productivity for small businesses as well as enterprise corporations through the solutions that I created. My strong technical background and ability to work effectively in team environments make me a valuable asset to any organization.
https://ITsAli.com

Leave a Reply