Sunday, October 6, 2013

Installing Jenkins on Amazon EC2



Jenkins is one of the most popular open source continuous integration tool. It is written in Java. If you want to read about jenkins before installing it, please do read this link.
Following post illustrates a simple Installation of Jenkins on Amazon Linux EC2 Instance.
Environment Details :
Operating System : Amazon Linux 2013.03.01
AMI-ID : ami-3ffed17a
Security Group Ports : 8080
Installation Steps :
1. Please launch an Amazon Linux instance using Amazon Linux AMI.
2. Login to your Amazon Linux instance.
3. Become root using “sudo su -” command.
4. Update your repositories
# yum update
image
5. Get Jenkins repository using below command
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
image
6. Get Jenkins repository key
rpm --import http://pkg.jenkins-ci.org/redhat-stable/jenkins-ci.org.key
image
7. Install jenkins package
# yum install jenkins
image
8. Start jenkins and make sure it starts automatically at system startup
# service jenkins start
# chkconfig jenkins on
image
9. Open your browser and navigate to http://<Elastic-IP>:8080. You will see jenkins dashboard.
image
That’s it. You have your jenkins setup up and running. Now, you can create jobs to build the code.
Securing Jenkins Setup :
As seen, your above installed jenkins setup is directly accessible through internet and there are no security measures to prevent direct access. In order to secure your jenkins setup, you need to enable some sort-of security authorization on it.
To enable security for jenkins setup, please select “Manage Jenkins” on jenkins dashboard and click on “Configure Global Security”.
image
After this, please select “Enable Security”.
image
Jenkins provide different level of security methods like integrating it with your LDAP setup or using Unix user/group database. In our case, we will create “Jenkins’ Own User Database”. So, please select “Jenkins’s Own User Database” under security realm. Don’t forget to select “Allow users to sign up”. Also, select “Matrix-based security” under Authorization. 
image
Now, please  add an user (for eg., admin) to jenkins user database by adding username under matrix-based security section.
image
Once done, please provide necessary privileges to this user. In our case, we make this user as an administrator, so he will have full privileges.
image
Once done, please click on save. Now, you will be asked to provide username and password for the user to login. But we don’t have any. So, please click on “Create an account”.
image
Now, please provide your username ( “admin” in our case) and provide necessary details like password, name and email address. 
image
Once done, you will be logged into jenkins and your whole setup is secured.
image
Now, you can create jenkins jobs without any security issues.

No comments:

Need Consulting help ?

Name

Email *

Message *

DISCLAIMER
All posts, comments, views expressed in this blog are my own and does not represent the positions or views of my past, present or future employers. The intention of this blog is to share my experience and views. Content is subject to change without any notice. While I would do my best to quote the original author or copyright owners wherever I reference them, if you find any of the content / images violating copyright, please let me know and I will act upon it immediately. Lastly, I encourage you to share the content of this blog in general with other online communities for non-commercial and educational purposes.

Followers