Difference between revisions of "VirtualBox 4.0 on SME Server v8 beta 6"

From SME Server
Jump to navigationJump to search
m
 
(48 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 +
{{warning box|this how to is out of date. You probably wants to install the smeserver-phpvirtualbox and smeserver-virtualbox contribs for SME8 and SME9, then see here : [[Phpvirtualbox]]}}
 +
 
===Maintainer===
 
===Maintainer===
[http://forums.contribs.org/index.php?action=profile;u=2545 CompSOS]
+
[http://www.compsos.com.au CompSOS]
 +
 
 +
===Support===
 +
For questions or comments regarding this HOWTO, contact [mailto:shiena@compsos.com.au Shiena] of [http://www.compsos.com.au Computing SOS] or Sorolo Systems Inc. at this [mailto:sme@sorolo.com email] address.
  
 
===Description===
 
===Description===
Below are instructions on how to install VirtualBox version 4 on a fresh install SME Server v8 beta 6 and higher. Plus installing and configuring phpVirtualBox to control (create, edit, remove) your virtual machine on its web interface. In addition, scripts to automatically start the vbox service and the virtual machines in case of power failure can be found at the end of this article.
+
Below are instructions on how to install VirtualBox version 4.1 on a fresh install SME Server v8 beta 6 and higher. Plus installing and configuring phpVirtualBox to control (create, edit, remove) your virtual machine on its web interface. In addition, scripts to automatically start the vbox service and the virtual machines in case of power failure can be found at the end of this article.
 +
 
 +
This has been tested using the following:<br/>
 +
<ol>
 +
  <li>SME Server Release 8.0</li>
 +
  <li>VirtualBox-4.3</li>
 +
  <li>Kernel is 2.6.18-348.6.1.el5</li>
 +
</ol>
  
 
===Requirements===
 
===Requirements===
Computer with SME server version 8 beta 6 and higher installed.
+
Computer with SME server version 8 and higher installed.
  
 
===Installation===
 
===Installation===
 
<ol>
 
<ol>
   <li>Setup SME Server v8 beta 6.</li>
+
   <li value="1">Setup SME Server v8.</li>
   <li>Do a yum update.</li>
+
   <li value="2">Do a yum update.</li>
       <pre>yum update</pre>
+
       <pre>yum upgrade</pre>
   <li> If any updates were applied, update and reboot the server.</li>
+
   <li value="3"> If any updates were applied, update and reboot the server.</li>
       <pre>signal-event post-upgrade
+
       <pre>signal-event post-upgrade; signal-event reboot</pre>
signal-event reboot</pre>
+
   <li value="4">Check your current kernel.</li>
   <li>Check your current kernel.</li>
 
 
       <pre>uname -r</pre>
 
       <pre>uname -r</pre>
   <li>Install kernel-devel to get the latest development tree.</li>
+
   <li value="5">Install kernel-devel to get the latest development tree.<br/>
Use this command only if you have a PAE kernel installed:
+
Use the command below, only if you have a PAE kernel installed:
       <pre>yum install kernel-PAE-devel kernel-headers</pre>
+
       <pre>yum clean all
 +
yum install kernel-PAE-devel kernel-headers
 +
yum info kernel-headers</pre>
 
Otherwise,
 
Otherwise,
 
       <pre>yum install kernel-devel kernel-headers</pre>
 
       <pre>yum install kernel-devel kernel-headers</pre>
 +
  </li>
 +
 +
Note : if you do not want to update your kernel, because of kmdl not available you can search for the right kernel-headers and kernel-devel in http://vault.centos.org/
  
   <li> Check if the compiler (GCC) is installed. If not installed, install it.</li>
+
   <li value="6">Check if the compiler (GCC) is installed by issuing this command.
 +
      <pre>rpm -qa | grep gcc</pre>
 +
You will have an output, similar to this:
 +
      <pre>libgcc-4.1.2-54.el5
 +
gcc-4.1.2-54.el5</pre>
 +
If not installed, install it.
 
       <pre>yum install gcc</pre>
 
       <pre>yum install gcc</pre>
   <li>Update SME, and reboot again</li>
+
If you will get an error "No package gcc available. Nothing to do" then do this:
       <pre>signal-event post-upgrade
+
      <pre>cd /tmp
signal-event reboot</pre>
+
wget ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-4.7.1/gcc-4.7.1.tar.gz</pre>
   <li>Change your kernel boot options</li>
+
  </li>
      <pre>Optionally, for best results with SME 8.x and earlier versions,
+
   <li value="7">Update SME, and reboot again.</li>
modify /etc/grub.conf, adding divider=10 to the kernel boot options in order
+
       <pre>signal-event post-upgrade; signal-event reboot</pre>
to reduce the idle CPU load with VirtualBox. For example, if your kernel boot line is
+
   <li value="8">Change your kernel boot options.<br/>
kernel /vmlinuz-2.6.18-238.19.1.el5 ro root=/dev/main/root
+
Optionally, for best results with SME 8.x and earlier versions, modify /etc/grub.conf, adding divider=10 to the kernel boot options in order
change it to
+
to reduce the idle CPU load with VirtualBox. For example, if your kernel boot line is:
kernel /vmlinuz-2.6.18-238.19.1.el5 ro root=/dev/main/root divider=10</pre>
+
      <pre>kernel /vmlinuz-2.6.18-348.6.1.el5 ro root=/dev/main/root </pre>
 +
      <p>change it to:</p>
 +
      <pre>kernel /vmlinuz-2.6.18-348.6.1.el5 ro root=/dev/main/root divider=10</pre>
 +
      <p><b>Reminder:</b> if you subsequently update SME Server to use a newer kernel, you may need to change
 +
your kernel boot line to reflect the update.</p>
 +
  </li>
 +
  <li value="9">Create a symbolic link.<br/>
 +
      <p><b>NOTE:</b> Be careful if you cut-and-paste the command below. <!--In some terminal windows, from some browsers, the parts of the command in
 +
bold font do not paste correctly.-->Pay particular attention to the dashes (-) and the backticks (`). There aren't any single quote marks in
 +
the command below - they are all supposed to be backticks.</p>
 +
    <pre>ln -s /usr/src/kernels/`uname -r`-`uname -m` /lib/modules/`uname -r`/build</pre>
 +
   
 +
    <p><b>Reminder:</b> if you subsequently update SME Server to use a newer kernel, you may need to recreate the symbolic link.</p>
 +
  </li>
 +
  <li value="10">Check that the symbolic link was properly created by doing a directory listing.<br/>
 +
      <p><b>NOTE:</b> Be careful if you cut-and-paste the command below. In some terminal windows, from some browsers, the parts of the command in
 +
bold font do not paste correctly. Pay particular attention to the dashes (-) and the backticks (`). There aren't any single quote marks in
 +
the command below - they are all supposed to be backticks.</p>
  
  <li>Create a symbolic link</li>
+
    <pre>ls -la /lib/modules/`uname -r`/build</pre>
      <pre>NOTE: Be careful if you cut-and-paste the command below.
+
  </li>
In some terminal windows, from some browsers, the parts of the command in
+
   <li value="11">Install the Fedora Epel repository using the instructions [http://wiki.contribs.org/Epel here].</li>
bold font do not paste correctly. Pay particular attention to the
+
   <li value="12">Install Dynamic Kernel Module Support (DKMS)</li>
dashes (-) and the backticks (`). There aren't any single quote marks in
 
the command below - they are all supposed to be backticks.</pre>
 
 
 
ln <b>–s</b> /usr/src/kernels/<b>`uname –r`</b>-<b>`uname-m`</b> /lib/modules/<b>`uname -r`</b>/build
 
 
 
  <li>Check that the symbolic link was properly created by doing a directory listing.</li>
 
      <pre>NOTE: Be careful if you cut-and-paste the command below.
 
In some terminal windows, from some browsers, the parts of the command in
 
bold font do not paste correctly. Pay particular attention to the
 
dashes (-) and the backticks (`). There aren't any single quote marks in
 
the command below - they are all supposed to be backticks.</pre>
 
 
 
ls /lib/modules/<b>`uname -r`</b>/build
 
   <li>Install the Fedora Epel repository using the instructions [http://wiki.contribs.org/Epel here].</li>
 
   <li>Install Dynamic Kernel Module Support (DKMS)</li>
 
 
       <pre>yum install --enablerepo=epel dkms</pre>
 
       <pre>yum install --enablerepo=epel dkms</pre>
   <li>Install the VirtualBox repository using the instructions [http://wiki.contribs.org/VirtualBox_Repository here].</li>
+
   <li value="13">Install the VirtualBox repository using the instructions [http://wiki.contribs.org/VirtualBox_Repository here].</li>
   <li>Install <b>VirtualBox</b> (At the time of the last update to these instructions, the latest version was v4.1-2).</li>
+
   <li value="14">Install <b>VirtualBox</b> (At the time of the last update to these instructions, the latest version was v4.3-4.3.6-91406).</li>
       <pre>yum install --enablerepo=virtualbox VirtualBox-4.1</pre>
+
       <pre>yum install --enablerepo=virtualbox VirtualBox-4.3</pre>
   <li>Review the VirtualBox installation log to ensure that the installation was successful.</li>
+
   <li value="15">Review the VirtualBox installation log to ensure that the installation was successful.</li>
 
       <pre>tail /var/log/vbox-install.log</pre>
 
       <pre>tail /var/log/vbox-install.log</pre>
   <li> Remove the compiler install (for security best practices)</li>
+
   <li value="16">Remove the compiler install (for security best practices)</li>
       <pre> rpm -e gcc</pre>
+
       <pre>rpm -e gcc</pre>
   <li>Update SME, and reboot again</li>
+
   <li value="17">Update SME, and reboot again</li>
       <pre>signal-event post-upgrade
+
       <pre>signal-event post-upgrade; signal-event reboot</pre>
signal-event reboot</pre>
+
   <li value="18">Setup VirtualBox as a service so it starts automatically after a reboot. Copy the command below on putty console then hit Enter.</li>
   <li>Setup VirtualBox as a service so it starts automatically after a reboot.</li>
+
       <pre>for file in $(ls /etc/rc5.d/S??vbox*); do cp "$file" /etc/rc7.d/. ;done</pre>
       <pre>cp /etc/rc5.d/S30vboxdrv /etc/rc7.d/.
+
   <li value="19">Create a ''virtualbox'' file on your /etc/default/.</li>
cp /etc/rc5.d/S35vboxballoonctrl-service /etc/rc7.d/.
+
       <pre>nano /etc/default/virtualbox</pre>
cp /etc/rc5.d/S35vboxweb-service /etc/rc7.d/.</pre>
 
   <li>Create a ''vbox.cfg'' file on your /etc/vbox/.</li>
 
       <pre>nano /etc/vbox/vbox.cfg</pre>
 
  
vbox.cfg should have this content.
+
virtualbox 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</pre>
+
VBOXWEB_PORT=18083
 
+
VBOXWEB_LOGFILE=/var/log/vboxweb
Note: Without the vbox.cfg, vbox services on your rc7.d folder will not start.
+
INSTALL_DIR=/usr/lib/virtualbox</pre>
 
 
  <li>Login to the server-manager page and create an ibay for <b>phpvbox</b>.
 
  For instructions on how to create and configure an ibay, please see [http://wiki.contribs.org/SME_Server:Documentation:Administration_Manual:Chapter14 the SME Server Administration manual.]</li>
 
 
 
After creating the ibay, <b>do not forget to assign a password.</b>
 
 
 
  <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>
 
  <li>Install <b>phpVirtualBox</b></li>
 
      <pre>cd /tmp
 
wget `wget -q -O - http://phpvirtualbox.googlecode.com/files/LATEST.txt` -O phpvirtualbox-latest.zip
 
unzip phpvirtualbox-latest.zip</pre>
 
Note: at the time of the last update, the latest version was 4.1-2. Please adjust the following for later versions.
 
      <pre>cd phpvirtualbox-4.1-2
 
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
 
mkdir tmp
 
chmod 777 tmp/</pre>
 
  <li>Create a config file using the example file provided.</li>
 
      <pre>cp config.php-example config.php</pre>
 
  <li>Open ''config.php'' (located on your /phpvbox/html/ folder). Uncomment some lines (by removing the '#' at the beginning of the line).</li>
 
      <pre>nano /home/e-smith/files/ibays/phpvbox/html/config.php</pre>
 
      <pre>/* SOAP URL of vboxwebsrv (not phpVirtualBox's URL) */
 
var $location = 'http://127.0.0.1:18083/';</pre>
 
      <pre>// Disable authentication
 
var $noAuth = true;</pre>
 
 
 
Adjust the consoleHost ip address to an unused static ip address on your internal network
 
      <pre>// Host / ip to use for console connections
 
//var $consoleHost = '192.168.100.1';</pre>
 
 
 
      <pre>/* Enable advanced configuration items (normally hidden in the VirtualBox GUI)
 
* Note that some of these items may not be translated to languages other than $
 
*/
 
var $enableAdvancedConfig = true;</pre>
 
 
 
      <pre>// Authentication library.
 
//var $authLib = 'Builtin';</pre>
 
<!--
 
      <pre>// Allow VDE network configuration. This must be supported by the underlying VirtualBox installation!
 
var $enableVDE = true;</pre>
 
-->
 
 
 
Change the tmp location as per below.
 
      <pre>// Path
 
var $cachePath = '../tmp';</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>
 
<!--
 
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
 
        available for the current kernel (2.6.18-238.19.1.el5) or it failed to
 
        load. Please recompile the kernel module and install it by
 
 
 
          sudo /etc/init.d/vboxdrv setup
 
 
 
        You will not be able to start VMs until this problem is fixed.
 
-->
 
  <li>Install VirtualBox extension pack to enable support for USB 2.0 devices, VirtualBox RDP and PXE boot for Intel cards. Please install the extension pack with the same version as your installed version of VirtualBox!</li>
 
  
You can find the extension packs [http://www.virtualbox.org/wiki/Downloads here.] The following commands download and install the extension pack for VirtualBox 4.1.2.
+
<b>Note: Without the ''virtualbox'' file, vbox services on your rc7.d folder will not start.</b>
  
      <pre>wget http://download.virtualbox.org/virtualbox/4.1.2/Oracle_VM_VirtualBox_Extension_Pack-4.1.2-73507.vbox-extpack
+
  <li value="20">Install phpVirtualBox using this link http://wiki.contribs.org/Phpvirtualbox#DB_Configuration
vboxmanage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.1.2-73507.vbox-extpack</pre>
 
  
   <li>Update SME, and reboot again</li>
+
   <li value="21">Ensure that the extension pack is installed correctly.
      <pre>signal-event post-upgrade
 
signal-event reboot</pre>
 
 
 
  <li>Ensure that the extension pack is installed correctly.</li>
 
 
Open a console window, then
 
Open a console window, then
       <pre>vboxmanage list extension</pre>
+
       <pre>vboxmanage list extpacks</pre>
 +
</li>
 +
At this point, VirtualBox should now be configured and running correctly. To check this, we will now log into the ibay we created for phpVirtualBox and attempt to create a new virtual machine. If you encounter problems, please recheck that you have setup VirtualBox as a service so it starts automatically after a reboot, and that your vbox.cfg file is configured correctly. To manage VirtualBox and any virtual machines, use the command line utility VBoxManage. See VBoxManage --help . For a list of available switches for VBoxManage, see [http://www.virtualbox.org/manual/ch08.html this list].
  
At this point, VirtualBox should now be configured and running correctly. To check this, we will now log into the ibay we created for phpVirtualBox and attempt to create a new virtual machine.If you encounter problems, please recheck that you have setup VirtualBox as a service so it starts automatically after a reboot, and that your vbox.cfg file is configured correctly. To manage VirtualBox and any virtual machines, use the command line utility VBoxManage. See VBoxManage --help . For a list of available switches for VBoxManage, see [http://www.virtualbox.org/manual/ch08.html this list].
+
Finally,
  
Finally,
+
  <li value="22">Open a terminal window to the SME Server and create a directory to store the virtual machine images.</li>
 +
      <pre>mkdir -p /root/VirtualBox VMs/addons</pre>
 +
  <li value="23">Download the VirtualBox Guest Additions iso for later installation into your virtual machine guests.</li>
 +
      <pre>cd /root/VirtualBox VMs/addons
 +
wget http://download.virtualbox.org/virtualbox/4.3.6/VBoxGuestAdditions_4.3.6.iso</pre>
  
   <li>Open a terminal window to the SME Server and create a directory to store the virtual machine images.</li>
+
   <li value="24">Using a web browser, Go to http://yourdomain.com/phpvirtualbox and connect to the phpVirtualBox web application.
      <pre>mkdir -p /var/lib/VirtualBox/VMs</pre>
+
At this point, VirtualBox should now be configured and running correctly. If you encounter problems, please recheck that you have setup VirtualBox as a service so it starts automatically after a reboot, and that your vbox.cfg file is configured correctly. To manage VirtualBox and any virtual machines, use the command line utility VBoxManage. See VBoxManage --help . For a list of available switches for VBoxManage, see this list.  
  <li>Download the VirtualBox Guest Additions iso for later installation into your virtual machine guests.</li>
+
  </li>
      <pre>mkdir -p /var/lib/VirtualBox/addons
 
cd /var/lib/VirtualBox/addons
 
wget http://download.virtualbox.org/virtualbox/4.1.2/VBoxGuestAdditions_4.1.2.iso</pre>
 
  
  <li>Using a web browser, Go to http://yourdomain.com/phpvbox and connect to the phpVirtualBox web application.</li>
+
</ol>
      <pre>From the menu provided, go to select File->Preferences.
 
Select the "General" tab.
 
Change the Default Machine Folder: to /var/lib/VirtualBox/VMs</pre>
 
  
 
===Creating a Virtual Machine===
 
===Creating a Virtual Machine===
 
+
<ol>
   <li>Using a web browser, go to http://yourdomain.com/phpvbox to create your virtual machine.
+
   <li>Using a web browser, go to http://yourdomain.com/phpvirtualbox to create your virtual machine.
 
       <ul>
 
       <ul>
 
         <li>Create a new virtual machine (e.g. vmXP)</li>
 
         <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>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 domain name (e.g. mydomain.com) or ip address e.g. (192.168.100.1)</li>
 
 
       </ul>
 
       </ul>
[[File:virtual_box.jpg]]
+
[[File:PhpVirtualBox-rdp-port.jpg]]
 +
  <li>Even when the extension is installed, the VRDP server is disabled by default.  On console:</li>
 +
      <pre>vboxmanage modifyvm "vmXP" --vrde on</pre>
 +
  <li>Ensure you are connected to the server's internal network, then open a Remote Desktop client program.
 +
      <ul>
 +
      <li>On Windows, open an RDP client (run -> mstsc) then type your server’s hostname:port number (e.g. myserver:9000), or your Server's (not your Guest) IP address followed by colon then the port number as shown on above image (Remote Desktop Server Port under Display) (e.g. 192.168.100.1:9000).</li>
 +
<b>NOTE:</b> No need to change to port number to 9000 (as per above) in your Windows registry (HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TerminalServer\WinStations\RDP-Tcp\PortNumber). It will still be using port 3389 even though phpVirtualBox is using port 9000.<br/>
 +
If you're remotely connected to your server's phpvirtualbox and adding a new Guest remotely, open port 9000 (source and destination TCP poty) pointing to server's IP, so you can be able to access the console built-in to PhpVirtualBox.
 
</li>
 
</li>
<li>Install the VirtualBox Guest Additions iso into your newly setup VM.</li>
+
      </ul>
 +
  <li>Install the VirtualBox Guest Additions ISO into your newly setup VM.</li>
 +
[[File:PhpVirtualBox-install-guest-addition.jpg]]
 +
</ol>
 +
 
 +
===Access VM outside the Network===
 +
<ol>
 +
<li>On SME Server Manager page, on <b>Port Forwarding</b> left menu, open port <b>9000</b> (as per Remote Desktop Server Port under Display) using your desired Source Port:</li>
 +
Protocol: TCP<br/>
 +
Source Ports: 33900<br/>
 +
Destination IP: 192.168.5.1    ''(which is also the guest IP'')<br/>
 +
Destination Port: 9000<br/>
 +
Allow Hosts: <you can leave it blank, or place your Public IP so only your IP can access the VM)<br/>
 +
Rule Comment: <eg. vmXP for SOS><br/>
 +
<li>Now you can access your VM thru RDP using this hostname ''domain.com:33900''</li>
 
</ol>
 
</ol>
  
Line 202: Line 177:
 
</pre>
 
</pre>
  
<li>Edit your vbox file located on /etc/init.d/</li>
+
<li>Edit your ''vbox'' file located on /etc/init.d/
 
<pre>
 
<pre>
 
#!/bin/sh
 
#!/bin/sh
Line 268: Line 243:
 
         [ "$RETVAL" -eq 0 ] && success $"vbox shutdown" || \
 
         [ "$RETVAL" -eq 0 ] && success $"vbox shutdown" || \
 
             failure $"vbox shutdown"
 
             failure $"vbox shutdown"
         echo<
+
         echo
 
         [ "$RETVAL" -eq 0 ] && rm -f /var/lock/subsys/vbox
 
         [ "$RETVAL" -eq 0 ] && rm -f /var/lock/subsys/vbox
 
         return "$RETVAL"
 
         return "$RETVAL"
Line 302: Line 277:
 
esac
 
esac
 
</pre>
 
</pre>
 +
</li>
 
</ol>
 
</ol>
  
 +
===Troubleshooting===
 +
 +
<ol>
 +
  <li><p>PhpVirtualBox throws an error <i>attribute does not exist</i> or <i>method 'getVDENetwork' does not exist in the object</i>.</p>
 +
      <p><b>Solution:</b> Check config.php file located on /home/e-smith/files/ibays/phpvbox/html/ and comment out the line <i>var $enableVDE = true;</i></p>   
 +
  </li>
 +
      <pre>#var $enableVDE = true;</pre>
 +
 +
  <li><p>Virtual machine with a guest Windows XP installed takes too long to load.</p>
 +
      <p><b>Solution:</b> The Windows XP disk you might have used is slipstreamed with Intel ICH9 or ICH10. Uninstall <i>iastor.sys</i> on Safe Mode. Once you restart, it will reinstall it for you. <i>Iastor.sys</i> is an Intel Matrix storage manager, used to access RAID drives system driver file.</p>
 +
  </li>
 +
</ol>
  
 
[[Category: Virtualisation]]
 
[[Category: Virtualisation]]
 
[[Category: Advanced]]
 
[[Category: Advanced]]
[[Category: Contrib]]
+
[[Category: Howto]]

Latest revision as of 20:49, 12 March 2017

Warning.png Warning:
this how to is out of date. You probably wants to install the smeserver-phpvirtualbox and smeserver-virtualbox contribs for SME8 and SME9, then see here : Phpvirtualbox


Maintainer

CompSOS

Support

For questions or comments regarding this HOWTO, contact Shiena of Computing SOS or Sorolo Systems Inc. at this email address.

Description

Below are instructions on how to install VirtualBox version 4.1 on a fresh install SME Server v8 beta 6 and higher. Plus installing and configuring phpVirtualBox to control (create, edit, remove) your virtual machine on its web interface. In addition, scripts to automatically start the vbox service and the virtual machines in case of power failure can be found at the end of this article.

This has been tested using the following:

  1. SME Server Release 8.0
  2. VirtualBox-4.3
  3. Kernel is 2.6.18-348.6.1.el5

Requirements

Computer with SME server version 8 and higher installed.

Installation

  1. Setup SME Server v8.
  2. Do a yum update.
  3. yum upgrade
  4. If any updates were applied, update and reboot the server.
  5. signal-event post-upgrade; signal-event reboot
  6. Check your current kernel.
  7. uname -r
  8. Install kernel-devel to get the latest development tree.
    Use the command below, only if you have a PAE kernel installed:
    yum clean all
    yum install kernel-PAE-devel kernel-headers
    yum info kernel-headers

    Otherwise,

    yum install kernel-devel kernel-headers
  9. Note : if you do not want to update your kernel, because of kmdl not available you can search for the right kernel-headers and kernel-devel in http://vault.centos.org/
  10. Check if the compiler (GCC) is installed by issuing this command.
    rpm -qa | grep gcc

    You will have an output, similar to this:

    libgcc-4.1.2-54.el5
    gcc-4.1.2-54.el5

    If not installed, install it.

    yum install gcc

    If you will get an error "No package gcc available. Nothing to do" then do this:

    cd /tmp
    wget ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-4.7.1/gcc-4.7.1.tar.gz
  11. Update SME, and reboot again.
  12. signal-event post-upgrade; signal-event reboot
  13. Change your kernel boot options.
    Optionally, for best results with SME 8.x and earlier versions, modify /etc/grub.conf, adding divider=10 to the kernel boot options in order to reduce the idle CPU load with VirtualBox. For example, if your kernel boot line is:
    kernel /vmlinuz-2.6.18-348.6.1.el5 ro root=/dev/main/root 

    change it to:

    kernel /vmlinuz-2.6.18-348.6.1.el5 ro root=/dev/main/root divider=10

    Reminder: if you subsequently update SME Server to use a newer kernel, you may need to change your kernel boot line to reflect the update.

  14. Create a symbolic link.

    NOTE: Be careful if you cut-and-paste the command below. Pay particular attention to the dashes (-) and the backticks (`). There aren't any single quote marks in the command below - they are all supposed to be backticks.

    ln -s /usr/src/kernels/`uname -r`-`uname -m` /lib/modules/`uname -r`/build

    Reminder: if you subsequently update SME Server to use a newer kernel, you may need to recreate the symbolic link.

  15. Check that the symbolic link was properly created by doing a directory listing.

    NOTE: Be careful if you cut-and-paste the command below. In some terminal windows, from some browsers, the parts of the command in bold font do not paste correctly. Pay particular attention to the dashes (-) and the backticks (`). There aren't any single quote marks in the command below - they are all supposed to be backticks.

    ls -la /lib/modules/`uname -r`/build
  16. Install the Fedora Epel repository using the instructions here.
  17. Install Dynamic Kernel Module Support (DKMS)
  18. yum install --enablerepo=epel dkms
  19. Install the VirtualBox repository using the instructions here.
  20. Install VirtualBox (At the time of the last update to these instructions, the latest version was v4.3-4.3.6-91406).
  21. yum install --enablerepo=virtualbox VirtualBox-4.3
  22. Review the VirtualBox installation log to ensure that the installation was successful.
  23. tail /var/log/vbox-install.log
  24. Remove the compiler install (for security best practices)
  25. rpm -e gcc
  26. Update SME, and reboot again
  27. signal-event post-upgrade; signal-event reboot
  28. Setup VirtualBox as a service so it starts automatically after a reboot. Copy the command below on putty console then hit Enter.
  29. for file in $(ls /etc/rc5.d/S??vbox*); do cp "$file" /etc/rc7.d/. ;done
  30. Create a virtualbox file on your /etc/default/.
  31. nano /etc/default/virtualbox

    virtualbox should have this content.

    VBOXWEB_USER='root'
    VBOXWEB_HOST=127.0.0.1
    VBOXWEB_PORT=18083
    VBOXWEB_LOGFILE=/var/log/vboxweb
    INSTALL_DIR=/usr/lib/virtualbox

    Note: Without the virtualbox file, vbox services on your rc7.d folder will not start.

  32. Install phpVirtualBox using this link http://wiki.contribs.org/Phpvirtualbox#DB_Configuration
  33. Ensure that the extension pack is installed correctly. Open a console window, then
    vboxmanage list extpacks
  34. At this point, VirtualBox should now be configured and running correctly. To check this, we will now log into the ibay we created for phpVirtualBox and attempt to create a new virtual machine. If you encounter problems, please recheck that you have setup VirtualBox as a service so it starts automatically after a reboot, and that your vbox.cfg file is configured correctly. To manage VirtualBox and any virtual machines, use the command line utility VBoxManage. See VBoxManage --help . For a list of available switches for VBoxManage, see this list. Finally,
  35. Open a terminal window to the SME Server and create a directory to store the virtual machine images.
  36. mkdir -p /root/VirtualBox VMs/addons
  37. Download the VirtualBox Guest Additions iso for later installation into your virtual machine guests.
  38. cd /root/VirtualBox VMs/addons
    wget http://download.virtualbox.org/virtualbox/4.3.6/VBoxGuestAdditions_4.3.6.iso
  39. Using a web browser, Go to http://yourdomain.com/phpvirtualbox and connect to the phpVirtualBox web application. At this point, VirtualBox should now be configured and running correctly. If you encounter problems, please recheck that you have setup VirtualBox as a service so it starts automatically after a reboot, and that your vbox.cfg file is configured correctly. To manage VirtualBox and any virtual machines, use the command line utility VBoxManage. See VBoxManage --help . For a list of available switches for VBoxManage, see this list.

Creating a Virtual Machine

  1. Using a web browser, go to http://yourdomain.com/phpvirtualbox to create your 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.

    PhpVirtualBox-rdp-port.jpg

  2. Even when the extension is installed, the VRDP server is disabled by default. On console:
  3. vboxmanage modifyvm "vmXP" --vrde on
  4. Ensure you are connected to the server's internal network, then open a Remote Desktop client program.
    • On Windows, open an RDP client (run -> mstsc) then type your server’s hostname:port number (e.g. myserver:9000), or your Server's (not your Guest) IP address followed by colon then the port number as shown on above image (Remote Desktop Server Port under Display) (e.g. 192.168.100.1:9000).
    • NOTE: No need to change to port number to 9000 (as per above) in your Windows registry (HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TerminalServer\WinStations\RDP-Tcp\PortNumber). It will still be using port 3389 even though phpVirtualBox is using port 9000.
      If you're remotely connected to your server's phpvirtualbox and adding a new Guest remotely, open port 9000 (source and destination TCP poty) pointing to server's IP, so you can be able to access the console built-in to PhpVirtualBox.
  5. Install the VirtualBox Guest Additions ISO into your newly setup VM.
  6. PhpVirtualBox-install-guest-addition.jpg

Access VM outside the Network

  1. On SME Server Manager page, on Port Forwarding left menu, open port 9000 (as per Remote Desktop Server Port under Display) using your desired Source Port:
  2. Protocol: TCP
    Source Ports: 33900
    Destination IP: 192.168.5.1 (which is also the guest IP)
    Destination Port: 9000
    Allow Hosts: <you can leave it blank, or place your Public IP so only your IP can access the VM)
    Rule Comment: <eg. vmXP for SOS>
  3. Now you can access your VM thru RDP using this hostname domain.com:33900

Automatically Start Virtual Machine

  1. Edit your vbox file on /etc/sysconfig/
  2. nano /etc/sysconfig/vbox

    vbox code should look like this:

    # Virtual box machines to autostart
    # Example to start 2 machines
    #       VBOX_AUTOSTART = "MachineName1 MachineName2"
    
    VBOX_AUTOSTART="vmXP"
    
  3. Edit your vbox file located on /etc/init.d/
    #!/bin/sh
    #
    # chkconfig: - 91 35
    # description: Starts and stops vbox autostart VMs.
    
    ### BEGIN INIT INFO
    # Provides: vbox
    # Required-Start: $network $named $vboxdrv
    # Required-Stop: $network $named
    # Default-Start:
    # Default-Stop: 0 1 2 3 4 5 6
    # Short-Description: Autostart some Virtual Box VMs
    # Description: Autostart some Virtual Box VMs that are mentioned in /etc/sysconfig/vbox file
    # Written by Alex Amiryan
    ### END INIT INFO
    
    . /etc/rc.d/init.d/functions
    
    MANAGE_CMD=vboxmanage
    
    [ -r /etc/sysconfig/vbox ] && . /etc/sysconfig/vbox
    
    prog=$"Virtual Box Machines"
    
    start()
    {
            echo -n $"Starting $prog: "
            RETVAL=0
    
            for vbox_name in ${VBOX_AUTOSTART}
            do
                SERVS=1
                echo -n "${vbox_name} "
                daemon $MANAGE_CMD startvm "${vbox_name}" -type headless >/dev/null 2>&1
                RETVAL=$?
                [ "$RETVAL" -eq 0 ] || break
            done
            if [ -z "$SERVS" ]; then
                echo -n "no virtual machines configured "
                failure
                RETVAL=6
            else
                if [ "$RETVAL" -eq 0 ]; then
                    success $"vbox startup"
                    touch /var/lock/subsys/vbox
                else
                    failure $"vbox start"
                fi
            fi
            echo
            return "$RETVAL"
    }
    
    stop()
    {
            echo -n $"Shutting down $prog: "
            for vbox_name in ${VBOX_AUTOSTART}
            do
                echo -n "${vbox_name} "
                runuser root -c "$MANAGE_CMD -q controlvm "${vbox_name}" savestate" >/dev/null 2>&1
            done
            RETVAL=$?
            [ "$RETVAL" -eq 0 ] && success $"vbox shutdown" || \
                failure $"vbox shutdown"
            echo
            [ "$RETVAL" -eq 0 ] && rm -f /var/lock/subsys/vbox
            return "$RETVAL"
    }
    
    status()
    {
            for vbox_name in ${VBOX_AUTOSTART}
            do
                echo -n "${vbox_name} "
                $MANAGE_CMD showvminfo "${vbox_name}"|grep "^State:\s*.*$"
            done
    }
    
    case "$1" in
      start)
            start
            ;;
      stop)
            stop
            ;;
      restart|force-reload)
            stop
            start
            ;;
      status)
            status
            ;;
      *)
            echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
            exit 3
            ;;
    esac
    

Troubleshooting

  1. PhpVirtualBox throws an error attribute does not exist or method 'getVDENetwork' does not exist in the object.

    Solution: Check config.php file located on /home/e-smith/files/ibays/phpvbox/html/ and comment out the line var $enableVDE = true;

  2. #var $enableVDE = true;
  3. Virtual machine with a guest Windows XP installed takes too long to load.

    Solution: The Windows XP disk you might have used is slipstreamed with Intel ICH9 or ICH10. Uninstall iastor.sys on Safe Mode. Once you restart, it will reinstall it for you. Iastor.sys is an Intel Matrix storage manager, used to access RAID drives system driver file.