### 0. Boot the LiveCD
# No FB doesn't load any graphics
gentoo-nofb # [enter]
## ------------------------------------------------------------------ ##
### 1. Start the Network and SSH
# - check the eth you're going to set up (usually eth0)
ifconfig -a
net-setup eth0
# - using Google Public DNS (you can use others)
echo "nameserver 8.8.8.8" > /etc/resolv.conf
echo "nameserver 8.8.4.4" >> /etc/resolv.conf
# - start SSH Server
/etc/init.d/sshd start
passwd root
## ------------------------------------------------------------------ ##
### 2. Login via SSH (just to make it more confortable)
## ------------------------------------------------------------------ ##
### 3. Hard Disk Partitioning
## 3A. Normal Partitioning
# This may vary depending on the setup wanted or the number of disks
# In this example it's a 500G HD
fdisk /dev/sda
# n -> p -> 1 -> [enter] -> +100M # /boot
# n -> p -> 2 -> [enter] -> +8G # swap
# n -> p -> 2 -> [enter] -> +4G # /tmp
# n -> p -> 3 -> [enter] -> [enter] # /
# w
## 3B. Preparing the disk for Software RAID (just if needed)
fdisk /dev/sda
# t -> 1 -> fd
# t -> 2 -> fd
# t -> 3 -> fd
# t -> 4 -> fd
## 3C. Software RAID 1 set-up (optional)
# Set partitioning on sdb as on sda
emerge -Nu sfdisk
sfdisk -d /dev/sda | sfdisk /dev/sdb
modprobe raid1
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=1 --raid-devices=2 /dev/sda4 /dev/sdb4
# Wait until it finishes...
watch -n 1 "cat /proc/mdstat"
## 3D. Software RAID 5 set-up (optional)
# Set partitioning on sdb and sdc as on sda
emerge -Nu sfdisk
sfdisk -d /dev/sda | sfdisk /dev/sdb
sfdisk -d /dev/sda | sfdisk /dev/sdc
modprobe raid1
modprobe raid5
mdadm --create --verbose /dev/md1 --level=1 --raid-devices=3 /dev/sda1 /dev/sdb1 /dev/sdc1
mdadm --create --verbose /dev/md2 --level=5 --raid-devices=3 /dev/sda2 /dev/sdb2 /dev/sdc2
mdadm --create --verbose /dev/md3 --level=5 --raid-devices=3 /dev/sda3 /dev/sdb3 /dev/sdc3
mdadm --create --verbose /dev/md4 --level=5 --raid-devices=3 /dev/sda4 /dev/sdb4 /dev/sdc4
# Wait until it finishes...
watch -n 1 "cat /proc/mdstat"
## ------------------------------------------------------------------ ##
### 4. Hard Disk formatting
# In case of RAID, you might need to use MD instead of SD
mkfs.reiserfs /dev/sda1 # [y]
mkfs.reiserfs /dev/sda3 # [y]
mkfs.reiserfs /dev/sda4 # [y]
mkswap /dev/sda2
## ------------------------------------------------------------------ ##
### 5. Mounting the Disks
# In case of RAID, you might need to use MD instead of SD
mkdir -p /mnt/gentoo
mount /dev/sda4 /mnt/gentoo
mkdir -p /mnt/gentoo/boot
mount /dev/sda1 /mnt/gentoo/boot
mkdir -p /mnt/gentoo/tmp
mount /dev/sda3 /mnt/gentoo/tmp
swapon /dev/sda2
## ------------------------------------------------------------------ ##
### 6. Downloading the latest stage and portage:
# CRITICAL: First check that the date is correctly set (with the date command)
date --utc # check if the time is ok (otherwise, update it with date MMDDhhmmYYYY), remember it's UTC / GMT
# The URL may vary depending on the server type (i686, amd64, etc) and the date
wget http://gentoo.mirrors.tds.net/gentoo/releases/x86/current-stage3/stage3-i686-20100216.tar.bz2
tar xvjpf stage3-*.tar.bz2 -C /mnt/gentoo
rm -f stage3-*.tar.bz2
wget http://gentoo.mirrors.tds.net/gentoo/snapshots/portage-latest.tar.bz2
tar xvjpf portage-*.tar.bz2 -C /mnt/gentoo/usr
rm -f portage-*.tar.bz2
## ------------------------------------------------------------------ ##
### 7. Make setup
# The make setup is really important, it may give you extra performance to have it tunned up or less if you have it by default
# Proper setup configurations can be found here: http://en.gentoo-wiki.com/wiki/Safe_Cflags
# You can change the current Make setup here:
nano /mnt/gentoo/etc/make.conf
## ------------------------------------------------------------------ ##
### 8. Chroot enviroment
cd /
cp -L /etc/resolv.conf /mnt/gentoo/etc/
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"
## ------------------------------------------------------------------ ##
### 9. System Upgrade
# Update the repositories data
emerge --sync # you can add --quiet to avoid all output
# Select the Profile wanted
eselect profile list
eselect profile set 1 # you can choose another one if you want to
# Update portage (if needed)
emerge -Nu --oneshot portage
# Update Python (if needed)
emerge -Nu cracklib libxml2 # dependences needed
/usr/sbin/python-updater # repeat until it tells that no more packages are needed
# Update / upgrade everything
emerge -DNuv world system # check the final output, it might tell you to do some stuff
# Update Python (if needed, again)
/usr/sbin/python-updater # repeat until it tells that no more packages are needed
## ------------------------------------------------------------------ ##
### 10. New packages setup
etc-update # type -5
hash -r
source /etc/profile
export PS1="(chroot) $PS1"
grpck # type [y]
grpconv
rc-update add sshd default
nano /etc/locale.gen # uncomment the en_US locales
locale-gen
ln -sf /usr/share/zoneinfo/Etc/GMT+3 /etc/localtime # change the timezone as needed
date # check if the time is ok (otherwise, update it with date MMDDhhmmYYYY)
## ------------------------------------------------------------------ ##
### 11. Kernel Setup
# Get the latest kernel (remember the version you're installing)
USE="symlink" emerge gentoo-sources
cd /usr/src/linux
# Load the actual settings
zcat /proc/config.gz > .config
make menuconfig # you can improve it by removing stuff you don't want/need or just type [esc][esc][y][enter]
# Make...
make && make modules_install
# CRITICAL: check the version and arch installed because it may be different!
cp -L arch/x86/boot/bzImage /boot/kernel-2.6.31-gentoo-r10
## ------------------------------------------------------------------ ##
### 12. GRUB setup
emerge grub # en no-multilib utilizar "grub-static"
nano -w /boot/grub/grub.conf
# Edit the grub settings depending on the kernel version.
# grub.conf example (remove commentary #'s):
#default 0
#timeout 10
#title Gentoo Linux 2.6.31
#root (hd0,0)
#kernel /boot/kernel-2.6.31-gentoo-r10 root=/dev/sda4 panic=30
# if it's NOT a RAID install
grep -v rootfs /proc/mounts > /etc/mtab
grub-install --no-floppy /dev/sda
# if it IS a RAID install (repeat this per each hd)
grub
root (hd0,0)
setup (hd0)
quit
## ------------------------------------------------------------------ ##
### 13. Final Setup
# This files must be setup manually:
nano -w /etc/fstab # remember to use notail on the boot partition
nano -w /etc/conf.d/hostname
/etc/init.d/hostname restart
nano -w /etc/conf.d/net
rc-update add net.eth0 default
# if there's more than one eth, then make this symlink (optional)
ln -sf /etc/init.d/net.lo /etc/init.d/net.eth1
rc-update add net.eth1 default
nano -w /etc/hosts
nano -w /etc/resolv.conf
## ------------------------------------------------------------------ ##
### 14. Root password
# CRITICAL: If this is not set you won't be able to login later
passwd root
## ------------------------------------------------------------------ ##
### 15. You're done. Reboot
exit
cd
umount /mnt/gentoo/boot /mnt/gentoo/tmp /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo
swapoff /dev/sda2 # md2 in case of raid
reboot