Ghost, Vagrant, Chef, and Virtualbox

This is part two in a series of blog posts on migrating a Wordpress blog to Ghost.

I wanted to make sure my transition from Wordpress to Ghost would run smoothly so I decided to test everything in advance before actually making the switch. Fortunately there are several Open Source tools that make this possible. I initially tried Ghost's official Vagrant Github repo but had issues getting it working, so I rolled my own.

The following steps are tailored for a Mac but should work on Linux and Windows (with Cygwin installed).

These instructions will setup Ghost using Nginx, Sqlite, Node.js and all other dependencies. Everything gets installed using Vagrant and Chef cookbooks. What's nice about using this approach, is you can change it to suit your needs. For instance you could install MySQL or Postgres instead of using Sqlite. You just need to include the correct cookbook by editing the Berkfile and then add it to the default recipe.

  • Download Virtualbox and install it on your Mac. Launch Virtualbox and say yes if it asks you to install "Guest Additions".
  • Download Vagrant and install it on your Mac.
  • Install Homebrew to make installing other programs like Git easy:
ruby -e "$(curl -fsSL"  
brew install git  
  • Install RVM so we can install specific ruby versions and gemsets:
 curl -L | bash -s stable --autolibs=enabled --ruby=2.1.0
 rvm --default use 2.1.0
  • Open the "Terminal" application on your Mac and create a new ghost folder under your Documents folder and change into that new ghost directory:
mkdir ~/ghost  
cd ~/ghost  
  • Download my ghost-example Git repository that contains everything you need to install a new Ubuntu server inside Virtualbox with all the software to run a local Ghost blog:
git clone --recursive  
cd ghost-example  
bundle exec berks install --path cookbooks/  
git submodule foreach --recursive git checkout master  

Now let's setup a local URL to run against:

sudo nano /etc/hosts # enter your password when prompted  
CMD + V  # takes you to the end of the file # assign the IP address for the URL  
CTL + X # type Y to save in nano  

Now close your browser and re-open it (this will force the browser to read the changes you made to the /etc/hosts file).

Run Vagrant/Chef and post-install scripts to get everything needed for Ghost:

vagrant up  
vagrant ssh  
cd /vagrant/ghost  
sudo npm install -g grunt-cli  
sudo npm install  
grunt init  

Start Ghost server!

NODE_ENV=development npm start  

Click on this link to setup an Adminstrator account and login to Ghost.

You now have a working local Ghost blog. To stop the blog follow these steps:

CTL + C  
CTL + C  
vagrant suspend  

This will stop the VirtualBox VM but save all the work we've done.

To start up everything again it's simple:

cd ghost-example  
vagrant up  
vagrant ssh  
cd /vagrant/ghost  
NODE_ENV=development npm start  

Open your browser to: To add posts go to and login with your credentials.

This concludes part two. Part three of the series focuses on the migration of your data from Wordpress to Ghost.