Gentoo 2007.0 Quick Install w/ RAID

I install Gentoo all the time, I use a few different documents to do it, ultimately I skip massive chunks of each HowTo. This is a concise install procedure that I can copy from and paste into a SSH window. Since it’s built for me there are bits missing… I actually have some files already set, make.conf, hosts, resolve.conf, etc and just use winscp to transfer them…

Start SSH & Change Password

/etc/init.d/sshd start
passwd

Configure Disks

Paritions & RAID

fdisk /dev/sda

type = fd

sfdisk -d /dev/sda | sfdisk /dev/sdb

modprobe raid1
modprobe raid5

cd /dev && MAKEDEV md

mdadm --create --verbose /dev/md1 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
mdadm --create --verbose /dev/md2 --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2
mdadm --create --verbose /dev/md3 --level=1 --raid-devices=2 /dev/sda3 /dev/sdb3
mdadm --create --verbose /dev/md4 --level=5 --raid-devices=4 --force /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1

mdadm --detail --scan >> /etc/mdadm.conf

watch -n1 'cat /proc/mdstat'

Formating, SWAP & Mounting

mke2fs -j /dev/md1
mke2fs -j /dev/md3
mkfs.ext3 -j -O dir_index,resize_inode /dev/md4

mkswap /dev/md2
swapon /dev/md2

mount /dev/md3 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/md1 /mnt/gentoo/boot
mkdir /mnt/gentoo/var
mount /dev/md4 /mnt/gentoo/var

Recovery

mdadm --assemble /dev/md1 /dev/sda1 /dev/sdb1
mdadm --assemble /dev/md2 /dev/sda2 /dev/sdb2
mdadm --assemble /dev/md3 /dev/sda3 /dev/sdb3
mdadm --assemble /dev/md4 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1

swapon /dev/md2

mount /dev/md3 /mnt/gentoo
mount /dev/md1 /mnt/gentoo/boot
mount /dev/md4 /mnt/gentoo/var

Install System

Base System

cd /mnt/gentoo

wget http://ftp.iinet.net.au/linux/Gentoo/releases/amd64/2007.0/stages/stage3-amd64-2007.0.tar.bz2 http://ftp.iinet.net.au/linux/Gentoo/snapshots/portage-latest.tar.bz2

tar -jxf stage3-amd64-2007.0.tar.bz2
tar -jxf portage-latest.tar.bz2 -C /mnt/gentoo/usr

(copy files over)

Chroot

mdadm --detail --scan >> /etc/mdadm.conf
cp /etc/mdadm.conf /mnt/gentoo/etc/mdadm.conf

mount -t proc none /mnt/gentoo/proc
mount -o bind /dev /mnt/gentoo/dev

chroot /mnt/gentoo /bin/bash
env-update
source /etc/profile
export PS1="(chroot) $PS1"

Configure System

rm /etc/localtime
ln -s /usr/share/zoneinfo/Australia/Sydney /etc/localtime

date

hostname znd01
hostname -f

emerge --sync
emerge -av portage ccache
emerge -av syslog-ng vixie-cron mdadm iproute2 gentoolkit gentoo-sources screen grub eix ntp dnsmasq

etc-update

cd /usr/src/linux
make menuconfig

make && make modules_install

cp arch/x86_64/boot/bzImage /boot/bzImage

Grub

grub --no-floppy

device (hd0) /dev/sda
root (hd0,0)
setup (hd0)

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

Finishing Up

passwd

rc-update add syslog-ng default
rc-update add vixie-cron default
rc-update add mdadm boot
rc-update add net.eth0 default
rc-update add ntp.client default
rc-update add ntpd default
rc-update add dnsmasq default
rc-update add sshd default

exit

cd
umount /mnt/gentoo/boot /mnt/gentoo/var /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo
reboot