Hire me if you like: blake.irvin@gmail.com

Friday, September 03, 2010

OpenSolaris as a Vagrant Guest

Vagrant lets you quickly bring up local development or testing environments that parallel our production systems. Since we use RHEL right now for our production systems, we are using a CentOS 5.4 Vagrant box to bring up local dev environments.

Install VirtualBox 3.2.8.

Install the Vagrant gem (you need a local install of Ruby):

gem install vagrant
echo "export PATH=$PATH:~/.gem/ruby/1.8/bin:./" >> ~/.bash_profile

Add my OpenSolaris Vagrant box

vagrant box add opensolaris http://dl.dropbox.com/u/1321337/vagrant_boxes/opensolaris.box

Starting a Vagrant Project
Let's start a new project with Vagrant. We need to make a working directory for the project first:

export PROJ=[project_name]
mkdir ~/$PROJ
cd ~/$PROJ
vagrant init centos5.4
vagrant up; vagrant ssh

You can work in this isolated environment when testing. Keep in mind that your project directory is shared with the Vagrant host at /vagrant in the virtual environment's filesystem.

For deeper delving in the Vagrant mine, visit the Vagrant Getting Started page.

In case something goes wrong, it's useful to connect to the Vagrant box's virtual console. You can do this by making a Remote Desktop (RDP) connection to localhost:3389, with the username 'vagrant' and the password 'vagrant'.

No comments: