Skip to content

Instantly share code, notes, and snippets.

@davidjrice
Created June 6, 2012 17:00
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save davidjrice/2883299 to your computer and use it in GitHub Desktop.
Save davidjrice/2883299 to your computer and use it in GitHub Desktop.
Vagrantfile for an Ubuntu lucid 32 or 64 bit VM with couchbase 2.0.0.dp4.1

Install Virtualbox

wget http://download.virtualbox.org/virtualbox/4.1.16/VirtualBox-4.1.16-78094-OSX.dmg
open VirtualBox-4.1.16-78094-OSX.dmg
# double click .pkg to install

Install vagrant

gem install vagrant --no-ri --no-rdoc

Setup Vagrant VM Project

mkdir test
cd test
wget https://gist.github.com/raw/2883299/f5a64bf9f9445a4ef585ceec23d148ce83220808/Vagrantfile
export COUCHBASE_HOST=192.168.2.254 # Need to set an IP to bind the VM to.
vagrant up

Output

➜ vagrant up
[default] Importing base box 'lucid32'...
[default] The guest additions on this VM do not match the install version of
VirtualBox! This may cause things such as forwarded ports, shared
folders, and more to not work properly. If any of those things fail on
this machine, please update the guest additions and repackage the
box.

Guest Additions Version: 4.1.14
VirtualBox Version: 4.1.16
[default] Matching MAC address for NAT networking...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Running any VM customizations...
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Configuring and enabling network interfaces...
[default] Mounting shared folders...
[default] -- v-root: /vagrant
[default] Running provisioner: Vagrant::Provisioners::Shell...
stdin: is not a tty
wget: couchbase-server-community_x86_2.0.0dp4r-730-rel.deb
install: couchbase-server-community_x86_2.0.0dp4r-730-rel.deb
Selecting previously deselected package couchbase-server.
(Reading database ... 
26974 files and directories currently installed.)
Unpacking couchbase-server (from couchbase-server-community_x86_2.0.0dp4r-730-rel.deb) ...
Setting up couchbase-server (2.0.0dp4r) ...
 * Started couchbase-server

You have successfully installed Couchbase Server.
Please browse to http://lucid32:8091/ to configure your server.
Please refer to http://couchbase.com for additional resources.

Please note that you have to update your firewall configuration to
allow connections to the following ports: 11211, 11210, 4369,
8091, 8092 and from 21100-to-21299.

By using this software you agree to the End User License Agreement.
See /opt/couchbase/LICENSE.txt.


Processing triggers for ureadahead ...
ureadahead will be reprofiled on next reboot
fin.

Caveat

Vagrant will not exit cleanly after running the "shell provisioner" to provision couchbase (no idea why as of yet) so you need to ctrl+c twice quickly after the above output is complete.

# -*- mode: ruby -*-
# vi: set ft=ruby :
# 64bit Couchbase
# MIRROR = "http://packages.couchbase.com/releases/2.0.0-developer-preview-4"
# VERSION = "couchbase-server-community_x86_64_2.0.0-dev-preview-4.deb"
# 32bit Couchbase
MIRROR = "http://builds.hq.northscale.net/releases/couch/2.0.0-dev-preview-4.1"
VERSION = "couchbase-server-community_x86_2.0.0dp4r-730-rel.deb"
# Vagrant: http://vagrantup.com
Vagrant::Config.run do |config|
# Use 32bit Ubuntu Lucid 10.04
config.vm.box = "lucid32"
config.vm.box_url = "http://files.vagrantup.com/lucid32.box"
# Use 64bit Ubuntu Lucid 10.04
# config.vm.box = "lucid64"
# config.vm.box_url = "http://files.vagrantup.com/lucid64.box"
# Set RAM to 1024mb
config.vm.customize ["modifyvm", :id, "--memory", 1024]
# Install Couchbase
# Either inline or path to shell script both hang the `vagrant up` command
# so using inline as it is easier.
#
# config.vm.provision :shell, :path => "couchbase.sh"
config.vm.provision :shell, :inline => INSTALLER
config.vm.network :hostonly, "#{ENV['COUCHBASE_HOST']}"
# TODO: port forwarding does not work yet with couchbase server
# (need to use hostonly network)
#
# Forward port for couchbase admin UI
# open http://localhost:8091
# config.vm.forward_port 8091, 8091
# Forward ports for couchbase client
# http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-network-ports.html
# config.vm.forward_port 8092, 8092
# config.vm.forward_port 11211, 11211
# config.vm.forward_port 11210, 11210
end
# Simple Couchbase Installer
INSTALLER = <<-SRC
echo wget #{VERSION}
wget -q #{MIRROR}/#{VERSION}
echo install #{VERSION}
sudo dpkg -i #{VERSION}
SRC
@danbars
Copy link

danbars commented Dec 19, 2013

Thank you, David.
This vagrant also works on my Windows 8 host.
Just create a folder, download the .vagrant file into it manually, and run in command line:
set COUCHBASE_HOST=192.168.2.254
vagrant up

Also I ran command line with admin rights.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment