Wednesday, February 25, 2015

Deploying VM Clones of Centos 6.6 in VirtualBox

Make a nice, clean CentOS VM, complete with all the utilities you like.


Make a script and put it in whatever default folder you go to when logging in:




nano reset-networking.sh


Put the following in:




# this script resets the networking, as in the case of a fresh cloned VM

# after the reboot, DHCP should pick up a new IP and you're off to the races


# assumes you have nano installed (yum install nano)

# assumes you have removed the "MACADDR=" and "HWADDR=" lines from

# /etc/sysconfig/network-scripts/ifcfg-eth0


# suggested: in /etc/sysconfig/network file, add DHCP_HOSTNAME=

# .... the hostname will then show up in your dhcp table


# remove the existing network interfaces

rm /etc/udev/rules.d/70-persistent-net.rules


# bring up an editor to change the hostname

nano /etc/sysconfig/network


# reboot to complete things

reboot


now make sure the script is executable:



chmod u+x reset-networking.sh


Open /etc/sysconfig/network-scripts/ifcfg-eth0:


Remove the MACADDR= line and the HWADDR= line


Shut down the machine

shutdown -P now


Now you can clone the VM.


When a new clone comes up, log in and execute the script – it’ll reboot the machine and then it should be all good:

./reset-networking.sh


Helpful links:


http://ift.tt/1A8hoRv


http://ift.tt/1EteBc3


http://ift.tt/1A8hoRw





No comments:

Post a Comment