Difference between revisions of "VirtualBox 4.0 on SME Server v8 beta 6"
From SME Server
Jump to navigationJump to searchLine 3: | Line 3: | ||
<li>Do a yum update.</li> | <li>Do a yum update.</li> | ||
− | <pre>yum update | + | <pre>yum update |
− | signal-event post-upgrade | + | signal-event post-upgrade |
signal-event reboot</pre> | signal-event reboot</pre> | ||
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: | + | Use this command only if you have PAE kernel installed: |
<pre>yum install kernel-PAE-devel</pre> | <pre>yum install kernel-PAE-devel</pre> | ||
Otherwise, | Otherwise, | ||
Line 28: | Line 28: | ||
<li>Install DKMS</li> | <li>Install DKMS</li> | ||
− | <pre>wget http://packages.sw.be/dkms/dkms-2.1.1.2-1.el5.rf.noarch.rpm | + | <pre>wget http://packages.sw.be/dkms/dkms-2.1.1.2-1.el5.rf.noarch.rpm |
yum install dkms-2.1.1.2-1.el5.rf.noarch.rpm</pre> | yum install dkms-2.1.1.2-1.el5.rf.noarch.rpm</pre> | ||
− | <li>Enable fopen on php.ini (line 65) located on /etc/</li> | + | <li>Enable <b>fopen</b> on php.ini (line 65) located on /etc/</li> |
<pre>allow_url_fopen = On</pre> | <pre>allow_url_fopen = On</pre> | ||
− | <li>Install VirtualBox v4.0 (At the time of writing, the latest version is v4.0.8).</li> | + | <li>Install <b>VirtualBox v4.0</b> (At the time of writing, the latest version is v4.0.8).</li> |
− | <pre>wget http://download.virtualbox.org/virtualbox/4.0.8/VirtualBox-4.0-4.0.8_71778_rhel5-1.i386.rpm | + | <pre>wget http://download.virtualbox.org/virtualbox/4.0.8/VirtualBox-4.0-4.0.8_71778_rhel5-1.i386.rpm |
yum install VirtualBox-4.0-4.0.8_71778_rhel5-1.i386.rpm -y</pre> | yum install VirtualBox-4.0-4.0.8_71778_rhel5-1.i386.rpm -y</pre> | ||
Note: you will get an error message, which you can ignore. | Note: you will get an error message, which you can ignore. | ||
<li>Setup VirtualBox as a service so it starts automatically after a reboot by copying the vboxwebsrv from rc5.d to rc7.d.</li> | <li>Setup VirtualBox as a service so it starts automatically after a reboot by copying the vboxwebsrv from rc5.d to rc7.d.</li> | ||
− | <pre>cp /etc/rc5.d/S30vboxdrv /etc/rc7.d/. | + | <pre>cp /etc/rc5.d/S30vboxdrv /etc/rc7.d/. |
− | cp /etc/rc5.d/S35vboxballoonctrl /etc/rc7.d/. | + | cp /etc/rc5.d/S35vboxballoonctrl /etc/rc7.d/. |
cp /etc/rc5.d/S35vboxweb-service /etc/rc7.d/.</pre> | cp /etc/rc5.d/S35vboxweb-service /etc/rc7.d/.</pre> | ||
− | <li>Create a vbox.cfg file on your /etc/vbox/. | + | <li>Create a 'vbox.cfg' file on your /etc/vbox/. |
<pre>nano /etc/vbox/vbox.cfg</pre> | <pre>nano /etc/vbox/vbox.cfg</pre> | ||
vbox.cfg should have this content. | vbox.cfg should have this content. | ||
− | <pre>VBOXWEB_USER='root' | + | <pre>VBOXWEB_USER='root' |
− | VBOXWEB_HOST=127.0.0.1 | + | VBOXWEB_HOST=127.0.0.1 |
VBOXWEB_PORT=18083<br/></pre> | VBOXWEB_PORT=18083<br/></pre> | ||
Line 55: | Line 55: | ||
</li> | </li> | ||
− | <li>Before we install <b>[http://code.google.com/p/phpvirtualbox/ phpVirtualBox]</b>, make sure you install SOAP first.</li> | + | <li>Before we install <b>[http://code.google.com/p/phpvirtualbox/ phpVirtualBox]</b>, make sure you install <b>SOAP</b> first.</li> |
<pre>yum install php-soap</pre> | <pre>yum install php-soap</pre> | ||
<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>Install phpVirtualBox</li> | + | <li>Install <b>phpVirtualBox</b></li> |
− | <pre>cd /tmp | + | <pre>cd /tmp |
− | wget http://phpvirtualbox.googlecode.com/files/phpvirtualbox-4.0-6.zip | + | wget http://phpvirtualbox.googlecode.com/files/phpvirtualbox-4.0-6.zip |
− | unzip phpvirtualbox-4.0-6.zip | + | unzip phpvirtualbox-4.0-6.zip |
− | cd phpvirtualbox-4.0-6 | + | cd phpvirtualbox-4.0-6 |
cp –R * /home/e-smith/files/ibays/phpvbox/html</pre> | cp –R * /home/e-smith/files/ibays/phpvbox/html</pre> | ||
<li>Create a <b>tmp</b> folder inside the /phpvbox/html folder.</li> | <li>Create a <b>tmp</b> folder inside the /phpvbox/html folder.</li> | ||
− | <pre>cd /home/e-smith/files/ibays/phpvbox/html | + | <pre>cd /home/e-smith/files/ibays/phpvbox/html |
mkdir tmp | mkdir tmp | ||
</pre> | </pre> | ||
<li>Open config.php (located on your /phpvbox/html/ folder) and uncomment some lines & change the tmp location as per below.</li> | <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>nano /home/e-smith/files/ibays/phpvbox/html/config.php</pre> | ||
− | <pre>/* SOAP URL of vboxwebsrv (not phpVirtualBox's URL) */ | + | <pre>/* SOAP URL of vboxwebsrv (not phpVirtualBox's URL) */ |
− | var $location = 'http://127.0.0.1:18083/'; | + | var $location = 'http://127.0.0.1:18083/'; |
− | + | ||
− | // Disable authentication | + | // Disable authentication |
− | var $noAuth = true; | + | var $noAuth = true; |
− | + | ||
− | // Host / ip to use for console connections | + | // Host / ip to use for console connections |
− | //var $consoleHost = '192.168.100.1'; | + | //var $consoleHost = '192.168.100.1'; |
− | + | ||
− | var $enableAdvancedConfig = true; | + | var $enableAdvancedConfig = true; |
− | + | ||
− | // Authentication library. | + | // Authentication library. |
− | //var $authLib = 'Builtin'; | + | //var $authLib = 'Builtin'; |
− | + | ||
− | // Allow VDE network configuration. This must be supported by the underlying VirtualBox installation! | + | // Allow VDE network configuration. This must be supported by the underlying VirtualBox installation! |
− | var $enableVDE = true; | + | var $enableVDE = true; |
− | + | ||
− | // Path | + | // Path |
− | var $cachePath = '../tmp'; | + | var $cachePath = '../tmp'; |
</pre> | </pre> | ||
Line 117: | Line 117: | ||
<pre>vboxmanage startvm --type headless vmXP</pre> | <pre>vboxmanage startvm --type headless vmXP</pre> | ||
− | <li>Edit your <b>vbox<b> file on /etc/sysconfig/</li> | + | <li>Edit your <b>vbox</b> file on /etc/sysconfig/</li> |
<pre>nano /etc/sysconfig/vbox</pre> | <pre>nano /etc/sysconfig/vbox</pre> | ||
vbox code should look like this: | vbox code should look like this: |
Revision as of 06:30, 5 July 2011
- Setup SME Server v8 beta 6.
- Do a yum update.
- Check your current kernel.
- Install kernel-devel to get the latest development tree (2.6.18-238.12.1.el5PAE-i686). Use this command only if you have PAE kernel installed:
- Create a symbolic link
- Install DKMS
- Enable fopen on php.ini (line 65) located on /etc/
- Install VirtualBox v4.0 (At the time of writing, the latest version is v4.0.8).
- Setup VirtualBox as a service so it starts automatically after a reboot by copying the vboxwebsrv from rc5.d to rc7.d.
- Create a 'vbox.cfg' file on your /etc/vbox/.
nano /etc/vbox/vbox.cfg
vbox.cfg should have this content.
VBOXWEB_USER='root' VBOXWEB_HOST=127.0.0.1 VBOXWEB_PORT=18083<br/>
Note: Without the vbox.cfg, vbox services on your rc7.d folder will not start.
- Before we install phpVirtualBox, make sure you install SOAP first.
- Login to the server-manager page and create an ibay for phpvbox. Don’t forget to assign a password.
- Install phpVirtualBox
- Create a tmp folder inside the /phpvbox/html folder.
- Open config.php (located on your /phpvbox/html/ folder) and uncomment some lines & change the tmp location as per below.
- 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.
- Install VirtualBox extension pack to enable support for USB 2.0 devices, VirtualBox RDP and PXE boot for Intel cards.
- Go to http://your_server’s_ip/phpvbox (e.g. http://192.168.100.1/phpvbox) to create our virtual machine.
- Create a new virtual machine (e.g. vmXP)
- Enable network card (either NAT or Bridged) so you can connect to your new VM console.
- Open an RDP client (run->mstsc) then type your server’s IP address e.g. 192.168.100.1.
- 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.
yum update signal-event post-upgrade signal-event reboot
uname -r
yum install kernel-PAE-devel
Otherwise,
yum install kernel-devel
ln –s /usr/src/kernels/2.6.18-238.12.1.el5PAE-i686 /lib/modules/`uname -r`/build
or
ln –s /usr/src/kernels/’uname –r’-i686 /lib/modules/`uname -r`/build
wget http://packages.sw.be/dkms/dkms-2.1.1.2-1.el5.rf.noarch.rpm yum install dkms-2.1.1.2-1.el5.rf.noarch.rpm
allow_url_fopen = On
wget http://download.virtualbox.org/virtualbox/4.0.8/VirtualBox-4.0-4.0.8_71778_rhel5-1.i386.rpm yum install VirtualBox-4.0-4.0.8_71778_rhel5-1.i386.rpm -y
Note: you will get an error message, which you can ignore.
cp /etc/rc5.d/S30vboxdrv /etc/rc7.d/. cp /etc/rc5.d/S35vboxballoonctrl /etc/rc7.d/. cp /etc/rc5.d/S35vboxweb-service /etc/rc7.d/.
yum install php-soap
cd /tmp wget http://phpvirtualbox.googlecode.com/files/phpvirtualbox-4.0-6.zip unzip phpvirtualbox-4.0-6.zip cd phpvirtualbox-4.0-6 cp –R * /home/e-smith/files/ibays/phpvbox/html
cd /home/e-smith/files/ibays/phpvbox/html mkdir tmp
nano /home/e-smith/files/ibays/phpvbox/html/config.php
/* SOAP URL of vboxwebsrv (not phpVirtualBox's URL) */ var $location = 'http://127.0.0.1:18083/'; // Disable authentication var $noAuth = true; // Host / ip to use for console connections //var $consoleHost = '192.168.100.1'; var $enableAdvancedConfig = true; // Authentication library. //var $authLib = 'Builtin'; // Allow VDE network configuration. This must be supported by the underlying VirtualBox installation! var $enableVDE = true; // Path var $cachePath = '../tmp';
vboxmanage setproperty websrvauthlibrary null
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
Automatically Start Virtual Machine in case Power Failure
- Create a file (e.g. startXP) on /etc/init.d/
- Edit your vbox file on /etc/sysconfig/
- Edit your vbox file located on /etc/init.d/
nano /etc/init.d/startXP
startXP code should look like this:
vboxmanage startvm --type headless vmXP
nano /etc/sysconfig/vbox
vbox code should look like this:
# Virtual box machines to autostart<br/> # Example to start 2 machines<br/> # VBOX_AUTOSTART = "MachineName1 MachineName2"<br/> <br/> VBOX_AUTOSTART="vmXP"<br/>
#!/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/>