Thursday, February 28, 2013

clone new linux server



  • for RHEL6, clear the old interface/device name
    vi /etc/udev/rules.d/70-persistent-net.rules
===================
For XenServer:
  • get CD Depository, tar of the old server
  • create new VM, choose "Other install media"
  • highlight the new vm, under "Storage" tab, select the created virtual disk, under Properties,highlight the last entry on the left panel "vm name(Device 0,(Read/Write)". Change the "Device Position" would change the device name "/dev/hda"

- boot with redhat with "linux rescue"
sh-3.2# fdisk -l        #confirm the device
sh-3.2# fdisk /dev/hda  # create 3 partition 1:100m for /boot, 2:swap, 3:root
                        # make sure the swap partition is type 82 (linux swap)
sh-3.2# mkfs.ext3 /dev/hda1
sh-3.2# mkfs.ext3 /dev/hda3
sh-3.2# mkswap /dev/hda2
sh-3.2# mkdir /mnt/sysimage
sh-3.2# mount /dev/hda3 /mnt/sysimage
sh-3.2# mkdir /mnt/sysimage/boot
sh-3.2# mkdir /dev/hda1 /mnt/sysimage/boot
sh-3.2# cd /mnt/sysimage
sh-3.2# sftp dchen@10.213.66.23         #this is the underline xen
sh-3.2#                                 #get the system tar file
sh-3.2# tar zxpf <server.tgz>
- modify boot/grub/device.map; grub.conf (make sure root=/dev/hda3); etc/fstab; etc/hosts; etc/sysconfig/network; etc/sysconfig/network-script/ifcfg-eth0; etc/resolv,conf; etc/ntp.conf,
(/etc/ntp/step-tickers)
- reboot to "linux rescue" mode again, system would find existing linux partition and mount it under /mnt/sysimage
sh-3.2# chroot /mnt/sysimage
sh-3.2# grub-install /dev/hda
sh-3.2# chkconfig network on
Then force reboot in citrix

- remove packages: "hp-snmp-agents hpacucli hp-health"
- install package: tcsh, OpenIPMI, OpenIPMI-libs
may need to turn off cpuspeed,
- SecurID agent
        modify /etc/pam.d/[login,sudo,system-auth]
- netbackup agent
- register redhat satellite
  # wget https://satellite01-man/pub/rhn-org-trusted-ssl-cert-1.0-1.noarch.rpm
 (or get and install https://satellite01-man/pub/RHN-ORG-TRUSTED-SSL-CERT)
  # rhnreg_ks --activationkey 1-key --serverUrl http://satellite01-man/XMLRPC
 if have ssl problem, check sslCACert in /etc/sysconfig/rhn/up2date or use
 "rhnreg_ks --sslCACert " to point to the right cert.
- snmp agent: /etc/snmp/snmpd.conf
dlmod cmaX /usr/lib64/libcmaX64.so
rwcommunity CAIM4NAGIOS 127.0.0.1
rocommunity CAIM4NAGIOS 127.0.0.1
rwcommunity  CAIM4NAGIOS nagios01-man
rocommunity  CAIM4NAGIOS nagios01-man
trapcommunity caimtrap
trapsink nagios01-man caimtrap
syscontact Dong Chen
syslocation Manassas DataCenter

- fix selinux permission
# foreach f (`rpm -qa`)
foreach? fixfiles -R $f restore
foreach? end

==========
XenSerever:

1. install hp agents for XenServer from \\fs01-man\ocioworking\Xen\hp-xs-agent.zip (hp-agents-xs.iso)
2. After installation, edit "/etc/snmp/snmpd.conf", 
3. update config files
- /etc/sudoers  ( %wheel)
- /etc/group
- ~/.ssh/authorized_keys
- /etc/exports
- /etc/sysconfig/network add:
        DOMAIN=
- /etc/ntp.conf add line:
        server 10.213.72.14
        server 10.213.72.15
- /etc/sysconfig/iptables to allow incoming traffic of snmp (161), ntp (123)
-A RH-Firewall-1-INPUT -p udp -m udp --dport 161 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 123 -j ACCEPT
4. install tcsh and hpacucli package
5. make sure snmpd and ntp automatically start
turn on services (chkconfig) snmpd, snmptrapd, nfs, portmap, nfslock,

# chkconfig ntpd on
# chkconfig snmpd on
# chkconfig hp-snmp-agents on
# chkconfig hp-asrd on
# chkconfig hp-health on
# chkconfig hpsmhd off

# service hp-health restart
# service hp-asrd restart
# service hp-snmp-agents restart
# service ntpd restart
# service snmpd restart
-----------
portmap; nfs; nfslock
===================
Add local storage
# fdisk -l
# pvcreate /dev/cciss/c0d1p1
# xe sr-create type=lvm content-type=user device-config:device=/dev/cciss/c0d1p1 name-label="Local RAID5"

No comments:

Post a Comment