Installing Gentoo 1/?: Preparing disks
Status: In Progress

Why?

After years of using Ubuntu (2014-2018), my C/C++ up-bringing has forced me to seek a more minimal and optimized Distro. I've switched to Arch and never looked back since. The package manager and the dependencies issues after each pacman -S ? made me rethink my life choices. So I decided to try Gentoo. This is not for Linux beginners

Installation Medium

You might need to sudo for some commands to work. It's up to you to figure it out.

  • Live USB key: download the desired ISO and dd to the usb key (lsblk to find the device)
# /dev/sdc not /dev/sdc1
dd if=install-amd64-minimal-{some date}.iso of=/dev/sdc bs=8192k

Wi-Fi set-up

  • After booting the key, you need to connect to Wi-Fi (PSK key) by running:
# get the wifi device, wlp170s0 in my case
ifconfig 
# activate the interface
ip link set dev wlp170s0 up
  • You can nano or vi the file /etc/wpa_supplicant/wifi.conf and add:
ctrl_interface=/run/wpa_supplicant
update_config=1
  • Then append it with the SSID and the hex-ed password:
# The password is saved as a hex 
wpa_passphrase your_ssid your_password >> /etc/wpa_supplicant/wifi.conf
# connect using the creds
wpa_supplicant -B -i wlp170s0 -c /etc/wpa_supplicant/wifi.conf
# simple ping to check
ping google.com
if you find this difficult or exhausting, you should probably give up and try an easier linux distro... I used to use Arch btw :D.

With that being said, now that you have network access, I'll provide some helping scripts when possible.

Partitions preparation

I have a 1TB drive. I'll split it to a 50% linux partition. My ultimate plan is to have a Windows partition via Qemu. So if you plan to dual-boot Linux/Win, this guide is will not cover it.

To display the current partitions you can use fdisk -l or lsblk. My drive is /dev/nvme0n1.

  • Use fdisk tool to clear and create a new partition
fdisk /dev/nvme0n1
# p: print table, d: delete partition
# use g to clear it all.

Partitions:

My plan:

partition size goal fdisk sequence filesystem
/dev/nvme0n1p1 ~ 512MB EFI boot n -> Enter x 2 -> +512M -> t -> 1 for EFI vfat
/dev/nvme0n1p2 ~ 32GB swap 19 for swap swap
/dev/nvme0n1p3 ~ 500GB linux system root no need to specify the type here ext4

I'll decide what to do with remaining space later. Press w to write the changes.

  • Apply the filesystem
mkfs.vfat -F 32 /dev/nvme0n1p1
mkfs.ext4 /dev/nvme0n1p3
mkswap /dev/nvme0n1p2
swapon /dev/nvme0n1p2 # start swapping, used when RAM is exhausted

Mounting Gentoo

My root partition is /dev/nvme0n1p3.Let's mount it:

mkdir -p /mnt/gentoo # -p to create parents if needed
mount /dev/nvme0n1p3 /mnt/gentoo/

Output of lsblk:

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0         7:0    0 423.5M  1 loop /mnt/livecd
sda           8:0    1   7.5G  0 disk /mnt/cdrom
├─sda1        8:1    1   246K  0 part 
├─sda2        8:2    1   2.8M  0 part 
├─sda3        8:3    1   462M  0 part 
└─sda4        8:4    1   300K  0 part 
nvme0n1     259:0    0 953.9G  0 disk 
├─nvme0n1p1 259:1    0   512M  0 part 
├─nvme0n1p2 259:2    0    32G  0 part [SWAP]
└─nvme0n1p3 259:3    0   500G  0 part /mnt/gentoo