Skip to content

Instantly share code, notes, and snippets.

@simkimsia
Last active December 7, 2017 19:46
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save simkimsia/4473000 to your computer and use it in GitHub Desktop.
Save simkimsia/4473000 to your computer and use it in GitHub Desktop.
Install jenkins on a fresh ubuntu 12.10.
#!/bin/bash
###
#
# Copyright (c) 2013 KimSia Sim
#
# Ubuntu 12.10 based install jenkins and other related plugins
# Run this by executing the following from a fresh install of Ubuntu 12.10 server:
#
# bash -c "$(curl -fsSL https://gist.github.com/simkimsia/4473000/raw/5e301a3bd399096e7cbbe3b1a877997a117aa7a3/install-jenkins-on-ubuntu-12-10.sh)"
#
# Also, run this as root, unless you enjoy failing.
#
# Its handy to install 'screen' if you want to ensure your remote connection to
# a server doesn't disrupt the installation process. If you want to do this, just
# do the following before running the main bash command:
#
# apt-get install screen -y
# screen
#
# To recover your session if you are disconnected, ssh to your server as root again,
# and type:
#
# screen -x
#
# Dependencies:
# - curl
#
# Todo:
# - SSL Configuration
#
###
##########################
## Install Jenkins
##########################
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
apt-get update -y
apt-get install jenkins -y
##########################
## Install Git if not already done so
##########################
apt-get install git-core --force-yes -y
##########################
## Add user `jenkins` to the sudoers and www-data groups
##########################
adduser jenkins sudo
adduser jenkins www-data
##########################
## Because `jenkins` service is now running
## AND we have added `jenkins` to new groups
## SO we need to restart the service
##########################
echo "Restarting Jenkins..."
service jenkins restart
##########################
## Sleep for about 10s before we start to update plugin shortnames
##########################
echo "Hi, I'm sleeping for 10 seconds... before updating plugin shortnames"
sleep 10s
####################################################################################
## Need to update all the plugin shortnames from the Jenkins update center first
## hat tip to https://gist.github.com/1026918#comment-61254
####################################################################################
curl -L http://updates.jenkins-ci.org/update-center.json | sed '1d;$d' | curl -X POST -H 'Accept: application/json' -d @- http://localhost:8080/updateCenter/byId/default/postBack
@simkimsia
Copy link
Author

https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu says You need to have a JDK and JRE installed. openjdk-6-jre and openjdk-6-jdk are suggested.

@simkimsia
Copy link
Author

openjdk-6-jre and openjdk-6-jdk appears to be automatically installed by the script

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