Wednesday, April 1, 2009

Cloning a New VMware Testing Environment (RHEL4)

As a DBA, I perform a lot of testing on Oracle Database related functionalities and features. I do most of my testing on a VMware virtual machine. Instead of creating a new virtual machine each time, I have created/installed a master virtual machine for each platform and each time when I require a new testing environment, I'll clone from my master machine. Before everything is working, there are some configurations that need to be set.

Before shutting down the master VM:

Enable Telnet service.
1. Login as root and install telnet-server if it's not already installed. Go to Legacy Network Server under Add or Remove Packages,click on Details and check "telnet-server".

2. Hit Update to install the necessary packages. You will need to insert the RedHat CD/DVD as per instruction.

3. Run below commands:
# chkconfig telnet on
# service xinetd reload

Enable FTP service
1. login as root and install vsftpd, "Very Secure FTP Daemon" if it's not already installed. Just check "FTP Server" under Add or Remove Packages.

2. Hit Update to install the necessary packages. You will need to insert the RedHat CD/DVD
as per instruction.

3. Start vsftpd
# /etc/init.d/vsftpd start

4. To start vsftpd automatically during reboot,
# ln -s /etc/init.d/vsftpd /etc/rc3.d/S56vsftpd
# ln -s /etc/init.d/vsftpd /etc/rc4.d/S56vsftpd
# ln -s /etc/init.d/vsftpd /etc/rc5.d/S56vsftpd

To allow root user to telnet and ftp
1. Edit the file /etc/securetty and add the following to the end of the file:
pts/0
pts/1
pts/2
pts/3
pts/4
pts/5
pts/6
pts/7
pts/8
pts/9

2. Edit the files /etc/vsftpd.ftpusers and /etc/vsftpd.user_list and comment the 'root' line from each file.

Install VMware Client tools
1. Login as root and then choose Install VMware Tools... from the VM main menu. This will auto mount a cd contains VMware tool package.

2. Open up the cd and install from the rpm package.

3. Then, run the "vmware-config-tools.pl" as root and hit enter on the resolution option.
This should complete the VMware client tools. You can now launch "vmware-toolbox" to
configure time synchronization.

Shutdown and keep the master VM copy. Whenever necessary, copy from the master vm directory and File>>Open the new copied VM from VMware Server console.

On the new added virtual machine:
Probe a new network adaptor(s) MAC address for the new virtual machine
1. Go to Applications menu, System Settings >> Network
On every network adaptor, double click to launch the settings page. Under Hardware Device,
probe a new MAC address for that adaptor.

2. Change the IP addresses accordingly

3. Activate/reactivate the adaptor(s) to take the new network settings.

Change hostname to suite your environment
eg. from master to prod

1. Modify the file /etc/sysconfig/network
NETWORKING=yes
HOSTNAME="prod.localdomain"

2. Do not forget /etc/hosts
Add or modify the entry, Eg.
192.168.0.100 prod.localdomain prod

3. Reboot the OS.