HOWTO: Install a basic Gentoo server

If you want to install a new Gentoo server (no graphical system at all), this is the quickest way I’ve found after lots of installations :)

  • First, boot the machine with a live CD
  • create the partitions you want with fdisk/cfdisk/partition tool you like. In our example we create 3 partions (swap, /boot and /) on our disk /dev/sda
  • mkfs.ext2 /dev/sda1
    # mkswap /dev/sda2
    # mkfs.ext3 /dev/sda3
    # mkdir -p /mnt/gentoo && cd /mnt/gentoo
    # wget http://www.gtlib.gatech.edu/pub/gentoo/releases/x86/current/stages/stage3-x86-2007.0.tar.bz2
    # wget http://www.gtlib.gatech.edu/pub/gentoo/snapshots/portage-latest.tar.bz2

    Note: if you are on a different architecture, please use a different release
  • tar xvjpf stage3-*.tar.bz2
    # tar xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr
    # nano -w /mnt/gentoo/etc/make.conf
    # cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.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"
    # emerge --sync
    # cp /usr/share/zoneinfo/Europe/Paris /etc/localtime
    # USE="-doc symlink" emerge gentoo-sources
    # emerge genkernel
    # genkernel all --menuconfig
    # nano /etc/fstab
    # nano /etc/conf.d/hostname
    # nano /etc/conf.d/net
    # passwd
    # echo "tts/0" >> /etc/securetty
    # nano /etc/rc.conf
    # nano /etc/conf.d/keymaps
    # nano /etc/conf.d/clock
    # emerge syslog-ng && rc-update add syslog-ng default && emerge vixie-cron && rc-update add vixie-cron default && emerge logrotate && emerge slocate && emerge ntp && rc-update add ntpd default && rc-update add ntp-client default && modules-update
    # emerge gcc
    # emerge world
    # emerge grub
    # nano /boot/grub/grub.conf
    # grep -v rootfs /proc/mounts > /etc/mtab
    # grub-install /dev/sda
    # exit
    # cd
    # umount /mnt/gentoo/boot /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo
    # reboot

NOTES: when it’s indicated “nano $SOMEFILE” it means you have to edit and adjust the settings to your own taste.
When you are creating /etc/localtime, use a source file according to your local timezone
And here it is a basic make.conf configuration:

CFLAGS="-O2 -march=i686 -pipe"
CHOST="i686-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"

USE=”-X -qt -gtk -gnome -kde bash-completion -snmp sockets threads latin1 -berkdb -ipv6 snmp perl”

PORTDIR_OVERLAY=”/usr/local/portage”