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”

Advertisements

7 thoughts on “HOWTO: Install a basic Gentoo server

  1. As far as all your emerges go you could just “emerge prog1 prog2 prog3 …”
    save even more time by typing less :-)

  2. # 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

    I don’t understand what you are trying to achieve here. I’m assuming you would like to recompile everything because you upgraded gcc.

    That would be the first thing I would emerge so I wouldn’t have to recompile things twice.

    I would use:
    emerge gcc && emerge -e system && emerge -e world && emerge syslog-ng vixie-cron logrotate slocate ntp grub && modules-update && rc-update add {ntpd, ntp-client, syslog-ng, vixie-cron} default

    Hope it saves someone some time. ;-)

  3. I’m having trouble with Atheros AR8121 Ethernet driver for installation, seems ar8121 / atl1e isn’t under the current kernel mainline ? now how?

  4. Hi, first line… sda1 does not exist only sda.
    How do I create sda1? Seems like you missed that step?

    Thanks..

  5. This needs to be removed it will lead people astray.

    For starters you do not even mount the drives…..this will never work….horrible.

    • hey hey hey, be cool :) First of all, this post dates back to 2007, and I can guarantee you that it worked with 2006/2007 Gentoo (this was the last year I used Gentoo as server, I migrated to Debian and I’m an happier sysadmin now). Second, the mount directives are absent, you are right, probably got lost in some edit (wordpress editor in these days was a little tricky with html preview).

      I’m not gonna delete this post anyway, for historical sake and cause it’s my personal blog, anyway I admit thta nowadays it doesn’t work.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s