Install Jenkins Ubuntu

Posted on Sunday, January 26, 2014

This guide will go over installing and setting up Jenkins on a fresh Ubuntu 12.04 server.

In this installation I am going to follow the guide given at [1]

Installing Java 7

Install the latest java 7 files

>  sudo apt-get purge openjdk*
>  sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
>  sudo apt-get update
>  sudo apt-get install oracle-java7-installer
>  java -version

Installing Jenkins

Run the following commands to install Jenkins (as taken from [1])

>  wget -q -O - | sudo apt-key add -
> sudo sh -c 'echo deb binary/ > /etc/apt/sources.list.d/jenkins.list'
> sudo apt-get update
> sudo apt-get install jenkins

Open up the Jenkins web page (it listens on port 80)
My server happens to be running locally on

It works

Check to make sure the jenkins home directory is correct.
Click on Manage Jenkins

Then configure system

Make note of the Jenkins home directory (You may need to know it at some point)

Set up Jenkins security

Now that Jenkins is set up we need to set up its security to prevent unwanted users from logging in and running builds.  Out of the box anyone can get into Jenkins which is a bit of a security risk.

From the main Jenkins screen click on “Manage Jenkins”

Then click on Configure Global Security

Checkbox Enable Security

We are going to use our unix users /groups.  
Checkbox “Unix user/group database”  then click test to test the connection.  If it returns success you are good.

After clicking Test you should see this error

Jenkins needs to be added to the shadow group.  Run the following command to do this.

>  sudo usermod -a -G shadow jenkins

Restart jenkins

>  sudo /etc/init.d/jenkins restart

Go back and set the Security Realm to Unix and click Test again

Now we see success

Select the Matrix-based Security and add each user individually (in our case patman and shartley)

Add users or groups by hand

Then give them every permission (but make sure anonymous has no permissions).

Click Save at the bottom.

Now if you go to jenkins you will get a login prompt.

Put in your username/password  and login

That is it for a basic Jenkins install I have not set up any builds yet in it or set up Ant.

I will cover those in other articles.

[1]        Jenkins install guide (Ubuntu)
                Accessed 01/2014

No comments:

Post a Comment