n00b-alert-1: Running Multiple Development Environments on Windows with Cygwin, VirtualBox and Vagrant

Technology seems to be moving so quickly; far too quickly for me to follow. Thanks to Dan, I’ve been able to ignore the evaluation of new shiny things, as he is keen to do this, whereas I am not. Occasionally he shows me something which raises my interest, even gets me excited. In this instance, it is the latter. Over the last few months Dan has tried and tested many different things, to see what suits our requirements best and we’ve now settled upon a number of things, which I will have to learn on my own following his departure in a week’s time. Therefore this last week is my crash course.

What we’re doing

I have in fact done this twice at home already, but a couple of weeks later trying to do it from my work PC is like starting from scratch. Therefore, Dan has invited me to his blog, to write some tutorials of my own, essentially for my own future consumption. This first one is about setting up multiple Virtual Machine instances for development purposes on my local PC.

What we need

Why Cygwin?

This could all be done via Windows, using CMD where necessary. However, as our server environments are *nix and as it’s what I am most familiar with from the command line, it is best to do this via Cygwin, to practice commands regardless of whether I am running these as Dev VMs or later down the line when rolling out to production.

Installation

  • Install Cygwin
    • I included the following options (use the search, rather than scrolling through the list):
      • nano
      • All SSL libraries – not sure which I need, but they don’t take up much disk space, so I included them all. Obviously I’ll be a little more conscious of what I am installing on the production box
      • All SSH libraries – ditto
    • I then set these alias in my ~/.bashrc file:
      • pico=nano – to use pico even though not installed
      • vagrant=vagrant.bat – to avoid typing the .bat which is necessary on Win but not *nix

      Then to refresh the profile run:

  • Install Oracle VirtualBox with default settings
  • Install Vagrant with default settings

Config

From here on we are in the Cygwin shell. I will run all the project folders from my D Drive, so I am making a folder there to store all my user project files. Then initialise Vagrant.

Testing the installation

Run through the Vagrant tutorial from this page, in order to re-familiarise myself with the Vagrant basics as well as testing that everything works correctly.

SSH from Cygwin

When trying to SSH into the new VM, as we are on Windows, we can either:

  1. Use PuTTY, by generating a PPK with PuttyGen
  2. Use the Cygwin shell SSH
    • Firstly chmod the insecure_private_key file to 700 – otherwise it will not import
       

      Thus mine is

    • SSH into the shell

      As you can see we’re in:

Upon success

That’s it for the moment. The next tutorial will be to learn provisioning the development instances with Chef Solo – Chef Server will be later down the line for the production servers.

Leave a Reply