Jephe Wu - http://linuxtechres.blogspot.com
Environment: HP BladeSystem Proliant BL460c G6(ip: 192.168.0.0/24, DHCP/tftp/kickstart/PXE/HTTP server is on different network: 192.168.1.0/24)
Objective: install CentOS 6.1 into bare-metal blades from
Difficulties: We are not able to boot from PXE as it's in different network.
Concepts:
We can use CentOS netinstall ISO CD to boot up blades and specify dhcp/tftp/http server as installation source and use kickstart to install it automatically.
We can further modify CentOS netinstall iso CD to add kickstart location to make it automatically installed through kickstart
Steps:
1. make customized netinstall CentOS 6.1 CD
download iso from http://mirror.optus.net/centos/6.1/isos/x86_64/CentOS-6.1-x86_64-netinstall.iso and put it /root
cd /root; mkdir c
mount CentOS-6.1-x86_64-netinstall.iso c -o loop
cp -va c c.1
cd c.1
rm -fr images
cd isolinux
vi isolinux.cfg
-------------
default linux
prompt 0
timeout 1
display boot.msg
menu background splash.jpg
menu title Welcome to CentOS 6.2!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000
label linux
menu label ^Install or upgrade an existing system
menu default
kernel vmlinuz
append initrd=initrd.img ks=http://jephe.server/ks_centos_6_x86_64 text ksdevice=eth0 gateway=192.168.0.254 ip=192.168.0.1 dns=192.168.1.1 netmask=255.255.255.0 --onboot=on
label vesa
menu label Install system with ^basic video driver
kernel vmlinuz
append initrd=initrd.img xdriver=vesa nomodeset
label rescue
menu label ^Rescue installed system
kernel vmlinuz
append initrd=initrd.img rescue
label local
menu label Boot from ^local drive
localboot 0xffff
label memtest86
menu label ^Memory test
kernel memtest
append -
-------------------
cat > /root/c.1/mkiso.sh << END
mkisofs -o ../CentOS-6.1_x86_64-Kickstart-192.168.0.1.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -T .
END
-------------------
then, cd /root/c.1, run
./mkiso.sh
it will create the iso file under /root
2. prepare kickstart file http://jephe.server/ks_centos_6_x86_64
Here is the KS file I used:
-------------
install
url --url=http://jephe.server/packages/centos_6_x86_64
text
lang en_US
keyboard us
rootpw password
firewall --disabled
services --disabled=NetworkManager,abrtd,acpid,certmonger,cgconfig,cgred,corosync,cpuspeed,cups,dovecot,ip6tables,iptables,kdump,modclusterd,multipathd,mysql-mmm-agent,mysql-proxy,netconsole,nfs,nscd,nslcd,ntpdate,oddjobd,psacct,quota_nld,rdisc,restorecond,rpcbind,rpcgssd,rpcidmapd,rpcsvcgssd,saslauthd,smartd,snmptrapd,spamassassin,sssd,vncserver,ypbind
firstboot --disable
selinux --disabled
authconfig --enableshadow --passalgo=sha512 --enablefingerprint
timezone Australia/Sydney
bootloader --location=mbr --driveorder=sda --append="rhgb crashkernel=auto rhgb quiet"
zerombr yes
clearpart --all --initlabel
part /boot --fstype=ext3 --size=256
part swap --asprimary --size=8192
part / --fstype=ext4 --grow --asprimary --size=200
%packages --ignoremissing
@base
@client-mgmt-tools
@compat-libraries
@console-internet
@core
@debugging
@directory-client
@mail-server
@hardware-monitoring
@java-platform
@large-systems
@mysql-client
@mysql
@network-file-system-client
@performance
@perl-runtime
@server-platform
@server-policy
@storage-client-multipath
@system-admin-tools
pax
oddjob
sgpio
certmonger
pam_krb5
krb5-workstation
nscd
pam_ldap
nss-pam-ldapd
perl-DBD-MySQL
perl-DBD-SQLite
screen
vlock
lsscsi
sendmail
sendmail-cf
lrzsz
dos2unix
unix2dos
tigervnc
%pre --log=/tmp/pre.log
ETH=eth0
IP=`ifconfig $ETH | grep "inet " | cut -d : -f 2 | cut -d " " -f 1`
MAC=`ifconfig $ETH | grep HWaddr | awk -F "HWaddr " '{print $2}'`
if [ $MAC == "00:00:B3:B0:44:00" ];then
NAME=db01.domain
SHORTNAME=db01
fi
if [ $MAC == "00:00:B3:B0:43:18" ];then
NAME=db02.domain
SHORTNAME=db02
fi
echo "NETWORKING=yes" > /tmp/network.txt
echo "HOSTNAME=${NAME}" >> /tmp/network.txt
cat > /tmp/hosts.txt <<'EOF'
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
EOF
echo "$IP $NAME $SHORTNAME" >> /tmp/hosts.txt
%post --nochroot --log=/tmp/post.log
cp /tmp/network.txt /mnt/sysimage/etc/sysconfig/network
. /mnt/sysimage/etc/sysconfig/network
/mnt/sysimage/bin/hostname $HOSTNAME
cp /tmp/hosts.txt /mnt/sysimage/etc/hosts
/usr/bin/cp /tmp/pre.log /mnt/sysimage/root/pre.log
/usr/bin/cp /tmp/post.log /mnt/sysimage/root/post.log
# if you use rollout for server configuration deployment. ( search 'rollout google' in google)
echo "Kickstarted `/usr/bin/date`" > /mnt/sysimage/root/kickstart_report
wget -O /mnt/sysimage/usr/local/sbin/rollout http://server.domain/rollout
sed -i -e 's#http://server.domain#http://rollout.domain#' /mnt/sysimage/usr/local/sbin/rollout
chmod +x /mnt/sysimage/usr/local/sbin/rollout
echo "Kickstart complete" >> /mnt/sysimage/root/kickstart_report
-------------
3. use HP ILO to boot from above-made CentOS netinstall ISO CD.
it will use kernel and initrd files from customized netinstall iso CD to boot up machine, and install packages from approved specified kickstart file
http://jephe.server/packages/centos_6_x86_64
For configuration files under pxelinux.cfg directory, you can use something like this:
append initrd=centos_6_x86_64/initrd.img ramdisk_size=8192 ks=http://kickstart.jephe/ks_centos_6_x86_64 ip=dhcp ksdevice=eth0
4. configuring bonding device
[root@db01 network-scripts]# more /etc/modprobe.d/bonding.conf
alias eth0 e1000e
alias eth1 e1000e
alias eth2 e1000e
alias eth3 e1000e
#alias eth4 bnx2x
#alias eth5 bnx2x
alias scsi_hostadapter lpfc
alias bond0 bonding
ifcfg-bond0
::::::::::::::
DEVICE=bond0
GATEWAY=192.168.0.254
IPADDR=192.168.0.1
IPV6INIT=no
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
BONDING_OPTS="mode=1 miimon=100"
::::::::::::::
ifcfg-eth0
::::::::::::::
DEVICE=eth0
IPV6INIT=no
MASTER=bond0
MTU=1500
ONBOOT=no
PEERDNS=yes
SLAVE=yes
TYPE=Ethernet
USERCTL=no
::::::::::::::
ifcfg-eth1
::::::::::::::
# Intel Corporation 82571EB Quad Port Gigabit Mezzanine Adapter
DEVICE=eth1
HWADDR=00:00:00:B0:44:01
ONBOOT=no
HOTPLUG=no
::::::::::::::
ifcfg-eth2
::::::::::::::
DEVICE=eth2
IPV6INIT=no
MASTER=bond0
MTU=1500
ONBOOT=no
PEERDNS=yes
SLAVE=yes
TYPE=Ethernet
USERCTL=no
::::::::::::::
ifcfg-eth3
::::::::::::::
# Intel Corporation 82571EB Quad Port Gigabit Mezzanine Adapter
DEVICE=eth3
HWADDR=00:00:00:B0:44:03
ONBOOT=no
HOTPLUG=no
::::::::::::::
::::::::::::::
ifcfg-eth4
::::::::::::::
# Broadcom Corporation NetXtreme II BCM57711E 10-Gigabit PCIe
DEVICE=eth4
HWADDR=F4:CE:46:7E:00:00
ONBOOT=no
HOTPLUG=no
::::::::::::::
ifcfg-eth5
::::::::::::::
# Broadcom Corporation NetXtreme II BCM57711E 10-Gigabit PCIe
DEVICE=eth5
HWADDR=F4:CE:46:7E:00:01
ONBOOT=no
HOTPLUG=no
::::::::::::::
ifcfg-lo
::::::::::::::
DEVICE=lo
IPADDR=127.0.0.1
NETMASK=255.0.0.0
NETWORK=127.0.0.0
# If you're having problems with gated making 127.0.0.0/8 a martian,
# you can change this to something else (255.255.255.255, for example)
BROADCAST=127.255.255.255
ONBOOT=yes
NAME=loopback
Note: prior to CentOS 6, you may add bonding options as follows in /etc/modprobe.d/bonding.conf:
options bonding mode=1 miimon=100