Ruby – :Symbols and “Strings”

I’m no ruby expert.
Actually i only know enough to write a bit of chef recipes.
If you read enough chef recipes you’ll notice a syntax like the following occur often

default[:mario][:powerup] = "mushroom"

and sometimes you’ll see it as

default["luigi"]["powerup"] = "fireflower"

So what’s the difference?


A symbol is immutable. This means you’re not reassigning values to it later. It stays as is, like a hillbilly in a trailer home.


A string is mutable. This means you can keep changing the value of it on the fly. Like a gigolo in a bad economy.

All of this information was stolen from another extremely useful and thorough blog at:
He’s exponentially better at explaining this than i am.


Chef Server in 4 Steps

This is for CentOS6

Install EPEL repositories

$ RPMNAME=$(wget -qO-`uname -i`/ |grep epel |grep rpm |while read i ; do expr "$i" : '.*href="\(.*\)">epel.*'; done)
$ rpm -Uvh`uname -i`/$RPMNAME

Install RBEL repositories

$ rpm -Uvh

Install Chef Server

$ yum -y --nogpgcheck install rubygem-chef-server

Login to the Web Administration Page

user: admin password: chef321go