Hosting virtual machines on Solaris

Hosting virtual machines inside an OpenSolaris box is very easy with VirtualBox. Here’s a quick tutorial how to install an ubuntu into a virtual machine:

  1. Download VirtualBox from here.
  2. Open the manual into a tab from here.
  3. Follow the installation manual at chapter 2.4. The installation scripts will install VirtualBox under /opt, so if you want, you can now create a new zfs filesystem for /opt so that it wont pollute your root installation partition.
    Note: If you are using Nexenta, you need to use /usr/sun/sbin/pkgadd instead of simply pkgadd.

    Note:If you receivere this error:

    ## Waiting for up to <300> seconds for package administration commands to become available (another user is administering packages)
    pkgadd: ERROR: Unable to acquire package administration lock for this system; try again later
    pkgadd: ERROR: Unable to lock this zone for administration

    The sollution is to “cp /usr/sun/bin/pkgadm /usr/bin” and repeat the step.

  4. After these steps the VirtualBox host environment is installed.

So, you have now installed the server stuff, now it’s time to install the ubuntu into a virtual machine. If you are using Windows as your desktop follow the steps in chapter 7.4. Otherwise consult the manual to find a proper installation way. The chapter 7.4 guides you to use the headless installation where you connect to the virtual machine using windows remote desktop (which is quite nice). You can download the 32-bit ubuntu iso from here, or use some other cd/dvd image to boot up your system.

If you don’t want to use nat for your virtual machine and prefer a direct ip instead, replace step

VBoxManage modifyvm "Windows XP" -memory "256MB" -acpi on -boot1 dvd -nic1 nat

with

/usr/lib/vna e1000g0 0:0:0:0:10:01
ifconfig vnic0 plumb
ifconfig vnic0 dhcp
VBoxManage modifyvm "Windows XP" -memory "256MB" -acpi on -boot1 dvd -nic1 hostif -hostifdev1 vnic0

where e1000g0is the name of your physical network interface (use <em>ifconfig -a</em> to look it up) and0:0:0:0:10:01is an unique MAC address you invented from your hat. The VRDP (remote desktop server) will be binded to the ip of vnic0 interface which you can check with "ifconfig vnic0".

After setting up the VM you can finally start it by typing “VBoxHeadless -s <vm name>” and then connecting into it using remote desktop. Notice that the guest operating system might have different IP, so you need to check the guest IP after installation if you wish to connect into the guest with SSH.