Showing posts with label centos. Show all posts
Showing posts with label centos. Show all posts

How to use kickstart to install CentOS 6.1 on non-DHCP network

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

Install PSP on CentOS 6 x86_64

Jephe Wu - http://linuxtechres.blogspot.com

Environment: HP ProLiant BL460c G6, installed CentOS 6 x86_64
Objective: install proliant support package (PSP)


Steps:

Note: do not use psp for CentOS 6 one, it's older version and it might not work. Use Redhat Enterprise Linux 6 instead.

1. change /etc/centos-release

cp /etc/centos-release /etc/centos-release.orig -va
vi /etc/centos-release as follows:
Change CentOS to
Red Hat Enterprise Linux Server release 6.0 (Final)


otherwise, some psp packages will fail to install and hpsmh will fail to install as well , it will report zlib version 1.1.4 or above is missing.

2. install hp-snmp-agents first from command line, otherwise, smhd installation will fail from ./hpsum (software update manager)


[root@db03 psp]# yum localinstall hp-snmp-agents-8.7.0.23-17.rhel6.x86_64.rpm
Loaded plugins: fastestmirror
Setting up Local Package Process
Examining hp-snmp-agents-8.7.0.23-17.rhel6.x86_64.rpm: hp-snmp-agents-8.7.0.23-17.x86_64
Marking hp-snmp-agents-8.7.0.23-17.rhel6.x86_64.rpm to be installed
Loading mirror speeds from cached hostfile
 * base: mirror.optus.net
 * epel: mirror.optus.net
 * extras: mirror.optus.net
 * updates: mirror.optus.net
Resolving Dependencies
--> Running transaction check
---> Package hp-snmp-agents.x86_64 0:8.7.0.23-17 set to be updated
--> Processing Dependency: hp-health for package: hp-snmp-agents-8.7.0.23-17.x86_64
--> Processing Dependency: libcpqci.so.2 for package: hp-snmp-agents-8.7.0.23-17.x86_64
--> Processing Dependency: libhpasmintrfc.so.3 for package: hp-snmp-agents-8.7.0.23-17.x86_64
--> Processing Dependency: libhpev.so.1 for package: hp-snmp-agents-8.7.0.23-17.x86_64
--> Processing Dependency: libcpqci64.so.2()(64bit) for package: hp-snmp-agents-8.7.0.23-17.x86_64
--> Processing Dependency: libhpasmintrfc64.so.3()(64bit) for package: hp-snmp-agents-8.7.0.23-17.x86_64
--> Finished Dependency Resolution
Error: Package: hp-snmp-agents-8.7.0.23-17.x86_64 (/hp-snmp-agents-8.7.0.23-17.rhel6.x86_64)
           Requires: libhpasmintrfc64.so.3()(64bit)
Error: Package: hp-snmp-agents-8.7.0.23-17.x86_64 (/hp-snmp-agents-8.7.0.23-17.rhel6.x86_64)
           Requires: libcpqci64.so.2()(64bit)
Error: Package: hp-snmp-agents-8.7.0.23-17.x86_64 (/hp-snmp-agents-8.7.0.23-17.rhel6.x86_64)
           Requires: libhpev.so.1
Error: Package: hp-snmp-agents-8.7.0.23-17.x86_64 (/hp-snmp-agents-8.7.0.23-17.rhel6.x86_64)
           Requires: hp-health
Error: Package: hp-snmp-agents-8.7.0.23-17.x86_64 (/hp-snmp-agents-8.7.0.23-17.rhel6.x86_64)
           Requires: libhpasmintrfc.so.3
Error: Package: hp-snmp-agents-8.7.0.23-17.x86_64 (/hp-snmp-agents-8.7.0.23-17.rhel6.x86_64)
           Requires: libcpqci.so.2
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest


[root@db03 psp]# yum localinstall hp-health-8.7.0.22-17.rhel6.x86_64.rpm  --nogpgcheck
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.optus.net
 * epel: mirror.optus.net
 * extras: mirror.optus.net
 * updates: mirror.optus.net
Setting up Install Process
Examining hp-health-8.7.0.22-17.rhel6.x86_64.rpm: hp-health-8.7.0.22-17.x86_64
Marking hp-health-8.7.0.22-17.rhel6.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package hp-health.x86_64 0:8.7.0.22-17 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================================

==========================================================================================================================
 Package                                                    Arch                                                    Version                         

                              Repository                                                                            Size
====================================================================================================================================================

==========================================================================================================================
Installing:
 hp-health                                                  x86_64                                                  8.7.0.22-17                     

                              /hp-health-8.7.0.22-17.rhel6.x86_64                                                  1.6 M

Transaction Summary
====================================================================================================================================================

==========================================================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total size: 1.6 M
Installed size: 1.6 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : hp-health-8.7.0.22-17.x86_64                                                                                                     

                                                                                                                     1/1
Please read the Licence Agreement for this software at

         /opt/hp/hp-health/hp-health.license

By not removing this package, you are accepting the terms
of the "HP Proliant Essentials Software End User License Agreement".
==============================================================================
NOTE: To activate the software contained in this package, you must type:
      /etc/init.d/hp-health start
      /etc/init.d/hp-asrd start
as 'root' user.
==============================================================================
The hp-health RPM has installed successfully.

Installed:
  hp-health.x86_64 0:8.7.0.22-17                                                                                                                    
Complete!

[root@db03 psp]# yum localinstall hp-snmp-agents-8.7.0.23-17.rhel6.x86_64.rpm --nogpgcheck
Loaded plugins: fastestmirror
Setting up Local Package Process
Examining hp-snmp-agents-8.7.0.23-17.rhel6.x86_64.rpm: hp-snmp-agents-8.7.0.23-17.x86_64
Marking hp-snmp-agents-8.7.0.23-17.rhel6.x86_64.rpm to be installed
Loading mirror speeds from cached hostfile
 * base: mirror.optus.net
 * epel: mirror.optus.net
 * extras: mirror.optus.net
 * updates: mirror.optus.net
Resolving Dependencies
--> Running transaction check
---> Package hp-snmp-agents.x86_64 0:8.7.0.23-17 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================================

==========================================================================================================================
 Package                                                       Arch                                                  Version                        

                           Repository                                                                               Size
====================================================================================================================================================

==========================================================================================================================
Installing:
 hp-snmp-agents                                                x86_64                                                8.7.0.23-17                    

                           /hp-snmp-agents-8.7.0.23-17.rhel6.x86_64                                                5.9 M

Transaction Summary
====================================================================================================================================================

==========================================================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total size: 5.9 M
Installed size: 5.9 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : hp-snmp-agents-8.7.0.23-17.x86_64                                                                                                

                                                                                                                     1/1
Please read the Licence Agreement for this software at

         /opt/hp/hp-snmp-agents/hp-snmp-agents.license

By not removing this package, you are accepting the terms
of the "HP Proliant Essentials Software End User License Agreement".
Installing /opt/hp/hp-snmp-agents/nic/etc/HPcmanic.pp SELinux policy module
==============================================================================
NOTE: In order to activate the software contained in this package, you must
      type '/sbin/hpsnmpconfig' as 'root' user.
      Once configuration is completed start the agents by typing
      /etc/init.d/hp-snmp-agents start
==============================================================================

Installed:
  hp-snmp-agents.x86_64 0:8.7.0.23-17                                                                                                               

                                                                                                                        
3. run /sbin/hpsnmpconfig to configure /etc/snmp/snmpd.conf
configure it to add the following part on the top of the /etc/snmp/snmpd.conf

dlmod cmaX /usr/lib64/libcmaX64.so
rwcommunity public 127.0.0.1
trapcommunity public
rocommunity public 127.0.0.1
trapsink 192.168.0.1 public
syscontact Jephe Wu <jwu@domain.com>
syslocation someplace



4. install tigervnc* and xterm for GUI installation environment for hpsum

yum install tigervnc* xterm

5. install psp by hpsum
cd /root/
download psp for RHEL6 x86_64
mkdir psp
cd psp
tar xvpzf ../psp-xxxxxx.tar.gz

vncserver
./hpsum

6. hpsum installation

a. check only 'software update'
b. do not rebuild kernel module for certain NIC
c. install them

7. check and reboot
psp create a new set of initrd file as initramfs blabla

8. commands and references:
yum localinstall *.rpm
yum whatprovides filename


9. modify  /opt/hp/hp-snmp-agents/cma.conf 
change 
trapemail /bin/mail -s 'db01 HP Insight Management Agents Trap Alarm' root
to 
trapemail /bin/mail -s 'db1 zdb01 HP Insight Management Agents Trap Alarm' root

Set up bonding in RHEL6

Jephe Wu - http://linuxtechres.blogspot.com

Environment: CentOS 6 x86_64 on HP Blade Proliant BL460c G6, 2 builtin broadcom NIC and a NC364m Quad Port 1Gb NIC for c-class BladeSystem
Objective: after using builtin NIC to install OS , then configure bonding for 2 of quad port NIC.

Steps:

1. OS installation
You can download http://mirror.optus.net/centos/6/isos/x86_64/CentOS-6.0-x86_64-netinstall.iso and install OS through http URL from Internet.

2. bonding configuration

Firstly, disable network manager if NM is running.
service NetworkManager stop
chkconfig NetworkManager off


a. /etc/udev/rules.d/70-persistent-net.ruels

make sure it contains all interfaces you have in the system and don't configure bond0 inside.

b. /etc/sysconfig/network-scripts/

configuring ifcfg-bond0 as follows: (assuming ip address is 192.168.0.1)
       
[root@db03 network-scripts]# more ifcfg-bond0
DEVICE="bond0"
BROADCAST="192.168.0.255"
GATEWAY="192.168.0.254"
IPADDR="192.168.0.1"
NETMASK="255.255.255.0"
ONBOOT="yes"
USERCTL=no
BONDING_OPTS="mode=0 miimon=100 downdelay=300 updelay=300 max_bonds=4"


note: you must use capital letter for left side variables, especially BONDING_OPTS, otherwise, you might not be able to see slave devices from command output of 'ifconfig'.
Do not configure BONDING_OPTS in /etc/modprobe.d/bonding.conf as suggested by Redhat.

c. /etc/sysconfig/network-scripts/ifcfg-ethX

[root@db03 network-scripts]# more ifcfg-eth*
::::::::::::::
ifcfg-eth0
::::::::::::::
DEVICE=eth0
BOOTPROTO=none
MASTER=bond0
HWADDR=00:01:02:03:04:00
ONBOOT=yes
SLAVE=yes
USERCTL=no
::::::::::::::
ifcfg-eth1
::::::::::::::
DEVICE=eth1
BOOTPROTO=none
HWADDR=00:01:02:03:04:01
ONBOOT=no
USERCTL=no
::::::::::::::
ifcfg-eth2
::::::::::::::
DEVICE=eth2
BOOTPROTO=none
MASTER=bond0
HWADDR=00:01:02:03:04:02
ONBOOT=yes
SLAVE=yes
USERCTL=no
::::::::::::::
ifcfg-eth3
::::::::::::::
DEVICE=eth3
BOOTPROTO=none
HWADDR=00:01:02:03:04:03
ONBOOT=no
USERCTL=no
::::::::::::::
ifcfg-eth4
::::::::::::::
DEVICE="eth4"
HWADDR="00:00:00:00:00:04"
NM_CONTROLLED="no"
ONBOOT="no"
::::::::::::::
ifcfg-eth5
::::::::::::::
DEVICE="eth5"
HWADDR="00:00:00:00:00:05"
NM_CONTROLLED="no"
ONBOOT="no"

note: we connected network cables for eth0 and eth2 only, so only use these 2 ports for bonding.

d. /etc/modprobe/bonding.conf
[root@db03 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 cciss
alias scsi_hostadapter1 lpfc
alias bond0 bonding


3. Testing and debug
a. more /proc/net/bonding/bond0
b. ethtool eth0



4. References
a. RHEL6 deployment guide
http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s2-networkscripts-interfaces-chan.html

b. Redhat knowledge base DOC-48159 for 'How do I configure the bonding device on Red Hat Enteprise Linux 6" or search bonding in access.redhat.com knowledge base.

Install Zabbix on CentOS 5.6

Jephe Wu - http://linuxtechres.blogspot.com


  • PHP and Zabbix
CentOS 5.6, after installing zabbix server, try to access http://localhost/zabbix/queue.php, it displays empty page, httpd error log shows
[Wed Jun 15 11:08:14 2011] [error] [client 192.168.1.3] PHP Fatal error:  Call to undefined function bcscale() in /var/www/html/zabbix/include/defines.inc.php on line 794

Solution: yum install bcmath
  • Check of pre-requisites
When accessing http://localhost/zabbix/queue.php, we have to pass all the checking as follows:
vi /etc/php.ini to change:
timezone = Australia/Sydney
post_max_size = 32M
upload_max_filesize = 2M
max_execution_time = 600  
max_input_time = 600 

yum install php-mbstring
yum install php-gd
  • PHP and PHP53
When you use yum to install php* , you can exclude php53* as follows:

vi /etc/yum.conf to add
exclude=php53*

or yum install php* --exclude=php53*


  • References

  1. http://www.muck.net/?p=16  -   Installing Zabbix 1.4 on CentOS 5