Installing Jenkins and integrating with Github and Github oAuth plugins on Amazon ec2 (linux)

Setting up jenkins and Github:

 

Environment Details :

Operating System : Amazon Linux

AMI-ID : (ami-bba18dd2)

Security Groups:

Make sure you do not have the default security group as it blocks the port 8080, which is the port on which jenkin runs.

Also select the security group before you launch the instance as AWS does not allow you to change the security group after you have launched the instance. (Unless you are inside a VPC)

Security group name: launch-wizard-jenkins-test.

It should look something like this



Launch the instance.

Installing jenkins:

1)Login to the instance.

2) Become the root user. ‘sudo su’

3) Update the repositories

$ yum update

4) Get Jenkins repository using below command

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

5) Get Jenkins repository key

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

6) Install jenkins package

$ yum install jenkins

7) Start jenkins and make sure it starts automatically at system startup

$ service jenkins start

$ chkconfig jenkins on

8) Open your browser and navigate to http://<Elastic-IP&gt;:8080. You will see jenkins dashboard.

Configuring Jenkins to run with Github using Github Oauth Plugin:

1) Browse to the jenkins instance you have installed and select Manage Jenkins.

2) Go to Manage Plugins on the Jenkins dashboard.

(Update any updates that are there and restart Jenkins.)

3) Select Available Tab and search for GitHub API Plugin

(* If you do not see any Available plugins loading up then select the Advance tab and in the bottom right hand corner click on the Check Now button


After this you should start seeing the available plugins for jenkins)

4) Install the GitHub plugin, Github Api Plugin, GitHub Authentication plugin. Let jenkins restart after that.

5) Once you have installed all the plugins go back to Mange Jenkins dashboard and select Configure System.

In configure system you may observe that Git is not installed. Just login to the instance and as a root user run this command.

$ yum install git

6) Now we need to create a rsa ssh-key and add the public key to your Github account so that jenkins can directly talk to github.

Login to the instance. Make sure you are the root user (sudo su)

Now you need to login as the Jenkins user and create ssh keys for that particular user.

As jenkins is a service account it does not have a shell by design. So as a root user switch to the jenkins user using this command.

$ su -s /bin/bash jenkins

$ cd ~/.ssh/

$ ssh-keygen -t rsa

(Do not enter any passphrase)

 

7) Add your public rsa key to GitHub

(Follow this url: https://help.github.com/articles/generating-ssh-keys)

 

8) Ssh to gitHub

$ssh -T git@github.com

(yes)

 

This should be enough and you can start using GitHub to create jobs. The next part is setting up GitHub oauth login.

GitHub Oauth for Jenkins:

1) Go to your Github web account settings page.

2) Select the Applications Tab.

3) Click on the Register new application



4) Select a name for the Application. Give your jenkins Url. And the authorization call back URL.

The most important thing here is the authorization callback url. It should be like this

http://<Elastic Ip>:8080/securityRealm/finishLogin



When you create the application it will generate a Client id and client secret.

 

5) Go back to your Jenkins on your browser and Manage jenkins -> Configure Global Security

6) Select Enable security.

 

7) Then in Security realm select Github Authentication Plugin and copy paste the client id and client secret generated before.


Advertisements

How to install GNS3

NS3 is one of the most awesome and brilliant opens source software developed till now. It is awesome for laboratory work and especially for those giving Cisco certification exams this is a boon as now they don’t have to spend thousands of dollars on cisco equipment.

GNS3 is an emulator and not simulator. It actually sends packets between the routers rather than just simulating and the most awesome thing is that you can capture this packets using a packet sniffing software like wireshark and study those packets in detail.

I am writing this blog because it took me more than 5 hours just to install and get it started working properly. It takes a little bit of time and patience before u can start using it full flegedly.

1. GNS3 is an open source and you can download the software easily by following the link given. The  ttp://www.gns3.net/. You  Should download the windows all in one as you will get dynamips and all  the other required software with i  One thing while downloading the software make sure that you download  the cisco image unpacker binary as highlighted in the picture. It will be useful afterwards when we install the cisco IOS.

 

 

 

2. Open the downloaded file and install GNS3 its pretty straightforward and does not require any help in doing so.

3.  After installing click on the icon of GNS3 that should be visible now that you have installed the software. ON starting a window pops up that has two steps select the first step where you can get your basic configurations for GNS3 setup done.

 

 

4. Once you selected step 1 a screen will show up giving you different options and settings. On the left side select dynamips and first of all change the folder settings from the temporary folder to a new folder where you will want to save your GNS3 projects. After doing that just press the test button at the bottom of the screen and see if its working properly or not. Your screen should somewhat look like this.

 

 

 

5. Once that is done you can go to the next step that is adding the Cisco IOS images . This is probably a difficult part and you can get an IOS from a Cisco switch using a falsh drive or yu can download it or buy it from the cisco site.

Download GNS 3 and Cisco 1700, 2600, 7200 IOS in one pack:
http://rapidshare.com/files/130264941/GNS3-0.5-win32-all-in-one.rar
Pass: sumptuousworld

After downloading the Cisco IOS use the Cisco image unpacker to unpack the IOS or use WinZip which works equally fine. Just add it to WinZip and extract the file. The size of the file increases to almost double. Do not use the IOS without unpacking t otherwise you the routers in the GNS3 will take ages to start.

 

6. Once you have unpacked the IOS go to the second step in the GNS3 and upload the unpacked files. The screenshot should look like this

 

 

 

7. Once you are done with this you are ready to use your GNS3 make sure to enable the Idle PC value once you start using the software. ENJOY!!!!

 

MongoDB for windows (Installation)

MongoDB is extremely easy to Install and start running. Just Install the file unzip it in preferably C drive.

Now open command prompt and type the following commands.

C:\> mkdir \data

C:\> mkdir\data\db

 

This is where it basically stores the data. Now just go to the folder where you have unzipped MongoDB and then in the Bin Folder start Mongod(server) and Mongo(Client).

Your MongoDB has started and is up and running.

For more go to (http://www.mongodb.org/display/DOCS/Tutorial)

Installing Voldemort on Windows

This is the best link that is there for the Installation:

http://www.gonosql.com/how-to-install-voldemort-on-windows/

Only one thing that I would like to add is that if you get an error then do the foll

Edit the voldemort properties, open:
voldemort-0.80.1\config\single_node_cluster\config\server.properties
And change :
bdb.cache.size=1G
to
bdb.cache.size=200MB (or whatever your JVM is set to)

Enjoy!!!!!!!!!!

Install Cassandra on Windows

It is pretty easy to install Cassandra but as always I was still able to find it difficult so I thought of putting it down so I have it easy in the future.

Install Cassandra from its home page. One thing that you need to make sure is JAVA_HOME is setup.(Shouldn’t a problem if Java is already up and running ).
Go to your command promt  and go the folder where you extracted Casssandra. Then type the following command
bin\casandra -f localhost
This becomes your server for a single host and if you are experimenting and want it on the same model then

Then open a new cassandra window and type another command (this becomes your client)

(cant remember command)

P.S:  There are some blogs that tell you to change a yaml file but dont try to do it first if it doesnot work first then well you have no other option.

Install Ant for Windows

JAVA 1.4 or above is required

1. Download ANT 1.7.1 from ant.apache.org, unzip it to a directory
2. Make sure JAVA_HOME is set on your windows PC (No need if java is running on your PC)
3. Set ANT_HOME in windows environment variables to the folder where you extracted ANT
4. Set PATH for ANT, C:\ant.1.7.1\bin

Virtualbox full screen (Ubuntu)

How to get real full-screen in VirtualBox

Problem: When running for example an Ubuntu Linux guest on a Windows host with VirtualBox, you want it to use the whole screen. Maximizing the window or going to full-screen changes the VirtualBox window size, but not the size of the guest.

Solution: While the guest OS is running, install “Guest Additions”.

The following steps work for a standard Ubuntu 10.04 Lucid Lynx desktop install:

  1. Start your guest OS and log in.
  2. Select Device -> Install Guest Additions in the menu, or by using Host Key+D. (On my Windows VirtualBox installation, the default host key is right Ctrl.) This will make a VBOXADDITIONS image appear on your Ubuntu desktop. (If you are not running a graphical environment, type mount so see where it has been mounted.)
  3. Build and install the Guest Additions modules by doing one of the following:
    • If you are running the default Gnome desktop: Right-click the VBOXADDITIONS icon on the Desktop and choose “Open with autorun prompt”. After confirming and typing in your password, it will build and install all the necessary modules.
    • If you want to do it from a terminal: Go to the Guest Additions directory by typing cd /media/VBOXADDITIONS_3.2.8_64453 (note that the numbers might be different in your version). If you are running a 32-bit guest, start the installer with sudo sh VboxLinuxAdditions-x86.run. If you are running a 64-bit guest, start the installer withsudo sh VboxLinuxAdditions-amd64.run.
  4. Reboot the guest. When X starts you should now have glorious full-screen.