Skip to content

Instantly share code, notes, and snippets.

@woodrow-shen
Last active August 23, 2016 07:41
Show Gist options
  • Save woodrow-shen/ba15bf88e4e5f423cc67 to your computer and use it in GitHub Desktop.
Save woodrow-shen/ba15bf88e4e5f423cc67 to your computer and use it in GitHub Desktop.
Installing Jenkins from scratch

Setup Jenkins from scratch

Installing Jenkins on Linux mint 17.3

wget -q -O - https://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

Notes

  • Jenkins will be launched as a daemon up on start. See /etc/init.d/jenkins
  • The 'jenkins' user is created to run this service.
  • Log of Jenkins is placed in /var/log/jenkins/jenkins.log
  • Default configurations are set in /etc/default/jenkins
  • Browse Jenkins by :8080

Installing plugins for Git+Github

Manage Jenkins -> Manage Plugins -> Available, to filter the following keywords:

  • Git plugin
  • GitHub plugin

Github + SSH

Manage Jenkins -> Configure System -> Git plugin

  • Global Config user.name Value
  • Global Config user.email Value

SSH keypair generation

sudo su jenkins
ssh-keygen -t rsa
cat /var/lib/jenkins/.ssh/id_rsa.pub
  • Create a new SSH key and paste id_rsa.pub
  • Confirm if the user jenkins can login into Github via SSH
ssh -vT git@github.com

Issue: Can't exec sudo from shell

sudo: no tty present and no askpass program specified

sudo chmod +w /etc/sudoers
sudo vi /etc/sudoers
  • add the line to /etc/sudoers
%jenkins ALL=(ALL:ALL) NOPASSWD:ALL

Git + SSH on launchpad

  • Add SSH keypair /var/lib/jenkins/.ssh/id_rsa.pub into launchpad

Issue

stderr: Host key verification failed

sudo su jenkins
git ls-remote -h git+ssh://<launchpad-id>@git.launchpad.net/<project.git> HEAD

References

[1] https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu

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