Skip to content

Instantly share code, notes, and snippets.

@bmarini
Created January 3, 2011 19:56
Show Gist options
  • Save bmarini/763860 to your computer and use it in GitHub Desktop.
Save bmarini/763860 to your computer and use it in GitHub Desktop.
Quick start to setup a chef server on virtualbox
#!/bin/bash
#
# Install virtualbox:
# - http://www.virtualbox.org/wiki/Downloads
# - Download iso: http://releases.ubuntu.com/10.10/
# - Create a new virtualbox using the iso as the install media
# - Change network adapter to bridged
# - Use ifconfig to get ip address
#
# Once you have a clean install of ubuntu...
# ssh:
sudo apt-get install openssl-server
sudo ufw enable
sudo ufw allow 22
# bootstrap chef
# http://wiki.opscode.com/display/chef/Bootstrap+Chef+RubyGems+Installation
sudo apt-get install ruby ruby-dev libopenssl-ruby rdoc ri irb build-essential wget ssl-cert vim
# rubygems:
cd /tmp
wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz
tar zxf rubygems-1.3.7.tgz
cd rubygems-1.3.7
sudo ruby setup.rb --no-format-executable
# chef:
sudo gem install chef
sudo mkdir -p /etc/chef
cat > /etc/chef/solo.rb <<EOF
file_cache_path "/tmp/chef-solo"
cookbook_path "/tmp/chef-solo/cookbooks"
EOF
cat > ~/chef.json <<EOF
{
"chef": {
"server_url": "http://localhost:4000",
"webui_enabled": true
},
"run_list": [ "recipe[chef::bootstrap_server]" ]
}
EOF
sudo chef-solo -c /etc/chef/solo.rb -j ~/chef.json -r http://s3.amazonaws.com/chef-solo/bootstrap-latest.tar.gz
# Open up server and web ui ports:
sudo ufw allow 4000
sudo ufw allow 4040
# Configure knife
# you may have permission problems on /etc/chef that you can chown to fix...
knife configure -i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment