Distributed LIBLINEAR: A Practical Guide to Establish Virtual Environment Using VirtualBox

When you are reading this page, you should have downloaded the MPI or Spark virtual machine image. If not, please visit MPI VirtualBox Guide or Spark VirtualBox Guide first.

In this tutorial, we assume you already have VirtualBox installed. On Ubuntu, to install it you simply need to run

    $ sudo apt-get update
    $ sudo apt-get install virtualbox
    


Let's start it step-by-step. :)

First, import the image,
    $ VBoxManage import pineapple.ova 
    
boot the virtual machine,
    $ VBoxManage startvm pineapple0 --type headless
    
wait for a few seconds and log in the virtual machine to check everything works well,
    $ ssh -p 51000 spongebob@localhost
    (password: verysecure)
    
and then power it off.
    spongebob@pineapple0:~$ sudo poweroff
    
Optional: If port 51000 has unfortunately already been used by another process, then please use another port, say, 52000.
    $ VBoxManage modifyvm pineapple0 --natpf1 delete unnamed
    $ VBoxManage modifyvm pineapple0 --natpf1 "unnamed,tcp,,52000,,22"
    
Because we are going to run Distributed LIBLINEAR, we need at least two machines. We can clone the existing one.
    $ VBoxManage clonevm pineapple0 --name pineapple1 --register
    0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
    Machine has been successfully cloned as "pineapple1"
    
Use port 51001 to ssh into your new virtual mahcine:
    $ VBoxManage modifyvm pineapple1 --natpf1 delete unnamed
    $ VBoxManage modifyvm pineapple1 --natpf1 "unnamed,tcp,,51001,,22"
    
It's time to boot your new machine:
    $ VBoxManage startvm pineapple1 --type headless
    
Now try to ssh into your new machine:
    $ ssh -p 51001 spongebob@localhost
    (Sure, your password is still "verysecure".)
    
You may notice that your new machine now is still called "pineapple0," and its ip is still 192.168.0.1. We have to change them. First rename "pineapple0" to "pineapple1" in the following file.
    spongebob@pineapple0:~$ sudo vi /etc/hostname
    
Then, add "192.168.0.2 pineapple1" to the following file.
    spongebob@pineapple0:~$ sudo vi /etc/hosts
	
Change 192.168.0.1 to 192.168.0.2 in the following file.
    spongebob@pineapple0:~$ sudo vi /etc/network/interfaces
    
If you see the following message, no worries!
    sudo: unable to resolve host pineapple0
    
Reboot.
    spongebob@pineapple0:~$ sudo reboot
    
Now boot pineapple0,
    $ VBoxManage startvm pineapple0 --type headless
    
add "192.168.0.2 pineapple1" to the following file,
    $ ssh -p 51000 spongebob@localhost
    $ sudo vi /etc/hosts
    
and try to log in pineapple1.
    spongebob@pineapple0:~$ ssh pineapple1 echo "hello"
    (Enter yes if you are questioned.)
    [some outputs skipped]
    hello
    
IMPORTANT: You should see "hello" WITHOUT typing password.

Congratulations! You just planted two pineapples. Now go back to MPI VirtualBox Guide or Spark VirtualBox Guide to run Distributed LIBLINEAR.