Chris Mendez in For Developers, Tools for Software Engineers, Jenkins, VirtualBox

Installing Jenkins using VirtualBox and Vagrant

Jenkins is a server dedicated to automating and scheduling tasks. Many development teams use it to ensure that their apps are working by scheduling tasks, tests or any other kind of chore.

There are many ways to install Jenkins but this blog entry will focus on using VirtualBox and Vagrant.

As a Mac user, if you're wondering why this is better than simply installing Jenkins through Homebrew, it's not. Homebrew is great and here's a tutorial. The purpose of using VirtualBox and Vagrant is help create a production-ready system that will ultimately live in the cloud. Jenkins is usually run on an independent machine that is accessed 24 hours a day so it makes sense, to me, to start creating a system that is AWS-ready rather than on my local computer.

The instructions below will show you how to install Jenkins on Linux Debian that you can later re-create elsewhere.

Step 1 - Install VirtualBox Locally

VirtualBox is a tool for creating virtual machines on your local computer. It can do much more but for now, all we need is a machine to host Jenkins.

Option 1 - Download VirtualBox installer

You can download the installer from the VirtualBox website.

Option 2 - Install using Homebrew

I prefer using Homebrew for managing my apps.

brew cask install --force virtualbox --verbose --debug

Step 2 - Install Vagrant Locally

Vagrant is used to help you create (and re-create) a development environment. Think of it this way, VirtualBox allows you to make a virtual computer but Vagrant will help you configure your machine to serve a specific purpose.

Option 1 - Download Vagrant Installer

You can download and install Vagrant using the installer.

Option 2 - Install using Homebrew

Using Homebrew, type this in.

brew cask install vagrant

Manage your vagrant machines in one place with Vagrant Manager for OS X.

brew cask install vagrant-manager

Step 3 - Create a Config file

Vagrant works by first creating a configuration file. The file is titled Vagrantfile and it will explain that we're going to install jenkins . Open up Terminal and type:

vagrant init debian/jessie64

You can find other Vagrant setups through Vagrant Cloud.

Step 4 - Modify Vagrantfile

Open up ~/Vagrantfile and uncomment the line of code below. This will allow us to use the Jenkins web interface for its configuration. "private_network", ip: ""

Step 5 - Start downloading

Now that you've configured your Vagrantfile, it's time to start downloading.

vagrant up

Step 6 - Log into your dev environment

Vagrant's ssh command will allow you to log into your newly installed development environment.

vagrant ssh

Step 7 - Install Jenkins

Now that you've ssh'd into your dev environment, it's time to download jenkins. The easiest thing for us to do is simply follow the these instructions.

Installing Jenkins on Ubuntu


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

Advanced Package Tools apt-get is a package manager for Debian and all we're asking it to do is update.

sudo apt-get update && sudo apt-get upgrade

Ask apt-get to install Jenkins.

sudo apt-get install -y jenkins

Step 8 - Visit the Admin Portal

Visit to see how things look.

Step 9 - Log In

Open up jenkins.log to find the initial administrative password.

vi /var/log/jenkins/jenkins.log

Step 10 - Install additional plugins

Congratulations! You've installed VirtualBox, Vagrant and Jenkins. All that's left is a few more Jenkins plugins.

Ta Da!

Now it's time to actually get started.