jenkins-logo

Install Jenkins on Amazon Linux (AWS)

In this article, we will see how to install Jenkins on Amazon Linux EC2 instance, before that let’s know what is Jenkins, what is its purpose and why it is the most widely used CI/CD tool

What is Jenkins: The leading open source automation server, Jenkins provides hundreds of plugins to support building, deploying and automating any project. In short, it’s a Continuous Integration server.


What is it used for ?? 

It’s a Continuous Integration tool where its tasks are to take care of Continuous Deployment/Delivery. Makes deployment a non-issue and helps you speed up your development other advantages are :

Developer time is focused on work that matters — Much of the work of frequent integrations is handled by automated build and testing systems, meaning developer time isn’t wasted on large-scale error-ridden integrations.

Software quality is improved — Any issues are detected and resolved almost immediately, keeping software in a state where it can be safely released at any time.

Faster Development – Integration costs are reduced both because serious integration issues are less likely and because much of the work of integration is automated.

Most companies who employ continuous integration use their own cloud-based continuous integration servers built on applications like Jenkins.

Here is a graphical representation of how Jenkins work :

jenkins-process

 

So lets get started with the installation of Jenkins on Amazon Linux :

 

Step 1.  Launch an instance (Amazon Linux) 

Step 2.  Login to the instance, install and setup java environment 

sudo yum install -y git  java-1.8.0-openjdk-devel aws-cli

sudo alternatives --config java

In this command change version of java to the latest version.

Step 3. Install Apache Maven 

sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo

sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo

sudo yum install -y apache-maven

mvn –v

Step 4.  Install Jenkins 

sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo

sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key

sudo yum install jenkins

sudo service jenkins start

sudo chkconfig --add jenkins

That’s it! Now you can go to URL http://<instance ip>:8080

If you’re unable to see the Jenkins page, check security groups restrictions. You can also change the port for Jenkins manually if you want to run it on a different port.

Step 5. Setup Jenkins

This is the first screen you will after going to http://<instance ip>:8080

screen-1-jenkins

go to file/var/lib/jenkins/secrets/initialAdminPassword , copy the password and paste it in “administrator password” input box. Then press continue.

 

screen2-jenkins-plugins
On this page select default option “Install suggested plugins”

Next, you will see above the screen. Select install suggested plugins.

screen-3-jenkins-install-plugins
Select plugins to install

Next, it will ask for admin credential. You can skip this step and click on continue as admin or you can fill in the required information.

screen-4-create-admin-user

 

Jenkins will be installed.. you will see a welcome page something like this.

screen-5-welcome-screen
Welcome page

 

That’s it!  you’ve successfully installed Jenkins on Amazon Linux (AWS)

Please comment below your queries and I’ll surely love to help out.

Credits: Kriti Singh (LinkedIn)

Hope this helps!

-Bhargav