Skip to main content
Home
badllama.com
  • Search
  • Log In

VMware Server

Thu, 04/07/2011 - 00:34 by bchavet

Install VMware Server on Debian Lenny

aptitude install linux-headers-`uname -r` build-essential xinetd gcc-4.1
ln -sf /usr/bin/gcc-4.1 /usr/bin/gcc

Unpack the VMware Server .tar.gz file and run the installer:

tar -zxf VMware-server-*.tar.gz
cd vmware-server-distrib
./vmware-install.pl

cancel when it wants to run /usr/bin/vmware-config.pl

create the file vmware-config.pl.patch somewhere and add the following to it:

--- /usr/bin/vmware-config.pl.orig           2008-11-28 12:06:35.641054086 +0100
+++ /usr/bin/vmware-config.pl 2008-11-28 12:30:38.593304082 +0100
@@ -4121,6 +4121,11 @@
     return 'no';
   }
 
+  if ($name eq 'vsock') {
+    print wrap("VMWare config patch VSOCK!\n");
+    system(shell_string($gHelper{'mv'}) . ' -vi ' . shell_string($build_dir . '/../Module.symvers') . ' ' . shell_string($build_dir . '/vsock-only/' ));
+  }
+
   print wrap('Building the ' . $name . ' module.' . "\n\n", 0);
   if (system(shell_string($gHelper{'make'}) . ' -C '
              . shell_string($build_dir . '/' . $name . '-only')
@@ -4143,6 +4148,10 @@
     if (try_module($name, $build_dir . '/' . $name . '.o', 0, 1)) {
       print wrap('The ' . $name . ' module loads perfectly into the running kernel.'
                  . "\n\n", 0);
+      if ($name eq 'vmci') {
+             print wrap("VMWare config patch VMCI!\n");
+             system(shell_string($gHelper{'cp'}) . ' -vi ' . shell_string($build_dir.'/vmci-only/Module.symvers') . ' ' . shell_string($build_dir . '/../'));
+      } 
       remove_tmp_dir($build_dir);
       return 'yes';
     }

patch vmware-config.pl with the following:

patch /usr/bin/vmware-config.pl /path/to/vmware-config.pl.patch

Finish the VMware configuration

/usr/bin/vmware-config.pl

Clone VMware Disk

  1. show all vm's
    vmware-vim-cmd vmsvc/getallvms
  2. clear old snapshots
    vmware-vim-cmd vmsvc/snapshot.removeall $vmid
  3. create new snapshot
    vmware-vim-cmd vmsvc/snapshot.create $vmid
  4. build new vm disk from snapshot
    vmware-vdiskmanager -r sourcedisk.vmdk -t 0 destdisk.vmdk

Expand Virtual Disk

Before expanding a disk, make sure there are no existing snapshots and shut down the virtual machine using it. You can then either use the GUI to increase the size, or the vmware-vdiskmanager command-line tool

vmware-vdiskmanager -x 10GB vmguest.vmdk

Enable LDAP Logins to Web Interface

/etc/pam.d/vmware-authd:

#%PAM-1.0

auth     sufficient      pam_unix.so nullok_secure
auth     required        pam_ldap.so use_first_pass
account  sufficient      pam_unix.so
account  required        pam_ldap.so use_first_pass
password required        pam_unix.so nullok obscure min=8 max=64 md5
session  required        pam_unix.so

RuntimeFault: Database temporarily unavailable or has network problems

/etc/init.d/vmware-mgmt stop
vi /etc/vmware/hostd/authorization.xml

Change this

11

to this

12
/etc/init.d/vmware-mgmt start

Fix Login Screen

Sometimes, the login screen on the web interface will not come up until you hit refresh a number of times. This is particularly an issue when using Firefox on Linux. To fix this behavior, edit /etc/vmware/webAccess/proxy.properties, and change the following line

proxy.noCache = false

to this

proxy.noCache = true

Then, restart vmware-mgmt

Control Remote VMware Server

Stop a remote virtual machine

vmrun -T server -h https://hostname:8333/sdk -u root -p password stop "[datastore] directory/vm.vmx"

Start a remote virtual machine

vmrun -T server -h https://hostname:8333/sdk -u root -p password start "[datastore] directory/vm.vmx"

Location of vmx file

datastore name

VMID=384
vmware-vim-cmd vmsvc/get.filelayout $VMID | grep vmPathName |\
  awk -F = '{$2=substr($2,3,length($2)-5);print $2}' | awk -F ] '{print substr($1,2)}'

vmx filename

VMID=384
vmware-vim-cmd vmsvc/get.filelayout $VMID | grep vmPathName |\
  awk -F = '{$2=substr($2,3,length($2)-5);print $2}' | awk -F ] '{print substr($2,2)}'

Location of vmdk files

These only work if you remove all of the snapshots from the virtual machine first.

datastore names

VMID=384
vmware-vim-cmd vmsvc/get.filelayout $VMID | sed -n '/diskFile/ {n;p}' | sed 's/.*\[\(.*\)\].*/\1/'

vmdk files

VMID=384
vmware-vim-cmd vmsvc/get.filelayout $VMID | sed -n '/diskFile/ {n;p}' |\
  awk -F ] '{print substr($2,2,length($2)-2)}'

datastore names with line ID

VMID=384
vmware-vim-cmd vmsvc/get.filelayout $VMID | sed -n '/diskFile/ {n;p}' |\
  sed 's/.*\[\(.*\)\].*/\1/' | awk '{i++;print i,$0}'

vmdk files with line ID

VMID=384
vmware-vim-cmd vmsvc/get.filelayout $VMID | sed -n '/diskFile/ {n;p}' |\
  awk -F ] '{i++;print i,substr($2,2,length($2)-2)}'

Location of a datastore

DATASTORE=standard
vmware-vim-cmd hostsvc/datastore/info $DATASTORE |\
  sed -n '/vim.host.MountInfo/,/\}/ p' | grep path |\
  awk -F = '{$2=substr($2,3,length($2)-5);print $2}'

Virtual Machine name

VMID=384
vmware-vim-cmd vmsvc/get.config $VMID | grep name | head -n 1 |\
awk -F = '{$2=substr($2,3,length($2)-5);print $2}'
Attachments: 
File vm-snapshot-backup.sh
Powered by Backdrop CMS