Skip to content

Setting up the Cubium Dev Environment

Jack Conrad Kiefer II edited this page Aug 31, 2017 · 2 revisions

Setting up Vagrant

Cubium uses Vagrant to create a virtual development environment in order to homogenize the environment in which Cubium is running in. This completely eliminates "it works on my system" bugs, especially since Cubium interacts so intimately with the operating system. Currently, the OS that we are developing for is Debian 8, as it is a familiar OS that the BeagleBone Black natively supports. In the future, however, we'll utilize the Yocto Project build system to create our own OS distribution for the Beaglebone and other hardware platforms.

In the meantime, this guide will walk you through setting up the Debian virtual machine (VM) you'll need to start developing!

Installation & First-Time Setup

  1. Install VirtualBox if you haven't already
  1. For Vagrant/VirtualBox to work properly, ensure you have the following BIOS settings:
  • UEFI Secure boot disabled
  • Virtualization Technology (VTx) enabled
  • Virtualization Technology Directed I/O (VTd) enabled
  1. Install the latest version of Vagrant
  1. Install the VB Guest Additions Vagrant plugin
  • Mac & Linux: vagrant plugin install vagrant-vbguest
  • Windows: C:\vagrant\vagrant\embedded\bin\gem.bat install vagrant-vbguest
  • If installation of the vagrant-vbguest fails update the sources C:\vagrant\vagrant\embedded\bin\gem.bat sources --remove https://rubygems.org/ C:\vagrant\vagrant\embedded\bin\gem.bat sources -a http://rubygems.org/
  1. Be sure you've cloned in the repository and are in the Cubium directory

  2. Type vagrant up into your terminal to launch the VM

  3. Allow vagrant to finish setting everything up before doing anything in the VM. This will take a number of minutes, and it might appear to be stuck at times. Just give it time. A lot of time. Sometimes it may be a bit finicky and fail to initialize with some error; if that happens, just enter vagrant destroy and try again.

Default credentials:

  • Login: vagrant
  • Password: vagrant

Using Vagrant

By using the power of VirtualBox synced folders, any files you put into the Cubium directory will be synced to the corresponding directory on the VM. By default, this directory is /Cubium (at the root). The files sync in real-time, so there's no need to worry about waiting between saving a file on your machine and executing it on the VM (cool, right?!)

The development philosophy here is that you do all of the editing and file management on your own machine in your preferred way, and all of the testing and running in the VM. This way, you may still use your favorite IDE/text-editor and your favorite operating system on your own machine!

There's two ways of doing this:

  1. Navigate to the Cubium directory on your host machine and use vagrant ssh to log right into the VM from your own terminal. This is the typical practice among current devs. If you need multiple terminals into the VM (and you most likely will eventually), simply launch as many terminals as you need on your host machine and vagrant ssh in each of them.
  2. You can enable the VirtualBox GUI by simply changing setting vb.gui = false in the Vagrantfile to vb.gui = true and entering the vagrant reload command. This will launch a typical VB window and let you open windows and click around.

As for tearing down the VM when you're done working, you have a few options. vagrant halt is just like shutting down a physical machine. It will take the time to shut down properly, it's state will be saved into main memory, and it will also take some time to boot up the next time you vagrant up. If you want to just put the VM to sleep for a bit, vagrant suspend will suspend the session without totally shutting down. When you do this, the VM's state will live in your RAM and thus restrict your late-night gaming performance. Finally, vagrant destroy just kills the VM and completely erases all traces of it from your computer. The VM will have to completely reinitialize the next time you vagrant up. Uhh, don't do this unless you explicitly know that you want to.

TL;DR

In the Cubium directory:

  • vagrant up
  • vagrant halt to shut down
  • vagrant suspend to sleep
  • vagrant destroy to utterly annihilate every last byte of data
Clone this wiki locally