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
5. Get Jenkins repository using below command
wget -O /etc/yum.repos.d/jenkins.repo
6. Get Jenkins repository key
rpm --import
7. Install jenkins package
# yum install jenkins
8. Start jenkins and make sure it starts automatically at system startup
# service jenkins start
# chkconfig jenkins on
9. Open your browser and navigate to http://<Elastic-IP>:8080. You will see jenkins dashboard.
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”.
After this, please select “Enable Security”.
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. 
Now, please  add an user (for eg., admin) to jenkins user database by adding username under matrix-based security section.
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.
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”.
Now, please provide your username ( “admin” in our case) and provide necessary details like password, name and email address. 
Once done, you will be logged into jenkins and your whole setup is secured.
Now, you can create jenkins jobs without any security issues.

No comments:

Need Consulting help ?


Email *

Message *

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.