Software RAID1 CentOS Install

For default (non-software RAID) CentOS install skip to the next section.

Close ALL port forwards in the firewall  to the server IP we are about to install
Install CentOS from DVD by booting from it.  Set system time to UTC.

This procedure assumes your using the GUI install method.  For "linux text" based install it is a bit different and less intuitive.  I recommend using the GUI (default) method.
At the drive setup menu select "Remove all partitions from select drives"
Check the "create custom layout" box>select "next"
At the next menu it will show you the current default configuration.  If it shows ANYTHING beside 2 or more 100% free space drives click on the LVM and/or partitions and press "delete".  All you want right now is 2 or more drives showing 100% free space, no partitions or LVM volumes.

1) At the next menu select RAID>create software RAID partition>ok
Select one of the 2 RAID disks and create boot partition of 100MB check "force to be primary partition"
Repeat and again select the same drive and create size equal to twice the amount of RAM
Repeat and again select the same drive and select "fill to maximum allowable size"

Now you should see one of your two drives with three partitions labelled as type "Software RAID"

2) Now repeat the above procedure EXACTLY the same for your second drive.
Now you should see both drives with 3 equivalent partitions all labelled as type "Software RAID"
Go back to the first drive "root" partition and click "edit" and change from "fill to maximum allowable size" to "fixed size" and use the same size as it was before.  This is done so that the ordering of the partitions on both drives (boot=md0, swap=md1, root=md2) are exactly the same.

3) Now repeat but this time select "create RAID device"
Check the 100MB partition on each drive so you have 2 check marks and select RAID 1, boot, ext3
Now Repeat and select the partition equal to twice the size of your RAM on each of the two drives and select RAID 1, swap
Repeat again and select the root partition on each of the two drives and select RAID 1, /, ext3

We could also create LVM volumes but that is not required for an Asterisk installation so in my humble opinion it is not recommended and beyond the scope of this installation procedure.

So now the main menu should show 3 RAID 1 devices corresponding to the 3 identical pairs of Software RAID partitions on the two drives.  It sounds a bit confusing when in writing but when you go through the GUI and actually do everything it should make a lot more sense.

Now select "Next" twice (using default GRUB bootloader options).

 Set static IP, netmask, gateway, DNS server
Set hostname to something like "asterisk.local".  If you have multiple installs it is important to make this hostname unique for each install so when you get email notifications you will know which PBX is sending it.

NOTE: If you have 2 ethernet adapters/ports you can make eth0 and eth1 identical except eth0 is active on boot and eth1 is NOT!  That way if one ethernet port ever fails you can quickly make the other port active.

Ensure that all package groups and modules in default and custom install packages are DE-selected for install (including "base system") so that only a bare minimal install is done:

Enabling boot from both disks

We are not quite finished yet.  We have mirrored drives but we still do not have mirrored bootloaders.  That is because Anaconda only puts the bootloader on 1 physical hard drive Master Boot Record which is a separate part of the drive not affected by the above procedure.   By default (in the case of sata drives) it will be sda.

After we boot into our new RAID 1 linux system from a root command prompt:

Get grub command prompt

Now from grub command prompt (grub>)

grub>find /boot/grub/stage1
This will list drives which for a 2 sata drive system will be (hd0,0), (hd1,0)

Assuming we are using SATA drives (sda, sdb, sdc...etc.)
And assuming sda is the bootable one already

Copy over the grub boot loader to sdb

grub>device (hd0) /dev/sdb
grub>root (hd0,0)
grub>setup (hd0)

This tells grub to assume sdb is the first disk in the system (which it is currently assuming sda is) and then copy over the bootloader (stage1) into the MBR.  So now if sda were to fail the system would still be able to boot from sdb.

For performance and security reasons it is important to update the system immediately after install.
yum -y update

The following packages also need to be installed with yum:

yum groupinstall core
yum groupinstall base

yum install gcc gcc-c++ wget bison mysql-devel mysql-server php php-mysql php-pear php-pear-DB php-mbstring nano ntp tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-cf caching-nameserver sox newt-devel libxml2-devel libtiff-devel php-gd audiofile-devel gtk2-devel

Disable Firewall and SELinux
setup agent

Go to firewall configuration and ensure SELinux and Firewall are disabled


Skip the next section (non-RAID CentOS install) and proceed to the section after that.