Virtual machines have several advantages over physical servers. Especially restoring state and making backups. If you have minimal ubuntu server then first you need to install virtualbox. Best version at the time is virtualbox 4.
Add into /etc/apt/sources.list
deb http://download.virtualbox.org/virtualbox/debian maverick contrib
Now you can install virtualbox itself
apt-get install virtualbox-4.0
Easiest way to get VM running in server is to prepare image at home and upload this to server. Make sure you configure ssh and networking correctly (network configuration is explained bit later in here), network interface must be bridged to eth0
Once image is uploaded to server import this with command.
VBoxManage import vmname.ova
Run VM with command which make it run in background and dows not stop if you log out from ssh
nohup VBoxHeadless -startvm vmname &
If there was no problems then you are ready to go, almost.
You want to assign each VM static ip. In hosting providers, like Hetzner, network devices accept traffic only from MAC addresses of physical NIC-s and as VM-s have different MAC-s then by default they cannot communicate with outside world.
To solve this you need to set up routing in host machine, write into host machine
net.ipv4.conf.all.rp_filter=1 net.ipv4.icmp_echo_ignore_broadcasts=1 net.ipv4.ip_forward=1 net.ipv6.conf.all.forwarding=1 net.ipv4.conf.default.proxy_arp=1
Now reboot host.
Configure guest machine, edit
and write there something like
# The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet static address 18.104.22.168 gateway 22.214.171.124 netmask 255.255.255.192
where 126.96.36.199 is extra ip assigned to you and 188.8.131.52 is host machine ip.This tutorial helped to set up the networking http://www.howtoforge.com/how-to-enable-networking-in-xen-guests-on-hetzners-new-eq-servers-debian-lenny