Line 13: |
Line 13: |
| <li>Install kernel-devel to get the latest development tree (2.6.18-238.12.1.el5PAE-i686).</li> | | <li>Install kernel-devel to get the latest development tree (2.6.18-238.12.1.el5PAE-i686).</li> |
| | | |
− | Use this command only if you have PAE kernel installed:<br/>
| + | Use this command only if you have PAE kernel installed:<br/> |
| <pre>yum install kernel-PAE-devel</pre> | | <pre>yum install kernel-PAE-devel</pre> |
− | Otherwise,
| + | Otherwise, |
| <pre>yum install kernel-devel</pre> | | <pre>yum install kernel-devel</pre> |
| | | |
Line 59: |
Line 59: |
| | | |
| <li>Login to the server-manager page and create an ibay for <b>phpvbox</b>. Don’t forget to assign a password.</li> | | <li>Login to the server-manager page and create an ibay for <b>phpvbox</b>. Don’t forget to assign a password.</li> |
− | <li></li> | + | <li>Install phpVirtualBox</li> |
| + | <pre>cd /tmp<br/> |
| + | wget http://phpvirtualbox.googlecode.com/files/phpvirtualbox-4.0-6.zip<br/> |
| + | unzip phpvirtualbox-4.0-6.zip<br/> |
| + | cd phpvirtualbox-4.0-6<br/> |
| + | cp –R * /home/e-smith/files/ibays/phpvbox/html</pre> |
| + | <li>Create a <b>tmp</b> folder inside the /phpvbox/html folder.</li> |
| + | <pre>cd /home/e-smith/files/ibays/phpvbox/html<br/> |
| + | mkdir tmp |
| + | </pre> |
| + | <li>Open config.php (located on your /phpvbox/html/ folder) and uncomment some lines & change the tmp location as per below.</li> |
| + | <pre>nano /home/e-smith/files/ibays/phpvbox/html/config.php</pre> |
| + | <pre>/* SOAP URL of vboxwebsrv (not phpVirtualBox's URL) */<br/> |
| + | var $location = 'http://127.0.0.1:18083/';<br/> |
| + | <br/> |
| + | // Disable authentication<br/> |
| + | var $noAuth = true;<br/> |
| + | <br/> |
| + | // Host / ip to use for console connections<br/> |
| + | //var $consoleHost = '192.168.100.1';<br/> |
| + | <br/> |
| + | var $enableAdvancedConfig = true;<br/> |
| + | <br/> |
| + | // Authentication library.<br/> |
| + | //var $authLib = 'Builtin';<br/> |
| + | <br/> |
| + | // Allow VDE network configuration. This must be supported by the underlying VirtualBox installation!<br/> |
| + | var $enableVDE = true;<br/> |
| + | <br/> |
| + | // Path<br/> |
| + | var $cachePath = '../tmp';<br/> |
| + | </pre> |
| | | |
| + | <li>Disable authentication of vboxwebsrv (this is not recommended, but at this stage, this is the only setup that works). Login to the server’s SSH and type this command.</li> |
| + | <pre>vboxmanage setproperty websrvauthlibrary null</pre> |
| + | <li>Install VirtualBox extension pack to enable support for USB 2.0 devices, VirtualBox RDP and PXE boot for Intel cards.</li> |
| + | <pre>wget http://download.virtualbox.org/virtualbox/4.0.8/Oracle_VM_VirtualBox_Extension_Pack-4.0.8-71778.vbox-extpack<br/> |
| + | vboxmanage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.0.8-71778.vbox-extpack</pre> |
| + | |
| + | <li>Go to http://your_server’s_ip/phpvbox (e.g. http://192.168.100.1/phpvbox) to create our virtual machine. |
| + | <ul> |
| + | <li>Create a new virtual machine (e.g. vmXP)</li> |
| + | <li>Enable network card (either NAT or Bridged) so you can connect to your new VM console.</li> |
| + | <li>Open an RDP client (run->mstsc) then type your server’s IP address e.g. 192.168.100.1.</li> |
| + | </ul> |
| + | [[File:virtual_box.jpg]] |
| + | </li> |
| + | <li>Download VirtualBox Guest Addition from here http://download.virtualbox.org/virtualbox/4.0.8/VBoxGuestAdditions_4.0.8.iso and install it to your newly setup VM.</li> |
| + | </ol> |
| + | |
| + | ===Automatically Start Virtual Machine in case Power Failure=== |
| + | |
| + | <ol> |
| + | <li>Create a file (e.g. startXP) on /etc/init.d/</li> |
| + | <pre>nano /etc/init.d/startXP</pre> |
| + | startXP code should look like this: |
| + | <pre>vboxmanage startvm --type headless vmXP</pre> |
| + | |
| + | <li>Edit your <b>vbox<b> file on /etc/sysconfig/</li> |
| + | <pre>nano /etc/sysconfig/vbox</pre> |
| + | vbox code should look like this: |
| + | <pre> |
| + | # Virtual box machines to autostart<br/> |
| + | # Example to start 2 machines<br/> |
| + | # VBOX_AUTOSTART = "MachineName1 MachineName2"<br/> |
| + | <br/> |
| + | VBOX_AUTOSTART="vmXP"<br/> |
| + | </pre> |
| + | |
| + | <li>Edit your vbox file located on /etc/init.d/</li> |
| + | <pre> |
| + | #!/bin/sh<br/> |
| + | #<br/> |
| + | # chkconfig: - 91 35<br/> |
| + | # description: Starts and stops vbox autostart VMs.<br/> |
| + | <br/> |
| + | ### BEGIN INIT INFO<br/> |
| + | # Provides: vbox<br/> |
| + | # Required-Start: $network $named $vboxdrv<br/> |
| + | # Required-Stop: $network $named<br/> |
| + | # Default-Start:<br/> |
| + | # Default-Stop: 0 1 2 3 4 5 6<br/> |
| + | # Short-Description: Autostart some Virtual Box VMs<br/> |
| + | # Description: Autostart some Virtual Box VMs that are mentioned in /etc/sysconfig/vbox file<br/> |
| + | # Written by Alex Amiryan<br/> |
| + | ### END INIT INFO<br/> |
| + | <br/> |
| + | . /etc/rc.d/init.d/functions<br/> |
| + | <br/> |
| + | MANAGE_CMD=vboxmanage<br/> |
| + | <br/> |
| + | [ -r /etc/sysconfig/vbox ] && . /etc/sysconfig/vbox<br/> |
| + | <br/> |
| + | prog=$"Virtual Box Machines"<br/> |
| + | <br/> |
| + | start()<br/> |
| + | {<br/> |
| + | echo -n $"Starting $prog: "<br/> |
| + | RETVAL=0<br/> |
| + | <br/> |
| + | for vbox_name in ${VBOX_AUTOSTART}<br/> |
| + | do<br/> |
| + | SERVS=1<br/> |
| + | echo -n "${vbox_name} "<br/> |
| + | daemon $MANAGE_CMD startvm "${vbox_name}" -type headless >/dev/null 2>&1<br/> |
| + | RETVAL=$?<br/> |
| + | [ "$RETVAL" -eq 0 ] || break<br/> |
| + | done<br/> |
| + | if [ -z "$SERVS" ]; then<br/> |
| + | echo -n "no virtual machines configured "<br/> |
| + | failure<br/> |
| + | RETVAL=6<br/> |
| + | else<br/> |
| + | if [ "$RETVAL" -eq 0 ]; then<br/> |
| + | success $"vbox startup"<br/> |
| + | touch /var/lock/subsys/vbox<br/> |
| + | else<br/> |
| + | failure $"vbox start"<br/> |
| + | fi<br/> |
| + | fi<br/> |
| + | echo<br/> |
| + | return "$RETVAL"<br/> |
| + | }<br/> |
| + | <br/> |
| + | stop()<br/> |
| + | {<br/> |
| + | echo -n $"Shutting down $prog: "<br/> |
| + | for vbox_name in ${VBOX_AUTOSTART}<br/> |
| + | do<br/> |
| + | echo -n "${vbox_name} "<br/> |
| + | runuser root -c "$MANAGE_CMD -q controlvm "${vbox_name}" savestate" >/dev/null 2>&1<br/> |
| + | done<br/> |
| + | RETVAL=$?<br/> |
| + | [ "$RETVAL" -eq 0 ] && success $"vbox shutdown" || \<br/> |
| + | failure $"vbox shutdown"<br/> |
| + | echo<br/> |
| + | [ "$RETVAL" -eq 0 ] && rm -f /var/lock/subsys/vbox<br/> |
| + | return "$RETVAL"<br/> |
| + | }<br/> |
| + | <br/> |
| + | status()<br/> |
| + | {<br/> |
| + | for vbox_name in ${VBOX_AUTOSTART}<br/> |
| + | do<br/> |
| + | echo -n "${vbox_name} "<br/> |
| + | $MANAGE_CMD showvminfo "${vbox_name}"|grep "^State:\s*.*$"<br/> |
| + | done<br/> |
| + | }<br/> |
| + | <br/> |
| + | case "$1" in<br/> |
| + | start)<br/> |
| + | start<br/> |
| + | ;;<br/> |
| + | stop)<br/> |
| + | stop<br/> |
| + | ;;<br/> |
| + | restart|force-reload)<br/> |
| + | stop<br/> |
| + | start<br/> |
| + | ;;<br/> |
| + | status)<br/> |
| + | status<br/> |
| + | ;;<br/> |
| + | *)<br/> |
| + | echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2<br/> |
| + | exit 3<br/> |
| + | ;;<br/> |
| + | esac<br/> |
| + | </pre> |
| </ol> | | </ol> |