Gentoo on ServerBeach - A Step by Step Guide
By Fernando M. Honig
Note: This guide was tested on Dell PowerEdge 430-1 Server.
- Create the partitions
# fdisk /dev/sda
-Delete all partitions on disk.
-Make new partitions likely with this schema.
/dev/sda1 - 100MB
/dev/sda2 - 1024MB
/dev/sda3 - 50GB
/dev/sda4 - rest of disk
- Create the file systems and activate swap
# mke2fs /dev/sda1
# mke2fs -j /dev/sda3
# mke2fs -j /dev/sda4
# mkswap /dev/sda2
- Mount the file systems
# mkdir /mnt/gentoo
# mount /dev/sda3 /mnt/gentoo
# mkdir /mnt/gentoo/boot
# mount /dev/sda1 /mnt/gentoo/boot
# mkdir /mnt/gentoo/var
# mount /dev/sda4 /mnt/gentoo/var
- Set the date and UTC time
# date 021116152007 (Format is MMDDhhmmYYYY)
- Download a bzip2 statically linked executable.
# cd /mnt/gentoo
# wget http://www.bzip.org/1.0.4/bzip2-104-x86-linux24
Rename it
# mv bzip2-104-x86-linux24 bzip2
# chmod 0777 bzip2
- Download a stage3 archive (deppend of which server you ordered)
# wget http://gentoo.osuosl.org/releases/x86/current/stages/stage3-x86-2006.1.tar.bz2
or
# wget http://gentoo.osuosl.org/releases/amd64/current/stages/stage3-amd64-2006.1.tar.bz2
- Unpack the stage3 archive
# /mnt/gentoo/bzip2 -d stage3*
# time tar xpf stage3*
- Download the latest Portage snapshot
# cd /mnt/gentoo/usr
# wget http://gentoo.osuosl.org/snapshots/portage-latest.tar.bz2
# /mnt/gentoo/bzip2 -d portage*
# time tar xf portage*
- Chroot
# cd /
# mount -t proc proc /mnt/gentoo/proc
# cp -L /etc/resolv.conf /mnt/gentoo/etc/
# ifconfig (take a look of your IP address and netmask)
# route -n (take a look of your Gateway)
# chroot /mnt/gentoo /bin/bash
# env-update && source /etc/profile
- Copy your timezone file
# cp /usr/share/zoneinfo/US/Eastern /etc/localtime
- Set host and domain name
# cd /etc
# echo "127.0.0.1 mybox.at.myplace mybox localhost" > hosts
# sed -i -e 's/HOSTNAME.*/HOSTNAME="mybox"/' conf.d/hostname
# hostname mybox
# hostname -f
- Install a kernel source, compile it and install the kernel
# time emerge gentoo-sources
# cd /usr/src/linux
-Next command is to know which hardware has this server.
# dmesg
# make menuconfig
(You must know that you have to support all hardware listed before and install support for ext2, ext3, Intel Corporation 82801GB/GR/GH (ICH7 Family) Serial ATA Storage Controller, Broadcom Corporation NetXtreme BCM5751 Gigabit Ethernet)
# time make -j2
# make modules_install
# cp arch/i386/boot/bzImage /boot/kernel
- Configure the system
Edit your /etc/fstab and replace BOOT, ROOT and SWAP with the actual partition names.
# cd /etc
# nano -w fstab
Copy & Paste this.
/dev/sda1 /boot ext2 noauto,noatime 1 2
/dev/sda2 none swap sw 0 0
/dev/sda3 / ext3 noatime 0 1
/dev/sda4 /var ext3 noatime 0 1
- Configure networking (Please put the IP Address correctly, to know the IP, execute ifconfig eth0)
# cd conf.d
# echo 'config_eth0=( "111.222.333.444/24" )' >> net
# echo 'routes_eth0=( "default via 111.222.333.444" )' >> net
# rc-update add net.eth0 default
# rc-update add sshd default
- Set the root password
# passwd
- Optional: edit clock config file
Change UTC for local, as the way the time is updated.
# nano -w /etc/conf.d/clock
- Install a syslogger and a cron daemon
# time emerge syslog-ng vixie-cron
# rc-update add syslog-ng default
# rc-update add vixie-cron default
- Configuring the Bootloader
Emerge grub and edit its configuration file
# time emerge grub
# nano -w /boot/grub/grub.conf
Example grub.conf
default 0
timeout 10
title=Gentoo for ServerBeach
root (hd0,0)
kernel /boot/kernel root=/dev/sda3
- Install grub
# grub
grub> root (hd0,0)
grub> setup (hd0)
grub> quit
- Reboot
Exit the chrooted environment, unmount all file systems and reboot:
# exit
#umount /mnt/gentoo/proc /mnt/gentoo/boot /mnt/gentoo/var /mnt/gentoo
# shutdown -r now
After reboot, you should can login and emerge all necesary files to build a standard system.
- Finishing the install
# emerge mirrorselect
# mirrorselect -i -o >> /etc/make.conf (select one of the list)
# mirrorselect -i -r -o >> /etc/make.conf (select one of the list)
# echo 'MAKEOPTS="-j2"' >> /etc/make.conf (number of cpu + 1)
# emerge -vpe world
# echo 'USE="-X nptl nptlonly -ipv6 -fortran"' >> /etc/make.conf
# cd /etc
# nano -w make.conf
Add this line
FEATURES="parallel-fetch ccache"
# emerge ccache
# emerge portage
# emerge world
Sources:
http://www.gentoo.org
http://es.gentoo-wiki.com/