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.
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.
Step 1 - Install VirtualBox and Vagrant 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.
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.
Step 2 - 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 jenkins http://bit.ly/vagrant-debian
Step 3 - Modify
Vagrantfile and uncomment this line of code. This will allow us to use the Jenkins web interface for its configuration.
config.vm.network "private_network", ip: "192.168.33.10"
Step 4 - Start downloading
Now that you've configured your
Vagrantfile, it's time to start downloading.
Step 5 - Log into your dev environment
ssh command will allow you to log into your newly installed development environment.
Step 6 - 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.
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian 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
apt-get to install Jenkins.
sudo apt-get install -y jenkins
Step 7 - Visit the Admin Portal
Visit http://192.168.33.10:8080/login to see how things look.
Step 8 - Log In
jenkins.log to find the initial administrative password.
Step 9 - Install additional plugins
Congratulations! You've installed VirtualBox, Vagrant and Jenkins. All that's left is a few more Jenkins plugins.
Step 10 - Ta Da!
Now it's time to actually get started.