AWS

Jenkins installation on AWS ec2 linux instance

This blog will guide you through a detailed but yet easy steps for Jenkins installation on AWS ec2 linux instance. However in order to launch linux instance on AWS, follow this blog.

Prerequisite:

Java 8 is a prerequisite.You can Click here to install Java.

Jenkins installation on AWS ec2 linux instance:

Step 1. Firstly, add Jenkins repository using wget, so that yum get to know where to install Jenkins from.
Install wget ,if not installed
sudo yum install wget

[ec2-user@ip-xxx-xx-xx-xx]$ sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo

*yum is the package manager which can install, remove, update software and can manage all the dependencies for each packages.

Step 2. Now, let’s add the Jenkins GPG key to our trusted keys, so that we will be able to verify/trust the files that are being sourced (while installing Jenkins )are from trusted site.
[ec2-user@ip-xxx-xx-xx-xx]$ sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key

As now, the environment has been prepared and has resolved the required dependencies, lets install Jenkins.

[ec2-user@ip-xxx-xx-xx-xx]$ sudo yum install jenkins
Step 3. Jenkins services needs to be started, with the following command:
[ec2-user@ip-xxx-xx-xx-xx]$ sudo service jenkins start

*If you wish to start Jenkins automatically when your linux instance is started, then you can use chkconfig to add Jenkins to your startup services.

[ec2-user@ip-xxx-xx-xx-xx]$ sudo chkconfig --add jenkins
Step 4. Make sure to open port 8080 (default port to which Jenkins listen):

(i) Go to your AWS management console → ec2 dashboard → Network & Security → Choose the security group of your instance

Click on the Inbound tab

Click on edit → Add rule : Custom TCP with Port range 8080

Step 5. Go to your browser and connect to jenkins via default port 8080

http://<IP_address>:8080

IP_address : you can use public DNS of your ec2 linux instance

Step 6. To unlock jenkins fetch the administrator password by typing following command:
[ec2-user@ip-xxx-xx-xx-xx]$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Step 7. Click on ‘Install suggested plugins’ in the customize Jenkins window.
Step 8.  Create first admin user:
Specify username, password and other details.
Finally congratulations!! You have successfully followed each and every step for Jenkins installation on AWS ec2 linux instance.
Please follow and like us: