Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

evaluating/investigating vmware, and how you create a "virtual machine" using the command line for rhel/centos.

basically, i want to be able to create a test virtual machine and then be able to run the VM on another system using the virtual player.

so, i'm looking for pointers/articles/instructions that detail what i need (in terms of tools/apps) and the steps needed to accomplish this.

i've seen a few articles/sites that discuss creating virtual machines, but they all involve using the GUI.

thanks

update::

while vmware is the company. there are different tools/apps provided to create a Virtual Machine.

Basically, I want to do a test, to ultimately have a Virtual Machine/Image that can be run on a separate server using the vmplayer app

I've seen docs that discuss using the GUI to create the VM, but haven't found any (yet) that discuss how to accomplish this using the command line approach.

thanks...

share|improve this question
3  
vmware is a company not a product, what products are you talking about? –  Chopper3 Nov 5 '10 at 0:28
    
Possible duplicate of serverfault.com/questions/189861/… –  Sergei Dec 25 '11 at 13:37

4 Answers 4

In short do next in any linux box (RHEL/CentOS/etc) with installed qemu:

  1. Create disk image file by qemu-img create -f raw <image> <size (e.g. 4G)>
  2. Convert it to vmdk qemu-img convert -f raw <qemu-image> -O <vmplayer-image (.vmdk ext)>
  3. Create a .vmx file

Example:

Type in command line

qemu-img create -f raw /tmp/image.img 4G 
qemu-img convert -f raw /tmp/image.img -O /tmp/vmplayer-image.vmdk

And create vmplayer.vmx file (you can do this in Windows as well).

vi /tmp/vmplayer.vmx

Type i and insert next:

config.version = "8"
virtualHW.version = "3"
ide0:0.present = "TRUE"
ide0:0.filename = "vmplayer-image.vmdk"
memsize = "128"
MemAllowAutoScaleDown = "FALSE"
ide1:0.present = "TRUE"
ide1:0.fileName = "auto detect"
ide1:0.deviceType = "cdrom-raw"
ide1:0.autodetect = "TRUE"
floppy0.present = "FALSE"
ethernet0.present = "TRUE"
usb.present = "FALSE"
sound.present = "FALSE"
displayName = "some OS"
guestOS = "other26xlinux"
nvram = "someos.nvram"
MemTrimRate = "-1"
ide0:0.redo = ""
ethernet0.addressType = "generated"
ethernet0.connectionType = "nat"
uuid.location = "56 4d 0d 92 c9 cd 3c 25-c5 bf 91 91 43 5d bf 33"
uuid.bios = "56 4d 0d 92 c9 cd 3c 25-c5 bf 91 91 43 5d bf 33"
ethernet0.generatedAddress = "00:0c:29:5d:bf:33"
ethernet0.generatedAddressOffset = "0"
tools.syncTime = "TRUE"
ide1:0.startConnected = "TRUE"
uuid.action = "create"
checkpoint.vmState = ""
tools.remindInstall = "TRUE"

Type [Esc]:wq

Or guestOS = "winxppro" for Win XP Pro

So you will need next files for VMWare Player:

  • /tmp/vmplayer-image.vmdk
  • /tmp/vmplayer.vmx

You can download them to Windows machine using WinSCP util.

You will need to run vmplayer.vmx in VMWare Player.

Here is complete guide.

share|improve this answer

If you're talking about ESXi 4.x I don't know any ways to make a virtual machine not using the GUI. I know you can copy and move existing machines - or even deploy new ones from your 'gold' copy of your favorite OS.

If you're talking about using the VMware player, again just use the GUI - it was made for a reason and it seems to do its job well.

When you say "separate server using the vmplayer app" it sounds like you probably just want to install ESXi and run that... Please explain what you are trying to accomplish better.

share|improve this answer
    
hi. thanks for the reply. i want to create a clean OS (centos) on a given box/drive/partition. i then want to add some test apps to the "image". i then want to create a VM of the box/drive/partition. i then want to play/use this VM on a separate box, running the vmplayer app. the reason for doing the VM creation using the command line, is that i want to programatically create the VM as the contents of the VM will change based on outputs of other apps. –  tom smith Nov 5 '10 at 1:31
    
You want VMConverter to make a P2V copy. I'm unaware if there's a command-line interface to it. –  Keith Stokes Nov 5 '10 at 2:52
    
yes the converter will take your physical machine and convert it into a virtual machine - but why do this when you can just make it in the hypervisor/'player'? I know you want to script but I think what you are trying to do isn't practical/not feasible with the current hypervisors that are on the market. Not to say you have a bad idea, just that it is a rare instance where you can be so general that you can script your configs... –  Marm0t Nov 5 '10 at 4:50

It sounds like a job for vSphere CLI.

Unfortunately I haven't looked at this yet so I can't give you anything specific at the moment.

share|improve this answer

In the file vmplayer.vmx

uuid.location = "56 4d 0d 92 c9 cd 3c 25-c5 bf 91 91 43 5d bf 33"
uuid.bios = "56 4d 0d 92 c9 cd 3c 25-c5 bf 91 91 43 5d bf 33"
share|improve this answer

Your Answer

 
discard

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.