sudo apt-get install dhcp3-server tftpd-hpa syslinux nfs-kernel-server initramfs-tools
cat /etc/default/tftpd-hpa
the output is
# /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/data/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-v --secure"
RUN_DAEMON="yes"
#OPTIONS="-l -s /data/tftpboot"
in order to run without superuser permission, we need change the permissions.
sudo usermod -G tftp YOURNAME # add your account to tftp group
sudo chgrp tftp /data/tftpboot
sudo chmod g+rw /data/tftpboot
sudo chgrp -R tftp /data/tftpboot/pxelinux.cfg
sudo chmod -R g+rw /data/tftpboot/pxelinux.cfg
sudo chgrp tftp /etc/dhcp3/dhcpd.conf
sudo chmod g+rw /etc/dhcp3/dhcpd.conf
ls -l /data
> drwxrwxrwx 9 root tftp 4096 2011-08-29 11:46 tftpboot
./pxe_manager.py --generate-pxe-filesystem /data/tftpboot/root_you
./pxe_manager.py --auto-add root_you --db=/data/tftpboot/pxe.db
602dhcp7.jsk.t.u-tokyo.ac.jp
After that, you need to restart dhcp service
sudo service dhcp3-server restart
./pxe_manager.py --generate-virtualbox-image VMNAME --db=/data/tftpboot/pxe.db
The MAC address of VMNAME is estimated from DB, which was generated by –auto-add command. You can use –virtualbox-macaddress option to specify the MAC address directly.
./pxe_manager.py --generate-virtualbox-image VMNAME --virtualbox-macaddress=00:11:22:33:44:55
If you specify a hostname of a physical machine, pxe_manager.py will decide the parameters of vm according to the spec of the machine. The parameters are the number of cpu and the size of memory (80% of the physical machine).
./pxe_manager.py --generate-virtualbox-image VMNAME --refer-physical-machine PHYS_MACHINE
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
echo "deb http://download.virtualbox.org/virtualbox/debian `lsb_release -cs` contrib non-free" | sudo tee /etc/apt/sources.list.d/virtualbox.list
sudo apt-get update
sudo apt-get install virtualbox-4.1
sudo /etc/init.d/vboxdrv setup
sudo apt-get install bridge-utils
sudo /etc/init.d/networking restart
Attached to: Bridged Adapter Name: eth0 Adapter Type: PCnet-PCI II Click on Cable connected
Make sure to enable 3D acceleration and allocate the right amount of cpu and memory resources.
NOTE: It would be great to have a script that configures the new VM.
VBoxManage list vms
"pxetest" {341ef969-487a-4827-a59e-905bb3fb8f7a}
"pxetest2" {904d947a-8723-433b-b27e-5cf9241c523b}
virtualbox --startvm VMNAME
VBoxManage startvm VMNAME --type headless
VBoxManage registervm foo.vms
rdesktop-vrdb HYPERVISORNAME:8888
VBoxManage controlvm VMNAME reset
import vboxapi
# todo