# Disk Preparation 1. Determine disk name `# lsblk` 2. Launch parted `# parted -a optimal /dev/sda` 3. Erase everything `mklabel gpt` 4. Make partitions ``` unit mib mkpart primary 1 129 name 1 boot mkpart primary 129 4225 name 2 swap mkpart primary 4225 -1 name 3 rootfs set 1 boot on print ``` 5. Create filesystems ``` # mkfs.fat -F 32 /dev/sda1 # mkfs.ext4 /dev/sda3 # mkswap /dev/sda2 # swapon /dev/sda2 ``` 6. Mount root partition ``` # mkdir -p /mnt/gentoo # mount /dev/sda3 /mnt/gentoo # cd /mnt/gentoo ``` # Installing Stage 3 1. Check that date is correct. See [here](https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Stage) if it's wrong. `# date` 2. Download tarball a. Find download link from: https://www.gentoo.org/downloads b. `# wget ` 3. Validate tarball ``` # wget .DIGESTS # openssl dgst -r -sha512 stage3-.tar.xz ``` Ensure a pair of the numbers above match 4. Unpack `# tar xpf stage3-.tar.xz --xattrs-include='*.*' --numeric-owner` 5. Configure options `# nano -w /mnt/gentoo/etc/portage/make.conf` For XPS 8500, add the following: ``` CHOST="x86_64-pc-linux-gnu" CFLAGS="-march=native" CFLAGS="${CFLAGS} -O2 -pipe" CXXFLAGS="${CFLAGS}" MAKEOPTS="-j8" INPUT_DEVICES="evdev" VIDEO_CARDS="nvidia" USE="X bluetooth dbus pulseaudio savedconfig xinerama zsh-completion" PYTHON_TARGETS="python2_7 python3_6" PYTHON_SINGLE_TARGET="python3_6" GRUB_PLATFORMS="efi-64" ``` # Installing the Gentoo base system 1. Add mirrors `# mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf` or, if mirrorselect isn't available, add this to the bottom of /etc/portage/make.conf: `GENTOO_MIRRORS="http://lug.mtu.edu/gentoo/ http://mirrors.evowise.com/gentoo/"` 2. Repo config ``` # mkdir -p /mnt/gentoo/etc/portage/repos.conf # cp /mnt/gentoo/usr/share/portage/config/repos.conf /mnt/gentoo/etc/portage/repos.conf/gentoo.conf ``` 3. Copy DNS info `# cp --dereference /etc/resolv.conf /mnt/gentoo/etc/` 4 Mount filesystems ``` # mount --types proc /proc /mnt/gentoo/proc/ # mount --rbind /sys /mnt/gentoo/sys/ # mount --rbind /dev /mnt/gentoo/dev/ # test -L /dev/shm/ && rm /dev/shm/ && mkdir /dev/shm/ # mount --types tmpfs --options nosuid,nodev,noexec shm /dev/shm # chmod 1777 /dev/shm/ ``` 5. Enter the new environment ``` # chroot /mnt/gentoo /bin/bash # source /etc/profile # export PS1="(chroot) ${PS1}" ``` 6. Mount boot `# mount /dev/sda1 /boot/` 7. Update the ebuild repo `# emerge --sync` 8. Select the right profile [16] default/linux/amd64/17.0/desktop (stable) ``` # eselect profile list # eselect profile set 16 ``` 9. Update the @world set `# emerge -auvDN @world` # Configure the base system 1. Set the timezone `# `