Hi guys,
I want machines to work and when I need, so it be auto create with configurations. I think it's avaliable for powershell but for linux?
Hi
You use echo parameter > vmx-file.
You use vmware-vdiskmanager to create the empty vmdk
You use vmrun to launch the newly created VM for the first time.
The next step is a manual step: you have to install the guest operating system.
If you also want to automate this step - which is possible - you should study the steps done by the "Easy Install" feature.
Would you be able to clarify the question? Are you looking to create a powershell script to create VM's? Also to be able to do this from a Linux machine?
no i do not want powershell. I only need to work on a linux machine.
thank you
mkdir /home/vms/newVM
cd /home/vms/newVM
echo 'vmx-file parameter 1' > newVM.vmx
echo 'vmx-file parameter 2' >> newVM.vmx
....
vmware-vdiskmanager -c -t 0 -s 40GB -a lsilogic newVM.vmdk
First of all thank you very much.
I am a beginner level for vmware and linux. Should I write this answer in a script? Could you be a little more descriptive?
you can use my vmxtoolkit ( runs with powershell on Linux ) to do so.
new-vmx -VMXName Centos1 -GuestOS centos7-64 -Firmware EFI
==>Creating new VM Centos1[success]==>setting GuestOS centos7-64 for Centos1[success]
VMXName Type Config Path
------- ---- ------ ----
Centos1 centos7-64 C:\labbuildr2017\Centos1\Centos1.vmx C:\labbuildr2017\Centos1
on linux. this requires Powershell 6
vmxtoolkit is available via install-module
install-module vmxtoolkit -scope currentuser
And more detailed, for creating a vm. Setting Network and insert an ISO Image to boot from:
$Uri = "http://de.releases.ubuntu.com/17.10/ubuntu-17.10-server-amd64.iso"
$file = split-path -leaf $UriInvoke-WebRequest -UseBasicParsing -Uri $uri -OutFile "$HOME/Dowwnloads/$file"
install-module vmxtoolkit -Scope CurrentUser -Force
IPMO vmxtoolkit
$VMX = New-VMX -VMXName UbuntuMaster1710 -GuestOS ubuntu-64 -Firmware EFI
$VMX | New-VMXScsiDisk -NewDiskSize 100GB -NewDiskname DISK0
$VMX | Set-VMXScsiController -SCSIController 0 -Type lsilogic
$VMX | ADD-VMXScsiDisk -Diskname DISK0.VMDK -LUN 0 -Controller 0
$VMX | Connect-VMXcdromImage -Contoller sata -ISOfile "$HOME/Downloads/$file" -Port 0:1
$VMX | Set-VMXNetworkAdapter -Adapter 0 -ConnectionType nat -AdapterType vmxnet3
$VMX | Start-VMX
Hope that helps
I'm trying to do what you said right now. All I want is to be able to automate these network settings and give the iso path.
I have one more question, cant we just do this with a script without using the toolkit?
Thank you..
essentuially, the toolkit is based around Scripting vmrun and editing .vmx files.
the toolkit is on github, so if you want to see how it is done, simplky look at the Code.
the toolkit is there to be used in scripts ....
also, you may search for some python modules for VIX API / vmrun ....
VIX Python binding — vix 1.0.6 documentation
Hi guys thank you so much for all replies,
I did something like this;
/* i am writing vmx file for prepared before vmware machine's folder*/
touch /home/user/vmware/Ubuntu\ 64-bit/Ubuntu\ 64-bit.vmx
echo "#!/usr/bin/vmware
.encoding = \"UTF-8\"
...
..
.
toolsInstallManager.lastInstallError = \"0\" " >> /home/usr/vmware/Ubuntu\ 64-bit/Ubuntu\ 64-bit.vmx
vmrun start /home/usr/vmware/Ubuntu\ 64-bit/Ubuntu\ 64-bit.vmx
But i can't all vmware machine folder files(.vmd, .nvram,)
How do I create all VMware machine files like this vmx file?
(My goal is to write a script that runs the machine automatically)
thank you all..
You do not need the following filetypes:
*.vmsd
*.vmsn
*.vmxf
*.nvram
*.log
while creating a new VM.
All you need to create manually is the vmx-file and the associated vmdks.
Many vmx-parameters will be added during first start.
If you post an example vmx-file I can show you which ones are essential and which ones you do not need to define at all and should better not use.
Example
#!/usr/bin/vmware
.encoding = "UTF-8"
config.version = "8"
virtualHW.version = "14"
mks.enable3d = "TRUE"
pciBridge0.present = "TRUE"
pciBridge4.present = "TRUE"
pciBridge4.virtualDev = "pcieRootPort"
pciBridge4.functions = "8"
pciBridge5.present = "TRUE"
pciBridge5.virtualDev = "pcieRootPort"
pciBridge5.functions = "8"
pciBridge6.present = "TRUE"
pciBridge6.virtualDev = "pcieRootPort"
pciBridge6.functions = "8"
pciBridge7.present = "TRUE"
pciBridge7.virtualDev = "pcieRootPort"
pciBridge7.functions = "8"
vmci0.present = "TRUE"
hpet0.present = "TRUE"
usb.vbluetooth.startConnected = "TRUE"
displayName = "AutoUbuntu"
guestOS = "auto-ubuntu"
nvram = "AutoUbuntu.nvram"
virtualHW.productCompatibility = "hosted"
powerType.powerOff = "soft"
powerType.powerOn = "soft"
powerType.suspend = "soft"
powerType.reset = "soft"
tools.syncTime = "FALSE"
sound.autoDetect = "TRUE"
sound.fileName = "-1"
sound.present = "TRUE"
vcpu.hotadd = "TRUE"
memsize = "024"
mem.hotadd = "TRUE"
scsi0.virtualDev = "lsilogic"
scsi0.present = "TRUE"
sata0.present = "TRUE"
scsi0:0.fileName = "AutoUbuntu.vmdk"
scsi0:0.present = "TRUE"
sata0:1.deviceType = "cdrom-raw"
sata0:1.fileName = "auto detect"
sata0:1.present = "TRUE"
sata0:0.deviceType = "cdrom-raw"
sata0:0.fileName = "auto detect"
sata0:0.present = "TRUE"
usb.present = "TRUE"
ehci.present = "TRUE"
svga.graphicsMemoryKB = "786432"
ethernet0.connectionType = "nat"
ethernet0.addressType = "generated"
ethernet0.virtualDev = "e1000"
serial0.fileType = "thinprint"
serial0.fileName = "thinprint"
floppy0.fileType = "device"
floppy0.fileName = ""
ethernet0.present = "TRUE"
serial0.present = "TRUE"
extendedConfigFile = "AutoUbuntu.vmxf"
floppy0.clientDevice = "FALSE"
uuid.bios = "56 4d 38 3a 9d 69 0f 47-90 fd be 83 87 26 60 a6"
uuid.location = "56 4d 38 3a 9d 69 0f 47-90 fd be 83 87 26 60 a6"
migrate.hostlog = "./AutoUbuntu-888ad70e.hlog"
scsi0:0.redo = ""
pciBridge0.pciSlotNumber = "17"
pciBridge4.pciSlotNumber = "21"
pciBridge5.pciSlotNumber = "22"
pciBridge6.pciSlotNumber = "23"
pciBridge7.pciSlotNumber = "24"
scsi0.pciSlotNumber = "16"
usb.pciSlotNumber = "32"
ethernet0.pciSlotNumber = "33"
sound.pciSlotNumber = "34"
ehci.pciSlotNumber = "35"
vmci0.pciSlotNumber = "36"
sata0.pciSlotNumber = "37"
ethernet0.generatedAddress = "00:0c:29:26:60:a6"
ethernet0.generatedAddressOffset = "0"
vmci0.id = "-2027528026"
monitor.phys_bits_used = "43"
vmotion.checkpointFBSize = "134217728"
vmotion.checkpointSVGAPrimarySize = "134217728"
cleanShutdown = "TRUE"
softPowerOff = "TRUE"
usb:0.present = "TRUE"
usb:0.deviceType = "hid"
usb:0.port = "0"
usb:0.parent = "-1"
usb:1.speed = "2"
usb:1.present = "TRUE"
usb:1.deviceType = "hub"
usb:1.port = "1"
usb:1.parent = "-1"
svga.guestBackedPrimaryAware = "TRUE"
floppy0.autodetect = "TRUE"
vmx.onpoweronkeys = "2"
vmx.onpoweron0.key = "floppy0.present"
vmx.onpoweron0.value = "FALSE"
vmx.onpoweron1.key = "sata0:0.present"
vmx.onpoweron1.value = "FALSE"
sata0:1.autodetect = "TRUE"
sata0:0.autodetect = "TRUE"
tools.remindInstall = "FALSE"
toolsInstallManager.updateCounter = "1"
toolsInstallManager.lastInstallError = "0"
and how can i use iso way? and network configuration?
one more quesiton;
i used this code: "vmware-vdiskmanager -c -t 0 -s 10GB -a lsilogic AutoUbuntu.vmdk" but Is it enough for vmdk file?
Thank you so much continuum..
Hi there
I sorted the file alphabetically and commented every line that you do NOT need to define yourself.
I warn you against defining any pci-slot numbers manually - better leave that to WS itself.
I also recommend that you have a look at my website about vmx-parameters - see http://sanbarrow.com/vmx.html
It says : the shorter - the better 😉
Now here is your example -
.encoding = "UTF-8"
#cleanShutdown = "TRUE"
config.version = "8"
displayName = "AutoUbuntu"
#ehci.pciSlotNumber = "35"
ehci.present = "TRUE"
#ethernet0.addressType = "generated"
ethernet0.connectionType = "nat"
#ethernet0.generatedAddress = "00:0c:29:26:60:a6"
#ethernet0.generatedAddressOffset = "0"
#ethernet0.pciSlotNumber = "33"
ethernet0.present = "TRUE"
ethernet0.virtualDev = "e1000"
#extendedConfigFile = "AutoUbuntu.vmxf"
floppy0.autodetect = "TRUE"
floppy0.clientDevice = "FALSE"
floppy0.fileName = ""
floppy0.fileType = "device"
guestOS = "auto-ubuntu"
#hpet0.present = "TRUE"
#mem.hotadd = "TRUE"
memsize = "024"
#migrate.hostlog = "./AutoUbuntu-888ad70e.hlog"
mks.enable3d = "TRUE"
#monitor.phys_bits_used = "43"
#nvram = "AutoUbuntu.nvram"
#pciBridge0.pciSlotNumber = "17"
#pciBridge0.present = "TRUE"
#pciBridge4.functions = "8"
#pciBridge4.pciSlotNumber = "21"
#pciBridge4.present = "TRUE"
#pciBridge4.virtualDev = "pcieRootPort"
#pciBridge5.functions = "8"
#pciBridge5.pciSlotNumber = "22"
#pciBridge5.present = "TRUE"
#pciBridge5.virtualDev = "pcieRootPort"
#pciBridge6.functions = "8"
#pciBridge6.pciSlotNumber = "23"
#pciBridge6.present = "TRUE"
#pciBridge6.virtualDev = "pcieRootPort"
#pciBridge7.functions = "8"
#pciBridge7.pciSlotNumber = "24"
#pciBridge7.present = "TRUE"
#pciBridge7.virtualDev = "pcieRootPort"
#powerType.powerOff = "soft"
#powerType.powerOn = "soft"
#powerType.reset = "soft"
#powerType.suspend = "soft"
#sata0.pciSlotNumber = "37"
sata0.present = "TRUE"
sata0:0.autodetect = "TRUE"
sata0:0.deviceType = "cdrom-raw"
sata0:0.fileName = "auto detect"
sata0:0.present = "TRUE"
sata0:1.autodetect = "TRUE"
sata0:1.deviceType = "cdrom-raw"
sata0:1.fileName = "auto detect"
sata0:1.present = "TRUE"
#scsi0.pciSlotNumber = "16"
scsi0.present = "TRUE"
scsi0.virtualDev = "lsilogic"
scsi0:0.fileName = "AutoUbuntu.vmdk"
scsi0:0.present = "TRUE"
#scsi0:0.redo = ""
#serial0.fileName = "thinprint"
#serial0.fileType = "thinprint"
#serial0.present = "TRUE"
#softPowerOff = "TRUE"
#sound.autoDetect = "TRUE"
#sound.fileName = "-1"
#sound.pciSlotNumber = "34"
sound.present = "TRUE"
#svga.graphicsMemoryKB = "786432"
#svga.guestBackedPrimaryAware = "TRUE"
#tools.remindInstall = "FALSE"
#tools.syncTime = "FALSE"
#toolsInstallManager.lastInstallError = "0"
#toolsInstallManager.updateCounter = "1"
#usb.pciSlotNumber = "32"
usb.present = "TRUE"
#usb.vbluetooth.startConnected = "TRUE"
#usb:0.deviceType = "hid"
#usb:0.parent = "-1"
#usb:0.port = "0"
usb:0.present = "TRUE"
#usb:1.deviceType = "hub"
#usb:1.parent = "-1"
#usb:1.port = "1"
usb:1.present = "TRUE"
#usb:1.speed = "2"
#uuid.bios = "56 4d 38 3a 9d 69 0f 47-90 fd be 83 87 26 60 a6"
#uuid.location = "56 4d 38 3a 9d 69 0f 47-90 fd be 83 87 26 60 a6"
#vcpu.hotadd = "TRUE"
#virtualHW.productCompatibility = "hosted"
virtualHW.version = "14"
#vmci0.id = "-2027528026"
#vmci0.pciSlotNumber = "36"
vmci0.present = "TRUE"
#vmotion.checkpointFBSize = "134217728"
#vmotion.checkpointSVGAPrimarySize = "134217728"
#vmx.onpoweron0.key = "floppy0.present"
#vmx.onpoweron0.value = "FALSE"
#vmx.onpoweron1.key = "sata0:0.present"
#vmx.onpoweron1.value = "FALSE"
#vmx.onpoweronkeys = "2"
--------------------------------------------------------
if you look through the list you will see that you only need a small subset of the long list.
1. essential:
see http://sanbarrow.com/vmx/vmx-minimal.html
2. RAM and CPU:
memsize = "1024"
is the only line you need to get a valid vmx-file
3. additional devices
check the parameters that use *.present =
with true you add the device - with false you disable it .....
read my site !!!
The vmware-vdiskmanager command you posted will create a vmdk for you that can be added via
scsi0.present = "true"
scsi0.virtualDev = "lsilogic"
scsi0:0.present = "true"
scsi0:0.fileName = "AutoUbuntu.vmdk"
Hope that helps
feel free to call me via skype if you have further questions.
Ulli
Hi again continuum, first thank you for your help.
I followed the instructions on the sanbarrow site. Now when i run my script file with "vmrun" command, vmware work station starts and the ubuntu installation screen comes up. But I don't want the ubuntu installation screen. I want you to open my new machine's desktop directly. Where do I make mistakes?
#!/bin/bash
touch /home/usr/vmware/AutoUbuntu/AutoUbuntu.vmx
echo "#!/usr/bin/vmware
.encoding = \"UTF-8\"
config.version = \"8\"
virtualHW.version = \"14\"
mks.enable3d = \"TRUE\"
vmci0.present = \"TRUE\"
hpet0.present = \"TRUE\"
usb.vbluetooth.startConnected = \"TRUE\"
displayName = \"AutoUbuntu\"
guestOS = \"Ubuntu-64\"
sound.autoDetect = \"TRUE\"
sound.fileName = \"-1\"
sound.present = \"TRUE\"
memsize = \"2048\"
mem.hotadd = \"TRUE\"
scmd0.present = \"TRUE\"
scsi0.virtualDev = \"lsilogic\"
scsi0.present = \"TRUE\"
sata0.present = \"TRUE\"
scsi0:0.present = \"TRUE\"
scsi0:0.fileName = \"AutoUbuntu.vmdk\"
sata0:1.deviceType = \"cdrom-raw\"
sata0:1.fileName = \"auto-detect\"
sata0:1.present = \"TRUE\"
sata0:0.deviceType = \"cdrom-raw\"
sata0:0.fileName = \"auto-detect\"
sata0:0.present = \"TRUE\"
usb.present = \"FALSE\"
ehci.present = \"TRUE\"
svga.graphicsMemoryKB = \"786432\"
ethernet0.connectionType = \"nat\"
ethernet0.addressType = \"generated\"
ethernet0.virtualDev = \"e1000\"
serial0.fileType = \"thinprint\"
serial0.fileName = \"thinprint\"
floppy0.fileType = \"device\"
floppy0.autodetect = \"TRUE\"
ethernet0.present = \"TRUE\"
serial0.present = \"TRUE\"
floppy0.clientDevice = \"FALSE\"
sata0:1.autodetect = \"TRUE\"
sata0:0.autodetect = \"TRUE\"
cleanShutdown = \"TRUE\"
softPowerOff = \"TRUE\"
svga.guestBackedPrimaryAware = \"TRUE\"
" >> /home/usr/vmware/AutoUbuntu/AutoUbuntu.vmx
#vmdk
cd /home/usr/vmware/AutoUbuntu
vmware-vdiskmanager -c -t 0 -s 10GB -a ide AutoUbuntu.vmdk
vmrun start /home/usr/vmware/AutoUbuntu/AutoUbuntu.vmx
and image of my file
When i run start this script vmware workstation is saying "operating system not found"..
what should I do?
Hi
You use echo parameter > vmx-file.
You use vmware-vdiskmanager to create the empty vmdk
You use vmrun to launch the newly created VM for the first time.
The next step is a manual step: you have to install the guest operating system.
If you also want to automate this step - which is possible - you should study the steps done by the "Easy Install" feature.
I already did it but I dont understand this step "The next step is a manual step: you have to install the guest operating system." Could you explain this a little more? thank you so much
All you are doing so far is creating the CONFIGURATION (i.e. virtual hardware) of the virtual machine. You still must install an Operating System in it once you power it on.
Hi RDPetruska and thank you,
Can i start with an operating system based on this hardware?