Setting up virtual machines with Vagrant

I spent a week focusing on system administration, and I feel more comfortable with my setup already. My web server hosts a number of blogs (like this one!) as well as my tracking dashboard. I want to make sure that things are backed up and that I can verify that my backups are running by creating a working website. It’s also useful to have a separate development environment where I can try out server configuration changes before applying them to production. Virtual machines to the rescue!

Vagrant is a tool that makes it easy to create and manage virtual machines with forwarded ports and shared folders. I use it for a couple of Ubuntu-based virtual machines on my laptop, and another backup-focused virtual machine on our Ubuntu desktop.

2013-10-28 Setting up virtual machines with Vagrant

You can make your Vagrant box more secure by changing the default passwords for root and vagrant, and setting up your own SSH key. Use vagrant package and vagrant box add to make this a new base box.

Related tools:

  • Give Veewee kernel and install info, and it will make base boxes for you. Good for testing different versions of distributions.
  • Vagrant works with Chef, Puppet, or shell scripts for provisioning. Need to reverse-engineer config from an existing server? Check out Devstructure Blueprint.
  • If you upgrade kernels or Virtualbox/VMWare, you might find vagrant-vbguest handy.
  • If your host system is pretty much the same as your deployment system architecture, check out Docker for a lighter-weight way to isolate your development environment.

These are some of my notes from when I was setting up my VMs. Different console backgrounds in Putty really help!

2013-10-28 Setting up my development environment VMs


2013-10-28 Deployment procedures

  • Anders

    Hi Sacha,

    Thanks for the hints on admin with virtual servers.

    I am also doing something similar to you right now, trying to set up a safe and easily managed system infrastructure.

    As a thought, an alternative to Puppet and Chef that I will be looking into soon is Ansible.

    It seems Ansible maybe “better” in the sense of providing software deployment, ad hoc task execution, and configuration management all in one in contrast to Chef/Puppet. It also needs no slave server client, but injects code to the slave with ssh and then runs it (if I understood this correctly.) It only needs Python on the slave machine.

    If you are running Ubuntu 12.04: To set up an Ansible “master” on a Ubuntu server, you could do something like: get setuptools, then install pip with setuptools, then install virtualenv with pip and finally install Ansible from within a virtualenv environment.


    Kind regards,