Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I currently have a dedicated server running Gentoo Linux with only an SSH access and I was wondering if it's possible to create and setup a virtual machine from command line using VirtualBox ? (Like installing another linux or a Windows server.)

My dedicated server has 4 differents ip adresses, would it be possible to assign one to a virtual machine ?

Thank you !

share|improve this question

You can use the VBoxManage command to create a VM and even insert virtual media for the install. If you see the non-free edition (released under the former Sun PEUL) you could set up an RDP connection to drive the installation. Read more about the VBoxManage commands here:

share|improve this answer

Yes, you can use Virtualbox Headless. I will give you an example configuration:

VBoxManage createvm --name "ubuntu-server" --register
VBoxManage modifyvm ubuntu-server --memory 1000 --vram 64 --acpi on --cpus 1 --ostype      Ubuntu_64 --pae on --hwvirtex on --vtxvpid on
VBoxManage modifyvm ubuntu-server --nic1 bridged --bridgeadapter1 eth1 --nic1 bridged --    bridgeadapter2 eth0
VBoxManage createhd --filename ubuntu-server-disk.vdi --size 2000
VBoxManage storagectl ubuntu-server --name "IDE Controller" --add ide --controller PIIX4
VBoxManage modifyvm ubuntu-server --hda ubuntu-server-disk.vdi
VBoxManage storageattach "ubuntu-server" --storagectl "IDE Controller" --port 0 --device 1 --type dvddrive --medium /home/mydir/ubuntu-10.04-server-amd64.iso

This example is copy paste from my last configuration on my own virtual server. Then you start the server like this:

VBoxHeadless -s "ubuntu-server"

You will be given a port to which you can connect or you can use something like NXclient/server to connect graphically through ssh. Be aware that maybe some of my commands may not be correct since I can't really remember which version of Virtualbox I used when created the machine (it runs for last 2 years now), but download their pdf manual from virtualbox site, it's very,very informative, all the options are well presented there.
As for stability and usability, I run headless virtual machines Debian Lenny, Ubuntu and Windows, Linux machines can last more than 100days without any problems, haven't tested windows that much, but I'm sure it shouldn't do bad as well.

As for 4 different IPs attributed to different machines, I believe it's more matter of network setup, every one of virtual machines if set in bridged mode are in LAN, which means that you need to route the traffic through to these machines from outside, it's like having couple real computers connected in one LAN. Since I don't know your network setup, I can't really say, and couldn't probably say much since I never had the fortune of having more than one external IP.

share|improve this answer

You might look into Vagrant: Vagrant is a tool for building and distributing virtualized development environments.
A good starting point can be found at "Start using Vagrant".
FYI - there is also a Gentoo base box VM available at

share|improve this answer
Is this solution only limited to linux VMs ? or i can find "templates" for others OS ? – P-O Bourgeois Jun 22 '11 at 18:48
At there's also a Solaris template. If you're looking for Windows templates, you're out of luck: it's payware and would be illegal to distribute freely. You might try to create a template yourself. – Henk Jun 22 '11 at 18:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.