Linux - Suse 10.1: Cloning a VM and installing VMware Tools
Monday, February 11th, 2008Overview
If we have a working Virtual Machine, all setup nicely and having had the disk resized perhaps, and partitions enlarged, it may be easier to use this as the basis for a new VM for another user. The cloned machine requires to be configured as follows.
Steps.
- Physically copy the VM files to a new folder.
- The VM filenames may wish to be changed to reflect a change in hostname, for example. Open the main .vmx VMware configuration file and change the names of files inside from e.g. suse-somac8 to suse01, whilst at the same time renaming the config files referred to in Explorer.
- There may be a .vmxf extended configuration file also, for which the above process should be performed.
- Start the VM and login.
- Su to root and
- change the root password
- delete any unwanted user accounts
- Launch Yast
- In Yast, we require to rename the VM and set the correct network information.
- This (great) page tells you how to rename the Linux server and change the IP information: http://www.swerdna.net.au/linhowtonic.html
- Also one must manually set the IP number and default route or the network card does not work (Bridged networking - IP number on SML subnet, not DHCP etc)
> ifconfig eth2 137.195.80.82 netmask 255.255.255.0 up
> route add default gw137.195.80.90
where the above 80.82 respresents the guest IP number and 80.90 is our default gateway.
Installing VMware Tools
Vmware tools are basically drivers that work well in the Virtual environment - e.g. graphics drivers. One chooses to install them from the Vmware software and this appears as a Virtual CD (which can be mounted) and on which the vmware tools RPM is found.
There is a gotcha. Vmware Tools requires the kernel source code - just a folder which contains the source code. On the version of Suse in use here, the running kernel and source-code folder do not match for some reason, and VMware tools does not install. The steps to remedy this are
- Run command uname -r to return the running kernel version 2.6.16.21-0.13-default
- Yast - Software manager - search for kernel-source and examine the versions. Version 2.6.16.21-025 is installed, hmm.
- From this RPM repository, search for the correct kernel-source and download it (to a USB stick, say). Actually I found this kernel here: http://mirror.math.temple.edu/suse-install/update-10.1/rpm/i586/
- Install the above kernel-source
The kernel-source now matches the running kernel (you may have to remove the existing kernel-source within Yast, amidst many warning and protests!)
- Now with the Vmware Tools virtual CD, copy the vmware-tools.x.tar.gz file to and install folder of your choice (where x represents a lot of numbers I’m too lazy to type).
- Run command
> gunzip vmware-tools.x.tar.gz
> tar -xvf vmware-tools.x.tar - Change to the newly created vmware-tools-distrib folder
- Type ./vmware-install.pl to run the installation script.
- Accept the defaults and when asked if you want to run a config script, accept. Here’s where a problem comes, because at some stage a default answer will not suffice. You’ll get an error message if you accept the default to question "what is the location of the C header files that match your running kernel [/usr/src/linux/include]?"
You require to locate a folder such as /usr/src/linux-2.6.16.21-0.13 which should match your running kernel version, or the script will loop here. This is why the kernel-source was corrected earlier
Post Installation
It was found that the screen resolution was not able to be changed, even after a restart.
- Enter single-user mode
> su
> init 1 - Login as root and start the graphics configuration routine:
> sax2 - The X-windows environment should start. Under Monitor, change the monitor’s resolution to what matches your system (here 1280×1024).