Friday, December 19, 2014

Installing Jenkins (with Git and Maven) on Ubuntu

Next Article: Creating a Maven Project in Jenkins.


Assumptions

  1. Ubuntu 14.04 64-bit
    1. within VirtualBox 4.3.20
    2. on Windows 7 64-bit
  2. Apache Maven 3.2.3 is installed
  3. Git is installed
  4. Java is installed



Outline

  1. Install Jenkins
  2. Installing the Github Plugin
  3. Configuring Jenkins
    1. System: Adding paths to Maven, Java and Git
    2. Security: Change the default logon



Installing Jenkins on Ubuntu


The Advanced Packaging Tool (APT) works with core libraries to handle the installation and removal of software on Debian Linux distros.  APT comes with multiple utilities, including apt-get.

The apt-get utility is used to perform installation of new software packages, removing existing software packages, upgrading of existing software packages and even used to upgrading the entire operating system.  The apt-get utility has a list of sources that it connects to for the purpose of downloading software.

To download Jenkins, we'll need to augment the list of sources that apt-get knows about it.  First, we need a public key from the jenkins site.  We'll grab this key, and add it to the apt-keys utility.

1. Adding the Jenkins Key
 sudo su  
 wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | apt-key add -  

The wget command will download this key from the server and add it to the list of apt-keys.

2. Creating a Sources List for Jenkins
 echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list  

3. Update the APT cache

Now, we only have to update apt's cache before we can install Jenkins
 apt-get update  

As the cache has been updated we can proceed installing Jenkins. Note that Jenkins has a big bunch of dependencies, so it might take a few moments to install them all.
 apt-get install jenkins  


4. Verification

Verify Installation
http://localhost:8080/
Jenkins requires a few minutes to initialize:




Installing the Git Plugin


The Github plugin is not installed by default with Jenkins.

Browse to the Jenkins start page at http://localhost:8080 and select
Manage Jenkins > Manage Plugins > Available


Click on the "Available" tag and type "GitHub Plugin" in the Filter text box:



Select this and proceed with the plugin installation.n


Jenkins Configuration


Jenkins may require additional configuration information.
Jenkins > Manage Jenkins > Configure System


Within the configuration page, specify the paths to

a local Java installation:


a local Maven installation:


a local Git installation:



Jenkins likewise offers the ability to install these tools automatically, if they do not already exist within your development environment.



Troubleshooting

  1. Git Plugin Integration
    1. Trigger: Adding a repository URL
    2. Message: Failed to connect to repository : Could not init /tmp/hudson/...
    3. Solution: Git was not installed locally
    4. Reference(s):
      1. http://jenkins-ci.361315.n4.nabble.com/Failed-to-connect-to-repository-Could-not-init-tmp-td4699972.html



References

  1. Installing Jenkins
    1. Installing and Using Jenkins on Ubuntu 12.04
  2. Restarting Jenkins
    1. http://stackoverflow.com/questions/8072700/jenkins-manual-restart
      1. sudo /etc/init.d/jenkins restart
      2. Usage: /etc/init.d/jenkins {start|stop|status|restart|force-reload}

4 comments:

  1. GREAT topic! It is really interesting to read from the beginning & I would like to share your blog to my circles, keep sharing… DevOps Online Training
    DevOps Training
    DevOps Online Training

    ReplyDelete