Gentoo Quick Install Guide AMD64 / x86

This guide is derived from the official Gentoo Quick Install Guide located at Gentoo.org, however the official guide appears to be out of date have been removed.. I have decided to write an, unofficial, up-to-date guide.

Setup your network

Check network interface configuration to find out the name of your device (typically enp2s0 or enp3s0) using the ifconfig command, and set it up.

Attempt automatic network configuration

net-setup enp3s0

Manual network configuration

ifconfig enp2s0 192.168.1.2/24
route add default gw 192.168.1.1
echo 'nameserver 192.168.1.1' > /etc/resolv.conf

SSHd

If you would like to take over the installation over your network, you can start the sshd & set the root password now, and then follow then rest of the installation steps over SSH.

/etc/init.d/sshd start
passwd

Prepare your disk(s)

Partition Disk(s)

You will need to use the command line tool, fdisk, to partition your disk, press m in fdisk for help.

fdisk /dev/sda #Partition your disks
fdisk -l /dev/sda #Check your partition table

When partitioning your disk, you should be sure to have at least a 150MB boot partition (Typically setup on /dev/sda1), a swap partition twice the size of your max memory (no more than 4GB recommended, typically on /dev/sda2), and your third partition (/dev/sda3) should be created with the remaining free space. After your disk is partitioned, we need to create the file systems.

Create file systems and swap

mkfs.ext2 /dev/sda1 #Setup a non-journaling file system for /boot.
mkswap /dev/sda2 && swapon /dev/sda2 #Create and mount swap
mkfs.ext4 /dev/sda3 #Create journaling file system for /.

Mount the file system(s)

Our next step is to mount & extract the stage 3 to our new filesystem

mount /dev/sda3 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/sda1 /mnt/gentoo/boot
cd /mnt/gentoo
wget ftp://distfiles.gentoo.org/.2/gentoo/releases/amd64/autobuilds/20141204/stage3-amd64-20141204.tar.bz2 #Make sure you get the current stage3 for your architecture
tar -xjpf stage3*.tar.bz2

Once your files are extracted, be sure that your ‘date’ command returns the correct UTC time, and if not fix it to match the correct UTC time (# date MMDDhhmmYYYY), after that is sorted we can chroot into our environment. If you are SSH’d into the system at this point, it is best to start a session in screen before you chroot.

cd /
mount -t proc proc /mnt/gentoo/proc
mount --rbind /dev /mnt/gentoo/dev
mount --rbind /sys /mnt/gentoo/sys
cp -L /etc/resolv.conf /mnt/gentoo/etc/
chroot /mnt/gentoo /bin/bash
source /etc/profile

Prepare the Stage

Install the current portage snapshot

mkdir /usr/portage
emerge-webrsync

Set your Timezone

ls /usr/share/zoneinfo #Using America/Chicago as example
 cp /usr/share/zoneinfo/America/Chicago /etc/localtime
 echo "America/Chicago" > /etc/timezone
 date #check that the date is correct, else fix it

Select & Set System Profile

eselect profile list

Example output:

# eselect profile list
Available profile symlink targets:
 [1] default/linux/amd64/13.0
 [2] default/linux/amd64/13.0/selinux
 [3] default/linux/amd64/13.0/desktop
 [4] default/linux/amd64/13.0/desktop/gnome
 [5] default/linux/amd64/13.0/desktop/gnome/systemd
 [6] default/linux/amd64/13.0/desktop/kde
 [7] default/linux/amd64/13.0/desktop/kde/systemd
 [8] default/linux/amd64/13.0/developer

Select your profile (your default USE flags are determined based on the profile that you set).

eselect profile set 1 #This would select "default/linux/amd64/13.0"

Set Hostname

Your machine needs a name, or may be part of a domain, here you will get a chance to set that up 🙂

cd /etc
echo "127.0.0.1 nachos.tacos.intra nachos localhost" > hosts #replacing nachos with your machine name and tacos.intra with your actual domain (if you have one) of course.
sed -i -e 's/hostname.*/hostname="nachos"/' conf.d/hostname
hostname nachos
hostname -f #verify hostname is correct

Configure the Kernel

You could manually go in and make your kernel & initramfs, however I prefer to go the genkernel route. If you are comfortable with default kernel configuration you can just immediately exit the menuconfig on the genkernel step and skip right to building your kernel.

emerge -av gentoo-sources genkernel #replace gentoo-sources w/ hardened-sources if you selected a hardened profile.
genkernel --menuconfig all

It will take some time to build your kernel & modules, go ahead and grab a cup of coffee.

Boot configuration

/etc/fstab

nano -w /etc/fstab #edit the fstab file
cat /etc/fstab #your fstab should look something like this:
/dev/sda1   /boot   ext2   noauto,noatime   1  2
/dev/sda3   /       ext4   noatime          0  1
/dev/sda2   none    swap   sw               0  0

Grub2

Gentoo has made grub2 default for installation, it’s alot easier to setup than you might think.

emerge -av grub #if you are dual booting with Windows be sure to also install sys-boot/os-prober and sys-fs/ntfs3g
grub2-install /dev/sda #Install to master boot record of first disk
grub2-mkconfig -o /boot/grub/grub.cfg # Make grub configuration

Finish Base Installation

Merge Startup Packages

You’ll probably want some of the core packages such as a DHCP client, cron daemon, and system logging daemon. Here’s a good starter kit

emerge -av dhcpcd syslog-ng vixie-cron ntp superadduser
rc-update add dhcpcd default
rc-update add syslog-ng default
rc-update add vixie-cron default
rc-update add ntp-client default

Set Passwords

Now is a good time to add users and change your root password before you reboot into your new system.

passwd #change root password
superadduser username #replace username with your desired username, follow steps. You probably want your first user in the groups wheel, cron and portage.

You should be safe to reboot & install the rest of your systems packages now. 🙂

Noticed an error in this article? Please contact me with any errors.

Copyright©2011 - 2018, Robert Whitney; All rights reserved.