cancel
Showing results for 
Search instead for 
Did you mean: 

Cloning a server in RHEL 4

SOLVED
Go to solution
Geetha_1
Regular Advisor

Cloning a server in RHEL 4

I am new to RHEL - is there a way of cloning a server in RHEL like ignite for hp-ux? If there is, can someone give me a detailed procedure to go about cloning the server? Thanks.
Geetha.
7 REPLIES
Robert Walker_8
Valued Contributor
Solution

Re: Cloning a server in RHEL 4

Gday,

You can and there is not much too it. Although I dont know if there are tools per say.

One can just dump the file systems and restore them elsewhere using the redhat rescue cd. Or you can ghost the system.

All that is really required is to change the hostname /etc/hosts, /etc/sysconfig/network, /etc/sysconfig/network-scripts/ifcfg-eth* config files to update nodename and tcpip details and if you plan to register server with Redhat then you need to create a new systemid as registering the copied version against the original will confuse the system. This can be done by removing the /etc/sysconfig/rhn/systemid and /etc/sysconfig/rhn/up2date-uuid (this needs to be regenerated using uuidgen - copy the gen number into up2date-uuid). Note when I save remove - its best to make backups of these files first :)

The other option as opposed to copying an existing system is to setup kickstart. We can build servers with our own postbuild scripts in less than 3 minutes! This is done by copying the CD set to a system which can either be NFS/Apache Web Server or FTP server - NFS is the simplest! And building a kickstart script. Install the first cd and say linux ks=nfs:server:/nfs/path/to/RedHat and off it will go.

I believe HP if you buy it have cloning software kits - mainly for rolling out blade environments. However once you have kickstart up and had a play this is great!

If you play with virtualised systems (Eg VMWARE) then you can stop the virtual guests and just copy the image files - then go through and do what was mentioned at the beginning.

Hope this helps a bit.

Robert.
Geetha_1
Regular Advisor

Re: Cloning a server in RHEL 4

Robert,
The kickstart option using NFS sounds great! Could you point me in the right direction for kickstart documentation/procedure, please? Thanks.
Geetha.
Steven E. Protter
Exalted Contributor

Re: Cloning a server in RHEL 4

Shalom,

http://www.mondorescue.org
Free, doesn't do well with major hardware differences.

http://www.acronis.com
Not free, does a better job but costs more.

Norton Ghost:
Effective but no support for using it on Linux

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Geetha_1
Regular Advisor

Re: Cloning a server in RHEL 4

Steve,
Thanks, am going to try mondo rescue.
Geetha
Robert Walker_8
Valued Contributor

Re: Cloning a server in RHEL 4

Gday,

Take your anaconda-ks.cfg from an existing server that you want to clone. modify the ip addresses and host name info.

Copy your redhat cds to a server with nfs add a new mount point for nfs.

Modify your anaconda-js.cfg to use nfs install rather than say cdrom.

See below example anaconda kickstart script - this one installs everything pretty much and configures server with network and hostname. One could have a post install script as show to do backend stuff - we get our servers to register to Redhat automatically and handle different situations - such as hardened servers etc.:

#System language
lang en_AU
#Language modules to install
langsupport en_AU
#System keyboard
keyboard us
#System mouse
mouse
#Sytem timezone
timezone Australia/Sydney
#Root password
rootpw --iscrypted
authconfig --enableshadow --enablemd5
bootloader --location=mbr --append="rhgb quiet"
# Device Probe
deviceprobe
#Reboot after installation
#reboot - no we want to check after system is built!
text
#Install OS instead of upgrade
install
#Use NFS installation Media
nfs --server=192.168.29.10 --dir=/nfs/rhel/v4u3/ES32
#System bootloader configuration
bootloader --location=mbr --append="rhgb quiet"
#Clear the Master Boot Record
zerombr yes
#Disk partitioning information
clearpart --all --initlabel
part / --fstype ext3 --size 2048 --asprimary
part swap --fstype swap --size 1024 --asprimary
part /usr --fstype ext3 --size 8192 --asprimary
part /var --fstype ext3 --size 5120 --asprimary
part /tmp --fstype ext3 --size 5120 --asprimary
part /home --fstype ext3 --size 2048 --asprimary
#System authorization infomation
auth --useshadow --enablemd5
#Network information
network --device eth0 --bootproto static --ip 192.168.29.163 --netmask 255.255.255.0 --gateway 168.132.29.1 --nameserver 192.168.29.10,168.132.29.18 --hostname test.server.com
#Firewall configuration
firewall --enabled --port=22:tcp --port=25:tcp --port=123:udp
selinux --permissive
#XWindows configuration information
xconfig --depth=8 --resolution=1024x768 --defaultdesktop=GNOME --startxonboot --monitor="Monitor 1024x768"
#Run the Setup Agent on first boot
firstboot --enable
#Package install information
%packages --resolvedeps
@ base-x
@ gnome-desktop
@ kde-desktop
@ editors
@ engineering-and-scientific
@ graphical-internet
@ text-internet
@ office
@ sound-and-video
@ authoring-and-publishing
@ graphics
@ games
@ server-cfg
@ web-server
@ mail-server
@ smb-server
@ dns-server
@ ftp-server
@ sql-server
@ mysql
@ news-server
@ network-server
@ legacy-network-server
@ development-tools
@ x-software-development
@ gnome-software-development
@ kde-software-development
@ compat-arch-development
@ legacy-software-development
@ admin-tools
@ system-tools
@ printing
@ compat-arch-support
grub
kernel-devel
kernel
%post
#!/bin/bash
chvt 3
NFSSERVER=168.132.29.10
mkdir /nfs
mount -o ro,nolock,wsize=8192,rsize=8192 -t nfs $NFSSERVER:/data/nfs /nfs
if [ $? -ne 0 ]; then
echo "Error - Mounting of $NFSSERVER failed?"
exit 1
fi
echo "Starting Post Build Script"
ksh -x /nfs/buildserver/postbuild.sh "KICKSTART" 3 >> /root/postbuild.log 2>&1

Geetha_1
Regular Advisor

Re: Cloning a server in RHEL 4

Thanks, Robert. Our new servers are just shipped, will try it and keep you all posted.
Geetha.
Florian Heigl (new acc)
Honored Contributor

Re: Cloning a server in RHEL 4

Hi,

for fully automating kickstarts there is a new tool by RedHat under development. It consists of two programs, cobbler and koan.

Check it out after You did (and enjoyed) the first few successful kickstart installs. It has support for RHEL, Fedora, CentOS (apparently soon even SUSE) and even knows how to control(abuse) a dhcp server and Xen configuration. It also brings along kickstart installation tracking by analysing the webserver and install logs (using a lean syslog daemon)

http://cobbler.et.redhat.com/
yesterday I stood at the edge. Today I'm one step ahead.