How to Install Jenkins on AWS EC2

In this tutorial, we will learn how to install Jenkins on AWS EC2 Instance(Amazon Linux). Before starting let us know what is Jenkins.

Jenkins 

Jenkins is a very popular Open Source software that helps us to automate not only the build-deployment process but also an entire project. Jenkins supports hundreds of plugins that help us to automate a project.

 

Also Read: How to create your first build Job in Jenkins

&&  Passwordless SSH login using public key and private key

 

Jenkins Installation

Connect to Amazon Linux box and update the packages.

       $sudo yum update

Install Java

      $  yum install java-1.8.0 -y

Check and select if multiple java versions available, select one out of them.

     $ /usr/sbin/alternatives -config java

Download the latest Jenkins package

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

Enable installation from the package by Importing a key file from Jenkins-CI

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

Install Jenkins

     $yum install jenkins -y

Start the Jenkins Service

   $ service Jenkins start

Install httpd service

  $ yum install httpd -y

Start the httpd service

   $ service httpd start 

Allow port 8080 on the AWS Security group of Jenkins Server to access it from outside. I have opened the port 8080 for everyone, but you can allow it for your network only.

Access Jenkins Server on Web Browser

Access Jenkins Public IP on port 8080 on a web browser.

      https://JenkinsServerPublicIP:8080

 

Copy the following path as shown in the above screenshot to get the temporary password for Jenkins login. Use cat command to see the password. Use this temporary password to login to Jenkins Server on web browser first time.

$ cat   /var/lib/jenkins/secrets/initialAdminPassword

After login, choose any of the following options. I will recommend choosing ” Install suggested plugins”

 

Create First Admin User and set a password. Note down this credential to log in to Jenkins Server next time.

 

The following page comes, which will show your Jenkins URL. Click “Save and Finish”

As soon as you click on ” Save and Finish” it will redirect you to the Jenkins URL. Now Jenkins Server is ready to use and create jobs.

Note down your Jenkins URL to access it for future works.

I hope you enjoyed this tutorial and learned to Install Jenkins on AWS EC2(Amazon Linux). If you think this is really helpful, please do share this Article to others as well. Also, please give your valuable feedback in the comment box.

 

If you think we helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter

You may also like…

Leave a Reply

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