Skip to content

Instantly share code, notes, and snippets.

@EliEladElrom
Last active December 17, 2015 02:28
Show Gist options
  • Save EliEladElrom/5535511 to your computer and use it in GitHub Desktop.
Save EliEladElrom/5535511 to your computer and use it in GitHub Desktop.
Jenkins Ubunto installation & setting up github instructions

Setup on Ubunto 12.10 ami

SSH server

ssh -i dev.pem ubuntu@[IP ADDRESS]

sudo apt-get update

sudo apt-get -y upgrade

sudo apt-get install rcconf

sudo apt-get install build-essential

sudo apt-get install libssl-dev

sudo apt-get install git-core

install nginx:

sudo apt-get install nginx

Start nginx:

sudo service nginx start

Install Jenkins, get key and start jenkins:

wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -

sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'

sudo apt-get update

sudo apt-get install jenkins

Start Jenkins:

sudo service jenkins start

Install & point ngnix to jenkins;

sudo aptitude -y install nginx

cd /etc/nginx/sites-available

sudo rm default

server { listen 80; listen [::]:80 default ipv6only=on; server_name ci.yourcompany.com;

location / {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;

    if (!-f $request_filename) {
        proxy_pass http://app_server;
        break;
    }
}

}

link & restart nginx:

sudo ln -s /etc/nginx/sites-available/jenkins /etc/nginx/sites-enabled/

sudo service nginx restart

Confirm it's working: [amazon location URL]

Setup up Jenkins to talk to Github

Setup passwrods for jenkins:

sudo passwd jenkins [I used: fiat2013]

su - jenkins

Create SSH key:

ssh-keygen -t rsa -C "email@company.com"

view key:

cat /var/lib/jenkins/.ssh/id_rsa.pub

Paste key in github according to article: https://help.github.com/articles/generating-ssh-keys

test:

ssh -T git@github.com

Another test is trying to hit the github repo:

git ls-remote -h git@github.com:[user]/[repo].git HEAD

When configuring a project install github plugin and make sure the following insert:

Repository URL

git@github.com:[user]/Core.git

Github project:

https://github.com/[user]/[repo].git/

Alias you can use

alias vimb='sudo vim /etc/bash.bashrc'
alias runb='. /etc/bash.bashrc'
alias restart-jenkins='sudo service jenkins restart'
alias stop-jenkins='sudo service jenkins stop'
alias restart-nginx='sudo service nginx restart'
alias stop-nginx='sudo service nginx stop'
alias configvim='sudo vim /etc/default/jenkins'

Recommend

increase heap memory:

$configvim

set:

JAVA_ARGS="-Xmx2048m"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment