VmWare

From Andreida
Jump to: navigation, search

Contents

Install VmWare Server

 apt-get install psmisc build-essential linux-headers-`uname -r`

VmWare Server Console Commands

If using the command line: the position of the parameters is important !

Webinterface: https://<ip|name>:8333

List running/stopped machines

 vmrun -h https://<ip|name>:8333/sdk -u <user> -p <password> list|listRegisteredVM

Use the output from "listRegisteredVM" for your start/stop commands, don't forget the "

 vmrun -h https://127.0.0.1:8333/sdk -u <user> -p <password>  start "[VirtualMachines] <dir>/<file>"

Script arround vmrun, don't overwrite "list" !

 http://hydra.geht.net/tino/howto/vmware/vmrun/

Or use this script: (vmware-do.sh)

#!/bin/bash

user=mister
#password=secret

#either set the password hardcoded and protect the file or do it via read
#either way the password will not be shown in the history
echo -n password:
read password

vmrun -T server -h https://127.0.0.1:8333/sdk -u $user -p $password $*

You then use this script like:

 vmware-do.sh list

Errors

Error:

 Failed to lock the file

Solution

 rm -rf /var/lib/vmware/Virtual\ Machines/<your-machine>/*.lck

Error:

 SSL Handshake on client connection failed: SSL Exception

Perhaps the solution: In FireFox about:config security.enable_ssl2 -> true

https://<server>:8333/ui/plugin/vmware-vmrc-win32-x86.xpi

In IE: https://<server>/ui/plugin/vmware-vmrc-win32-x86.exe

Error:

Insufficient permissions in host operating system

Solution: Use the correct username/password or escape dangerous characters or just use a simple password.

VIX API

http://www.vmware.com/support/developer/vix-api/

Copy a machine

Either do it manually

  • copy the directory
  • rename the files (optional)
  • rename the display name in the .vmx file
  • change the hostname (debian: /etc/hostname)

or use the following script: (you will still have to change the hostname inside the machine) vmware-clone.sh

#!/bin/bash

# check the arguments
if [ ! $# -eq 2 ]; then
    echo vmware machine cloner v0.1 by Andreas Duffner\<it@Andreas-Duffner.de\>
    echo Syntax: \<SourcePath\> \<TargetPath\>
    echo Example: $0 /vmware/template /vmware/test-install
    exit 1
fi

# source / target
sourceDir=$1
targetDir=$2

# basename
sourceName=`basename $sourceDir`
targetName=`basename $targetDir`

# copy
echo -n copying $sourceName to $targetName...
cp -r $1 $2
echo ok

#rename files
echo -n renaming files...
rename "s/$sourceName/$targetName/" $targetDir/*
echo ok

#change file contents
echo -n changing file contents...
sed -i "s/$sourceName/$targetName/" $targetDir/*.vmx*
echo ok
Personal tools
Namespaces

Variants
Actions
Navigation
Tools