Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Create a CUBRID Database VM with Vagrant and Chef Cookbook under 5 minutes

In this tutorial I will show how to create an Ubuntu/CentOS VirtualBox image with CUBRID Database under 5 minutes. In fact, you can use this solution to create multiple development environments (multiple VMs) with different versions of CUBRID installed on each of them, and all these under 5 minutes. It is as easy as:

$ vagrant up

Also I will show how to install PHP/PDO, Perl and Python drivers along the way. You will also see how to get CUBRID Web Manager working. Remember that all these is completed automatically without your intervention. If you want to see how to do the same and get CUBRID HA and SHARD configured, refer to:


Before I explain how and why the above works, I would like to first introduce the tools that you will need for this tutorial:

  1. VirtualBox - it is a powerful open source virtualization software similar to VMware Workstation.
  2. Vagrant - this is the key ingredient, the tool which will provide us with a base "box" (a clean Linux OS with a minimal set of software installed) on top of which we will provision, i.e. install different versions of CUBRID Database, Apache Web Server, PHP, and necessary CUBRID drivers.

Install both of these tools in your OS (Linux, Windows, Mac OS X). This is all you will need to get started.


Vagrantfile is a configuration file used by Vagrant. It includes the instructions for Chef Solo (an open source systems integration framework) to install the necessary software on top of a base Vagrant box.

I have created this file as well as the whole directory structure for you. You can download cubrid-vagrant-1.8.0.tar.gz (234K) archive to have it (or check the latest version from repo). It will provide you with a project directory structure to get started. When you extract it, you will see the following directory structure.

$ tar -zxf cubrid-vagrant.tar.gz
 $ ls cubrid-vagrant

This project already includes seven cookbooks including the one for CUBRID (Github repo). You do not have to know how cookbooks work. They are for Chef Solo to know how to install CUBRID and other related software.

If you look into Vagrantfile, you will see the following configurations.

# -*- mode: ruby -*-
  # vi: set ft=ruby : do |config|
    # All Vagrant configuration is done here. The most common configuration
    # options are documented and commented below. For a complete reference,
    # please see the online documentation at
    # Every Vagrant virtual environment requires a box to build off of. = "precise64" # Ubuntu 12.04 x64 = "centos63" # CentOS 6.3 x64
    # Assign this VM to a host-only network IP, allowing you to access it
    # via the IP. Host-only networks can talk to the host machine as well as
    # any other machines on the same network, but cannot be accessed (through this
    # network interface) by any external networks. :hostonly, ""
    # Enable provisioning with chef solo, specifying a cookbooks path, roles
    # path, and data_bags path (all relative to this Vagrantfile), and adding
    # some recipes and/or roles.
    config.vm.provision :chef_solo do |chef|
      # This path will be expanded relative to the project directory
      chef.cookbooks_path = "cookbooks"
      # specify which version of CUBRID we would like to install
      chef.json = {
          "cubrid" => {
              #"version" => "8.4.3",
              #"new_dbs" => "newtestdb",
              #"ha_dbs" => "ha_test_db",
              #"ha_hosts" => {"node1" => "", "node2" => ""}
      # "apt" is necessary to perform "apt-get update" command on Ubuntu OS.
      # Comment it out if using CentOS.
      chef.add_recipe "apt"
      # "apache" Web server to run PHP apps
      chef.add_recipe "apache2"
      chef.add_recipe "apache2::mod_php5"
      chef.add_recipe "apache2::mod_rewrite"
      # install PHP
      chef.add_recipe "php"
      # install CUBRID Database
      chef.add_recipe "cubrid"
      chef.add_recipe "cubrid::demodb"
      #chef.add_recipe "cubrid::ha"
      #chef.add_recipe "cubrid::new_dbs"
      chef.add_recipe "cubrid::pdo_cubrid"
      chef.add_recipe "cubrid::perl_driver"
      chef.add_recipe "cubrid::php_driver"
      chef.add_recipe "cubrid::python_driver"
      #chef.add_recipe "cubrid::shard"
      chef.add_recipe "cubrid::web_manager"

All lines which precede with a hash (#) symbol are comments.

Our Vagrantfile says to Chef Solo to:

  1. Use apt cookbook to update the Ubuntu OS, which is used as our base box. Comment that line out if creating a CentOS VM.
  2. Use apache2 cookbook to install Apache Web Server and its mod_php5 and mod_rewrite modules.
  3. Use php cookbook to install PHP 5.3.3.
  4. Use cubrid cookbook to install CUBRID version 9.0.0, its demodb database, PDO/PHP, Perl and Python drivers, automatically create multiple database, and auto configure CUBRID HA on multi VM environment. Instead of default CUBRID 9.0.0 Database, you can also install other versions like 8.4.3 or 8.4.1. To learn more, refer to cubrid-cookbook Github repo.

If you do not want to install a particular package, simply comment it out.

If necessary, you can extend the above Vagrantfile by adding other cookbooks and their recipes. You can find cookbooks for most software at Simply download the necessary cookbook, and place it under cookbooks/ directory. Then refer to it by adding one of its recipes to a Vagrantfile. You can also search for cookbooks at the official community site at

Vagrant Box

Since we are ready to launch our VM and have Vagrant provision it, let's make our last stroke - indicate which OS to use. Vagrant community provides several base boxes:

There are dozens more community-made boxes at You can download other Linux distributions from there. For example, here is a CentOS box from the community.

In order to indicate which box to use, you need to run the following command specifying the URL where to download the box. In this tutorial we will use Ubuntu Server 12.04 x64 and name it precise64. This is an arbitrary name that we chose to distinguish this box from other boxes which we may potentially install later. This name is used in our Vagrantfile as a value for configuration parameter.

vagrant box add precise64

You can add multiple boxes. They will be stored by Vagrant at ~/.vagrant/boxes directory for your later use.

Start Up Vagrant

Now, let's start Vagrant:

$ cd cubrid-vagrant
$ vagrant up
default VM already created. Booting if it's not already running...
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 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 -- v-csc-1: /tmp/vagrant-chef-1/chef-solo-1/cookbooks
default Running provisioner: Vagrant::Provisioners::ChefSolo...
default Generating chef JSON and uploading...
default Running chef-solo...

This will continue for a while. On my computer it takes less than five minutes to provision everything from the ground up.

Host IP

As you can notice from Vagrantfile, we have set as the IP address of our VM. You can use this IP to connect to CUBRID from CUBRID Query Browser or CUBRID Manager administration tools.

To test if Apache was successfully installed, navigate to in your browser. You should see Apache's default "It works!" message.

Connecting to a demodb database

Recipe: demodb

Since, in Vagrantfile we have asked Chef Solo to install the demodb database, you may want to test your first database connection with it. The default database username is dba with an empty ('') password.

Testing PHP and PDO drivers

Recipe: pdo_cubrid
Recipe: php_driver

Run the following command to see if CUBRID PHP and PDO driver have been successfully installed.

$ pecl list
Installed packages, channel
Package    Version    State
CUBRID stable


Testing the Python driver

Recipe: python_driver

Run the following command inside your VM to see if CUBRID Python driver has been successfully installed.

$ pip freeze


Testing the Perl driver

Recipe: perl_driver

Run the following command inside your VM to see if CUBRID Perl driver has been successfully installed.

$ cpan -l
DBD::cubrid      9.000000001  CUBRID/DBD-cubrid-

Testing CUBRID Web Manager

Recipe: web_manager

If you added web_manager recipe, you can access CUBRID Web Manager at Notice HTTPS and 8282 port. The default username and password to connect to CUBRID Manager Server are admin/admin. Once you login for the first time, CWM will prompt you to change the password. Visit CWM Wiki for more information and tutorials.

Establish SSH connection

You can connect to this VirtualBox VM using a shortcut command like:

$ vagrant ssh

That's all! It will login under vagrant user automatically. You will have full access to the underlying OS, and can perform sudo operations with no password.

Stop VM

To gracefully power off the VM, run the following command:

$ vagrant halt

Start VM

To start the VM, run the same command we ran to bring up this VM.

$ vagrant up

Change Vagrantfile configurations

When you had enough time to play with this VM, you may now want to extend it by installing additional software, or changing the host IP, forwarding host ports to guest ports, or doing lots of other things. Once you have made changes, you need to reload your VM.

$ vagrant reload

This will simply reload your VM with the new configurations, new software, etc. If some of the software is already installed during the previous boot, Vagrant will not skip them. So, this process is relatively quick than building VM from scratch.

Delete VM

When you are done playing with this VM, you may finally decide to delete it. You can do this by running the following command:

$ vagrant destroy

Next time you hit vagrant up command, it will rebuild the VM from ground up.


Now you're ready to develop your applications based on CUBRID Database. At any time, you can clone this project, including the Vagrantfile and cookbooks directory, and start up a fresh VM with different versions of CUBRID.

We have create two more related tutorials where you can learn how to create multiple VMs automatically with CUBRID installed on each of them and configure CUBRID HA and CUBRID SHARD. Refer to these tutorials.

If you have questions, feel free to ask at CUBRID Q&A site, forum, our Facebook page, or Twitter.

If you have issues or feature requests to cubrid-cookbook, create a new issue at its Github repo.

comments powered by Disqus
Page info
viewed 6605 times
translations en
posted last year by
Esen Sagynov
updated last year by
View revisions
Share this article