Archive for the ‘Virtualisation’ Category
Enable USB Support In Virtualbox (Ubuntu)
Enabling USB Support in Virtualbox means to be able to access USB drives plugged into your physical machine on your virtual machines. To accomplish this, you first need to download the newest version of Virtualbox (4.1.8 at the time of this writing), which is not available in the Ubuntu repositories but on the Virtualbox homepage:
https://www.virtualbox.org/wiki/Downloads
Uninstall any previously installed version if present and then install the downloaded Debian package with a package installer taking care of dependencies, such as gdebi.
Next, head back to the homepage and install the Virtualbox Extension pack which supports USB 2.0.
Now you have to make yourself member of the vboxusers group. Go to the Users and Groups Settings in your Control Panel and hit Manage Groups. Scroll down to the vboxusers group and hit Properties. Check the box next to your username and click OK.
Last but not least you have to enable USB for the virtual machine. Close it if it is running and enter the Settings window. On the left panel, select USB. Check Enable USB Controller as well as Enable USB 2.0 (EHCI) Controller. Then click the button with the small green plus-symbol and add the USB device you need:
If you run the machine a USB symbol will indicate that USB is enabled and a device is running on virtual machine:
How to enable SSH on VMware ESXi Server
wrote by Rafael Marangoni, from BR Link team.
By default, the ssh login is disabled on VMware ESXi, in opposite way what it happens on VMware ESX Server.
But, there’s a way to enable SSH Login.
After the system is installed, go to the console screen and type:
ALT + F1
After that, a Black screen will appear (be calm, that is normal), then type:
unsupported
Next, the Server will prompt for root password. Then you type the root password.
Afterwards, you’ll have shell access. We need to edit the following file:
vi /etc/inetd.conf
Uncomment the line that starts with “SSH”. Save the file (it’s a normal vi, ZZ will do that for you).
Now reboot the server:
reboot
After it reboots, you should login with SSH on port TCP/22, and user root.
How to solve the PHP XCache error: /dev/zero: No space left on device
If you get the error “/dev/zero: No space left on device” in the apache error.log on a OpenVZ virtual machine, then the shared memory size in the xcache.ini is too high or the xcache.mm_path is set wrong.
Edit the file /etc/php5/conf.d/xcache.ini
vi /etc/php5/conf.d/xcache.ini
and check the mm_path. On a OpenVZ virtual machine it should be set to “/tmp/xcache” as /dev/zero might not work correctly in a virtual machine:
xcache.mmap_path = “/tmp/xcache”
Then restart apache2:
/etc/init.d/apache2 restart
and check if the error has been resolved.
If the roor still occurs after some time, you will have to reduce the xcache.size.
Edite the xcache.ini file:
vi /etc/php5/conf.d/xcache.ini
and set xcache.size to e.g. 8 MB
xcache.size = 8M
Then restart apache2:
/etc/init.d/apache2 restart
Secure /tmp and /dev/shm directories in a OpenVZ enviroment
The /tmp and /dev/shm directories of a OpenVZ virtual machine shall be mounted without suid and exec permissions. To achieve this, create a a shell script on the host server for every virtual machine which contains the commands to remount the directories. This script will be started automatically by openvz when the VM is started.
I will use VPSID as placeholder for the ID of the virtual machine in the commands and the script. Replace VPSID with the id of the virtual machine that you want to create the script for, e.g. replace VPSID with 101.
Create the script:
vi /etc/vz/conf/VPSID.mount
and insert the following lines:
#!/bin/bash
mount -n –bind -onosuid,noexec /vz/vps/VPSID/tmp /vz/root/VPSID/tmp
mount -n –bind -onosuid,noexec /vz/vps/VPSID/shm /vz/root/VPSID/dev/shm
exit ${?}
now make the sscript executable:
chmod 700 /etc/vz/conf/VPSID.mount
Migrate physical server system to OpenVZ virtual machine
In case you plan to virtualize your server infrastructure and migrate physical servers to OpenVZ virtual machines, you may find this tutorial helpful:
http://wiki.openvz.org/Physical_to_container
I used this to migrate a ISPConfig Debian system to OpenVZ successfully.
Backing up OpenVZ virtual machines with vzdump
Vzdump is a perl script that makes live backups of OpenVZ virtual machines very easy. The following steps are for Debian Linux but vzdump can be used on all other linux distributions. Only the installation may vary.
Download and install vzdump from http://download.openvz.org/contrib/utils/vzdump/
cd /tmp
wget http://download.openvz.org/contrib/utils/vzdump/vzdump_1.1-2_all.deb
dpkg -i vzdump_1.1-2_all.deb
Create the backup directory
mkdir /home/backup
Create a backup of all virtual machines as compressed (tar.gz) archive and send a email report to the root user when finished.
vzdump –dumpdir /home/backup –suspend –compress –mailto root –all
vzdump can also be used to restore a backup. Example: restore the backup of the virtual machine 101:
vzdump –restore /home/backup/vzdump-101.tgz 101
To restore the backup to a different virtual machine, you can specify a differnt target ID. E.g. restore the backup of vm 101 to the virtual machine with the ID 500:
vzdump –restore /home/backup/vzdump-101.tgz 500


