Jenkins3 and Jenkins5: progress
Posted by mholmes on 16 May 2011 in R & D, Activity log, Documentation
Made some progress today after discovering that installing some XML tools before the Sun JDK caused the OpenJDK to get installed, so I switched the order of some items. Also figured out a better way of enabling the partner repo that will work with other distros than Lucid, and made a couple of other tweaks. The full script is below (since our backup server is down at the moment). I've also built Jenkins4 as a Natty 11.04 server, and I'm testing the script on that to see if it might work there too. It seems to be running fine, and I've got as far as a working Jenkins once before retreating to create a useful restore point and fix some bugs. It's quite plausible it might work perfectly well on any Ubuntu between Lucid and Natty.
#!/bin/bash #The Mighty Jenkins Builder Script. #Note that this should be run as root (with sudo). echo "Entering the Mighty Jenkins Builder Script." uid=$(/usr/bin/id -u) && [ "$uid" = "0" ] || { echo "This script must be run as root."; exit 1; } echo "Running as root: good." #First do updates. echo "Doing system updates before starting on anything else." apt-get update apt-get upgrade #Now add the repositories we want. echo "Backing up repository list." cp /etc/apt/sources.list /etc/apt/sources.list.bak #Uncomment partner repos. echo "Uncommenting partner repositories on sources list, so we can get Sun Java." #Note: this is very crude, and also enables the CD-ROM source, which results in #errors. We need to make this more precise. #sed -i -e "s/# deb/deb/g" /etc/apt/sources.list #This is a better replacement: sed -i -re '/partner/ s/^#//' /etc/apt/sources.list #First Jenkins echo "Adding Jenkins repository." wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | apt-key add - echo "deb http://pkg.jenkins-ci.org/debian binary/" > /etc/apt/sources.list.d/jenkins.list #Next TEI. echo "Adding TEI Debian repository." gpg --keyserver wwwkeys.uk.pgp.net --recv-keys FEA4973F86A9A497 apt-key add ~/.gnupg/pubring.gpg echo "deb http://tei.oucs.ox.ac.uk/teideb/binary ./" > /etc/apt/sources.list.d/tei.list #Now we can start installing packages. echo "Updating for new repositories." apt-get update echo "Installing Sun Java JDK." apt-get install sun-java6-jdk && echo "Installing core packages we need." apt-get install openssh-server libxml2 libxml2-utils devscripts xsltproc debhelper subversion trang && #TEI packages echo "Installing TEI packages." apt-get install psgml xmlstarlet debiandoc-sgml linuxdoc-sgml jing jing-trang-doc libjing-java rnv texlive-xetex && apt-get install trang-java tei-p5-doc tei-p5-database tei-p5-source tei-schema tei-emacs saxon nxml-mode-tei tei-p5-xsl tei-p5-xsl2 tei-roma onvdl tei-oxygen zip && #I don't believe the following step is necessary, so it's been commented out for the moment. #Waiting for info from SR and SY about why it was in the instructions. #echo "Removing things that cause problems for TEI." #apt-get remove `apt-cache search gcj | grep gcj | awk '{print $1}'` #Setting up configuration for oXygen mkdir /root/.com.oxygenxml chown jenkins /root/.com.oxygenxml chmod a+x /root/.com.oxygenxml mkdir /root/.java chown jenkins /root/.java chmod a+x /root/.java echo "Don't forget to put your licensekey.txt file in the folder /usr/share/oxygen so that oXygen is registered." #More packages needed echo "Installing packages needed for building TEI source." #Various fonts and the like. echo "Installing fonts we need." apt-get install msttcorefonts ttf-arphic-ukai ttf-arphic-uming ttf-baekmuk ttf-junicode ttf-kochi-gothic ttf-kochi-mincho echo "The Han Nom font is not available in repositories, so we have to download it from SourceForge." cd /usr/share/fonts/truetype mkdir hannom cd hannom wget -O hannom.zip http://downloads.sourceforge.net/project/vietunicode/hannom/hannom%20v2005/hannomH.zip unzip hannom.zip find . -iname "*.ttf" | rename 's/\ /_/g' rm hannom.zip fc-cache -f -v #Jenkins apt-get install jenkins #Configuration for Jenkins echo "Starting configuration of Jenkins." echo "Getting the Hudson log parsing rules from TEI SVN." cd /var/lib/jenkins svn export https://tei.svn.sourceforge.net/svnroot/tei/trunk/P5/Utilities/hudson-log-parse-rules chown jenkins hudson-log-parse-rules echo "Getting all the job data from TEI SVN." #Don't bring down the config.xml file for now; that contains security settings specific to #Sebastian's setup, and will prevent anyone from logging in. We leave the server unsecured, #and make it up to the user to secure it. #svn export https://tei.svn.sourceforge.net/svnroot/tei/trunk/Documents/Editing/Jenkins/config.xml #chown jenkins config.xml svn export --force https://tei.svn.sourceforge.net/svnroot/tei/trunk/Documents/Editing/Jenkins/jobs/ jobs chown -R jenkins jobs echo "Installing Jenkins plugins." cd plugins wget --no-check-certificate http://updates.jenkins-ci.org/latest/copyartifact.hpi chown jenkins copyartifact.hpi wget --no-check-certificate http://updates.jenkins-ci.org/latest/emotional-hudson.hpi chown jenkins emotiosudnal-hudson.hpi wget --no-check-certificate http://updates.jenkins-ci.org/latest/greenballs.hpi chown jenkins greenballs.hpi wget --no-check-certificate http://updates.jenkins-ci.org/latest/jobConfigHistory.hpi chown jenkins jobConfigHistory.hpi wget --no-check-certificate http://updates.jenkins-ci.org/latest/plot.hpi chown jenkins plot.hpi wget --no-check-certificate http://updates.jenkins-ci.org/latest/log-parser.hpi chown jenkins log-parser.hpi wget --no-check-certificate http://updates.jenkins-ci.org/latest/scp.hpi chown jenkins scp.hpi wget --no-check-certificate http://updates.jenkins-ci.org/latest/WebSVN2.hpi chown jenkins WebSVN2.hpi echo "Restarting Jenkins server, so that it finds and initializes all the new plugins." /etc/init.d/jenkins restart echo "OK, we should be done. Now you have to:" echo "1. Put your oXygen licence key in a file called licensekey.txt in the oXygen directory (/usr/share/oxygen/)." echo "2. Go to the Jenkins interface on http://localhost:8080, and set up authentication. Read the Jenkins docs." echo "That's it!" read exit