User:Monsieurp/Gentoo Quick Installation Guide

From Gentoo Wiki
Jump to:navigation Jump to:search

I'm assuming Gentoo is to be installed on /dev/sda and that the disk is blank. Also, I'm assuming you've managed to boot Gentoo off of a USB stick or something of the like and you're at the prompt, trying to figure out what to do next.

To begin with, let's lay out our partition schema:

  • 512 MB allocated for the EFI files
  • 8 GB allocated for the swap
  • the remaining space allocated for the system
root #parted /dev/sda mklabel gpt
root #parted /dev/sda mkpart ESP fat32 1MiB 512MiB
root #parted /dev/sda set 1 boot on
root #parted /dev/sda mkpart primary linux-swap 512MiB 8704MiB
root #parted /dev/sda mkpart primary ext4 8704MiB 100%
root #parted /dev/sda print

Now let's format each partition:

root #mkfs.vfat -F 32 /dev/sda1
root #mkswap /dev/sda2
root #mkfs.ext4 /dev/sda3
root #swapon /dev/sda2

We must now prepare the folders in which partitions are to be mounted:

root #mkdir -p /mnt/gentoo
root #mount /dev/sda3 /mnt/gentoo
root #mkdir -p /mnt/gentoo/boot
root #mount /dev/sda1 /mnt/gentoo/boot

Let's fetch stage3:

root #latest_stage3=$(curl http://distfiles.gentoo.org/releases/amd64/autobuilds/latest-stage3.txt 2>/dev/null {{|}} awk '$0 !~ /^#/ { print $1; exit; }')
root #wget "${url}"
root #tar xvjpf stage3* -C /mnt/gentoo

Bind mount /dev, /proc and /sys:

root #mount -t proc none proc
root #mount --rbind /sys sys
root #mount --make-rslave sys
root #mount --rbind /dev dev
root #mount --make-rslave dev

Copy /etc/resolv.conf and chroot in your new system:

root #cp -L /etc/resolv.conf /mnt/gentoo/etc
root #chroot /mnt/gentoo /bin/bash
root #source /etc/profile

The installation can be resumed from there: https://wiki.gentoo.org/wiki/Quick_Installation_Checklist#Portage