Links
- Manual
- www.virtualbox.org/svn/vbox/trunk/src/VBox/Main/src-all/Global.cpp
- Defaults for different OSes are listed here.
- Limitations to running in a VM
- http://unix.stackexchange.com/a/38474
- Power consumption will also be much higher
- Python SDK via pyvbox
- https://github.com/mjdorma/pyvbox
- http://pythonhosted.org/pyvbox/readme.html#getting-started
- https://pypi.python.org/pypi/pyvbox
- virtualbox.library.IVirtualBox
session
→ ISession
- virtualbox.library.IMachine
- virtualbox.library.MachineState
- virtualbox.library.ISession(interface=None, manager=None)
console
→ IConsole)
- virtualbox.library.IConsole(interface=None)
- restore_snapshot(snapshot=None)
- take_snapshot(name, description)
- create_shared_folder(name, host_path, writable, automount)
- remove_shared_folder(name)
- display
- keyboard
- power_button()
- power_down()
- power_up()
- power_up_paused()
- power_sleep_button()
- reset()
- resume()
Notes
- Host-Only Networking / Adapter
- The IP address to reach the host machine when using the
Host Only Network Adapter
is192.168.56.1
- If you have daemons that were brought up before
VirtualBox initialized the Host Only interface, then you
can use something like this to forward specific ports so
that stuff from inside the VM can connect to the host.
sudo socat TCP-LISTEN:80,reuseaddr,bind=192.168.56.1,fork TCP:localhost:80
sudo socat TCP6-LISTEN:80,reuseaddr,bind=192.168.56.1,fork TCP6:localhost:80
- The IP address to reach the host machine when using the
Shared Folders
These show up under vboxsvr
. Mount like this under
windows.
net use H: \\vboxsvr\sharename
Missing TAP/TUN / need to restart?
sudo /Library/StartupItems/VirtualBox/VirtualBox restart # Confirm permissions sudo chown -R root:wheel /Library/StartupItems sudo chmod -R 0755 /Library/StartupItems
Suggestions for Ubuntu guest
- Enable IO APIC, VT-x, PAE/NX and Nested Paging
- Disable EFI
- Set HW Clock in UTC
- Set chipset to ICH9
- 128MB video RAM
- Use VirtIO drivers for network and disk
- Disable promiscuous mode for network
- Execution Cap: You can set this to less than 100% – but watch for clock drift if you do that.
- Disable Unity! Because both 2D and 3D accel is disabled, Unity 3D should not be installed. But ensure that it is disabled and isn't trying to use CPU emulation instead.
- Install Guest Additions and extension packakages
- VirtualBox extension pack
Guest Additions
Ref: VirtualBox extension pack
- Install the dependencies
sudo aptitude install build-essential dkms
- Linux headers
- This depends on the kernel. Install
linux-headers-X
whereX
is the ending 1 or 2 words ofuname -r
(e.g.server
,generic-pae
) - e.g.
sudo apt-get install linux-headers-generic
- This depends on the kernel. Install
- Install Guest Additions
- Mount it
- Run as sudo:
VBoxLinuxAdditions.run
Linux VM Clone considerations
Ref: Preparing Linux Template VMs
- Each clone should differ on:
- mac addresses, UUIDs
- hostname, domain suffix, IP addresses, networking, routing and firewall rules
- SSH host keys, nginx/openvpn certificates
- Mounts
- Unmount NFS exports before you clone the machine.
- Unmount other stuff stuff you don't want mounted that way on the new machines.
- Networking
- New hostname.
- Change domain suffix if needed.
- IP address. Is it still DHCP based? Static IPs need to be changed.
- Routing changes if any.
- Firewall rules.
- Monitoring data, etc.
- SSH host keys
- Delete
/etc/ssh/ssh_host_*
before powering off the VM and cloning it. They will be recreated on startup. - Or: On first boot of the clone,
rm /etc/ssh/ssh_host_*
followed bydpkg-reconfigure openssh-server
.
- Delete
- If
/etc/udev/rules.d/70-persistent-net.rules
exists, you might have to delete it. - Other certificates and keys
- Nginx SSL certificate to match the new hostname.
- OpenVPN certificate.
- known_hosts files
- Nice to do before the clone
apt-get clean
- Force log rotation so they start afresh on the clones. Delete old logs.
- Clean out tmp.
rm -rf /tmp/* ; rm -rf /var/tmp/*
- Zero out free space. Consolidate used space.
- If your VM used a sparse disk though, this grows it before shrinking it (with more effort) and so it might not be worth it.