Jenkins: Setting up a continuous integration server on Ubuntu

Jenkins is the open-source automation server that is critical in building a continuous integration and delivery pipeline.  It is extensible and has a wealth of plugins that  integrate with numerous enterprise systems.

Here are the detailed steps for installing a Jenkins server on Ubuntu.

Jenkins APT repository

The first step is to add the APT repository where the Jenkins .deb packages will be pulled:

# echo "deb http://pkg.jenkins.io/debian-stable binary/" | tee -a /etc/apt/sources.list.d/jenkins.list

# wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | apt-key add -

# apt-key adv --keyserver pool.sks-keyservers.net --recv-key 9B7D32F2D50582E6

# apt-get update

Install Packages

Now we need to install the prerequisite packages, open port 8080 for traffic, and then install the jenkins package:

# apt-get install openjdk-7-jdk git maven ant -y
# ufw allow 8080/tcp
# apt-get install jenkins -y

We have installed git, ant, and maven in order to support the most common plugins and tools.

Note that ‘pkg.jenkins.io’ points to other mirror sites like ‘ftp-chi.osuosl.org’ when downloading the .deb file, so it may be necessary to add other sites to your proxy whitelist.  If you see errors, do a wget directly to see if any redirects are happening.

Login to Jenkins

The final step is to pull up Jenkins in your browser, http://<server>:8080

The administrative user is “admin” and the initial password is in the file “/var/lib/jenkins/secrets/initialAdminPassword”.  The first time you pull up the web interface you will see a page like below and you should paste in the contents of the file.

Change this password immediately by clicking on “admin” in the top menu bar, then clicking “Configure”.

You’ll also want to add some plugins to enable the most common functionality: Git plugin, Git client plugin, Maven Integration plugin, and Maven Dependency Update plugin.  If you need more advanced authentication, the LDAP Plugin can provide SSO.

The main page will look like the screenshot below and you are ready to start building your pipeline.

 

REFERENCES

https://jenkins.io/

https://jenkins.io/doc/

https://www.cloudbees.com/blog/five-reasons-why-developers-choose-jenkins-over-hudson-continuous-integration

http://stackoverflow.com/questions/4973981/how-to-choose-between-hudson-and-jenkins

https://pkg.jenkins.io/debian/

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

https://vexxhost.com/resources/tutorials/how-to-install-configure-and-use-jenkins-on-ubuntu-14-04/