Yet Another Gentoo Installation Guide
30 Nov 2020My Dearest Mad-Watchers,
As I was recently suggested by one of my YouTube subscriber, I would like to explain how to install Gentoo. To get some more information regarding my Gentoo adventures, check out my other blog posts about Gentoo. You can also follow along with the Gentoo official documentation.
2 Disclaimers
For this guide, I will assume that all of you intend to work with a stage 3 tarball. If you wish to install Gentoo from a stage 1 or 2, this guide is not meant for you, since I consider you are in no need of my help at the level you have reached.
I know I said earlier I would do everything in a virtual machine. However, this guide has been ready for more than a week and I figured it would not be fair to all of you to make you wait for a video or several videos which may not even be as good as some others which you will easily find on YouTube. Installing a distribution is fun, but it has been seen so many times already... I am not saying I will never install another distribution on camera or shoot videos about installing Gentoo. At the moment however, not only does it not feel right but I should not make you wait any longer.
Outline Of The Installation :
- BIOS settings : Legacy mode enabled + CSM support
- Burning the ISO
- Booting into the live CD
- Setting keyboard, language, partition scheme
- Turning on the internet
- Downloading and extracting the stage 3 tarball
- Copying /proc & /dev & /sys into /mnt/gentoo & mounting your partitions
- Entering the chroot environment
- Setting up /etc/fstab & kernel
- Installing essential programs : vim (cause vi sucks), network manager, other...
- Installing GRUB or another bootloader
- Reboot & pray
The Right First Step
When leaving on a trip, the right first step is to properly prepare. This means packing your bag as thoroughly as possible and anticipating potential issues you might have. Well, when preparing for your Gentoo excursion, I recommend you do several things:
- Read the documentation of your targeted distribution. In our case, it is most important you do not skip this bit, since Gentoo's wiki is so vast.
- Rehearse in a Virtual Machine: I seriously recommend this. You should be much more confident and relaxed when you perform the actual install later on if you are already familiar with its intricacies.
- Back up your home directory on an external hard-drive : this makes it much faster when the install is over to just copy and paste it onto your newly-installed system. If you have a separate /home partition, you may wish to skip this step.
- Configure your BIOS: If you can, I recommend you enable both UEFI and Legacy mode. This way you will not have any issues with the one or the other. Also, enable CSM support. Do not forget to configure the boot order so that your new Gentoo system takes precedence over your already-installed operating system.
- Download the ISO image which interests you and create a live CD of Gentoo.
These steps are always the same, for any distribution you would install. If you are not familiar with them, Gentoo probably is not the right distribution for you, since you might lack experience with Linux. If you feel ready, however, it is time to get out the door and discover other lands which will blow your mind.
Although, I would add up one last step only for Gentoo. Download the stage 3 tarball and save it on an external hard-drive before beginning the installation. This will avoid any insecure move like downloading it as root from elinks later on, and you will not have to worry about creating another user before the very end of the installation process. Plus, it will also save you time. Downloading the tarball can take some time (generally a few minutes depending on your internet connection), hence you will not have to wait.
The Journey Begins
You have plugged in your USB flash-drive, rebooted your computer, and landed into Gentoo? Good for you! You are now withing the realm of the live CD. Congratulations are in order!
Some troubleshooting :
- If you have not yet managed to get into the live CD, repeat the lines listed in the right first step : If using a USB installer, the problem is more likely to come from your BIOS setting;. If using the dd command, you may want to check out this link.
The first things to do within the live CD are :
- Setting up your keyboard layout. The default one is US (without dead keys), which I would advise most of you to keep, at least for now. It is rather straightforward to set it later, especially with this page. For those of you who would follow my advice, just press enter. Same for language configuration, keep the default.
- Turning on the internet...
Turning On The Internet
As all things are, this is extremely easy. However, you can also easily get lost in the vastness of Gentoo's documentation and overlook the simplicity of turning on the Wi-Fi, so I will come to your aid.
Just in case some magic would be happening, you might check out if you already are connected with :
- ping gentoo.org
I insist you run this previous command, especially if you are following along in a VM, because it is most likely you will already have an ethernet connection up and running.
For those of you who actually are getting your hands dirty, you have several tools at your disposal. To automatically detect available networks, you may use ifconfig, or the ip command. Below are some other alternatives :
- net-setup
- wpa_supplicant
- PPP
- PPTP
- DHCP
- Manual network configuration
The easiest way is to use the net-setup script, which we will do here. When you first install a distribution such as Gentoo, you want to be nice with yourself and not do too many things manually. Give yourself time to familiarize yourself with this new environment. net-setup will automatically detect available networks (wi-fi, ethernet...) and let you choose one. Then there will not be much left apart from entering a password...
Setting Your Partition Scheme
If you already have experience manually installing other distributions, such as Arch Linux, this step should be a walk in the park. Several programs are at your disposition :
- fdisk or cfdisk
- parted
I am more comfortable with cfdisk, so this is the one I will present in this guide. It is very straightforward, so I strongly recommend it. I will also assume that you are partitioning /dev/sda.
If you have existing partitions, such as /home or /boot/efi, it is up to you to delete them or not. When installing Gentoo, a man should know what he is doing. If there is no existing partitions or you have already deleted all of them, here is the scheme I would like to suggest you try out :
- Device Size Type
- /dev/sda1 512M EFI System
- /dev/sda2 4G Linux swap
- /dev/sda3 184G Linux filesystem
- /dev/sda4 50G Linux filesystem
If you wish to only have a /root partition, or a /root partition and a /boot partition, these schemes work fine too. I am merely suggesting what I consider the best option. If you wish to hibernate your computer, you need a SWAP partition. The general rule is that it should take twice the size of your RAM. However, this may prove difficult nowadays since modern computers sometimes have a tremendous amount of RAM and it would take up the entire hard-disk to follow this rule. In my opinion, the amount of RAM you should set is really up to you. You should only keep a few things in mind, regarding why you would need a SWAP partition:
- Does your system have less than 1GB of RAM? If so, most applications will exhaust the whole amount of RAM very quickly. Hence you need SWAP.
- If you intend to run resource-heavy applications like games, video-editors, or just compile everything from source whenever you update your system, having a bit of SWAP will prevent your computer from crashing when using up too much RAM.
- For hibernation, the SWAP should be at the very least the size of your RAM, because the content of the RAM will be written in the SWAP.
Regarding the SWAP partition, I would just like to add a word of warning. Don't expect it to simply be more RAM. Swapping too much can seriously slow down your applications. It will prevent them from crashing but it will not make your computer more efficient.
Separating /root and /home is useful too, especially if you wish to tweak your scheme later on or entirely change your distribution. In that case, you would only need to erase the content on /root without touching /home and doing any back-up, which I find quite convenient.
Finally, and this is the last warning, do put /root as /dev/sda4 or as the last partition in your scheme. Otherwise you will not be able to modify it later. If it is last, and /home the penultimate, you can remove it later and even resize /home when /root is gone. So, do not neglect this, or use LVM (Logical Volume Management).
In cfdisk, you only need to select available space and create a new partition on it. You give it a size in M or G (T if you have that luxury) : 4G for SWAP, for instance, and then you are done. You then do the same for all other partitions. When all partitions are created, you only need to give them a type. For /root or /home, you want Linux filesystem. For /boot you want EFI system (only if you need a /boot partition, that is) and, finally, your swap should be of the Linux swap type.
When you are done, you need to apply a filesystem to your partitions :
- mkfs.ext4 /dev/sda3
- mkfs.ext4 /dev/sda4
- mkswap /dev/sda2
- swapon /dev/sda2
Do prefer a ext4 filesystem for your /root and /home partitions. Plus, do not forget to activate your swap partition. For you /boot partition, you may prefer an ext2 filesystem.
The only thing left at present is to mount /root :
- mount /dev/sda4 /mnt/gentoo
Extracting the Stage 3 Tarball
Before going farther, you should set the date, just so that it is done and out of your way. You may use the date command with this format : MMDDhhmmYYYY
(Month, Day, hour, minute and Year). I do not advise you to use any other automatic tool such as ntpd since it comes with a price and manually setting the time is a walk in the park, seriously.
As I stated earlier, I recommend not to download the tarball during the installation itself, but prior. If you have followed this piece of advice, then you merely need to plug in your hard drive and copy-paste the previously-acquired tarball from your external drive to your local machine (in /mnt/gentoo) :
- mkdir /mnt/external-drive
- mount /dev/$device-name /mnt/external-drive
- cp -rv /mnt/external-drive/$tarball-location/$downloaded-tarball /mnt/gentoo
external-drive being the name your external drive
If you had not downloaded your tarball earlier, it is time to do it. Preferably, create another user in order to browse the internet more safely. Then cd into /mnt/gentoo and use elinks and wget which is available by default to download it from this web page. If you wish to verify what you downloaded, follow the instructions from this link.
Finally, extract the content of the tarball with this command :
- tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner
Make sure you use the same options as in the Gentoo installation guide or you might have issues (such as permissions issues) which would might make you waste a whole lot of time for nothing.
As another quick warning, I should tell you to beware which tarball you pick, since it will shape your whole system.
Before moving on to the next step, you may also configure the compile options but I would tell you to stick to the defaults for now. Focus on the installation and optimize your system later. Otherwise it is most likely you will not come through...
Entering Chroot Environment
Alright fellows! It is time to install the Gentoo base system. Congratulations if you have survived up until this point.
First off, select your mirror with : mirrorselect. It is an optional step but... Just do it, okay? You did it on Arch, and you are not switching to Gentoo to simplify your life. You want more choices, so make the effort to choose! Everything is explained better than anywhere else on the web right here, at the top of the page.
Before chrooting, you need to do two last things :
- Copy your DNS info : cp --dereference /etc/resolv.conf /mnt/gentoo/etc/
- Mount the necessary filesystems /proc, /sys, and /dev:
- mount --types proc /proc /mnt/gentoo/proc
- mount --rbind /sys /mnt/gentoo/sys
- mount --rbind /dev /mnt/gentoo/dev
You may now chroot :
chroot /mnt/gentoo /bin/bash
- s
ource /etc/profile
export PS1="(chroot) ${PS1}"
Plus mount the boot partition :
- mount /dev/sda1 /boot
Configuring Portage
Portage is your brand new best friend, your shiny package manager. To configure it, you have to run a few commands :
- emerge-webrsync : fetch the latest snapshot of the Gentoo ebuild repository.
- emerge --sync : this one is optional but you should do it, I believe. It will not take so much more time, and thus your ebuild repository will be up to date.
Choosing A Profile
Run the command eselect profile list and that will list all available profiles. If it is the first time you install Gentoo, do not pick a fancy one. Do not be too minimalist, for instance, you it is most likely you will have an awful time with the rest of the installation process. I speak from experience. I kept the default profile default/linux/amd64/17.0 * and had to switch to default/linux/amd64/17.0/desktop about a day later because I could not install anything I wanted easily. By the way, these profiles are now : '17.1', not '17.0'. If you intend to install something as bloat as gnome or kde, go ahead and choose the appropriate profiles with kde or gnome in the name. I am not sure I can still talk to you if you decide to go down that path, but... well... La vita è così, apparently.
The command to pick a profile :
- eselect profile set [number]
Now that all this is behind you, you may run this command to update your @world set :
- emerge --ask --verbose --update --deep --newuse @world
The USE Variable
As I am writing this, it is still a topic with which I am not 100% comfortable, since it is quite subtle to get and work with on a daily basis. Use flags are probably the biggest change from an Arch system and what will require the most getting-used-to from you. You can globally activate or deactivate them from your /etc/portage/make.conf file and also locally set them for one single program in /etc/package.use/. Beware, you will need to configure the USE variable differently depending on which profile you have chosen. I speak mostly for KDE and Gnome users, but you should not have to worry since everything is explained really well on this page of the Gentoo documentation.
If you run this command :
- emerge --info | grep ^USE
That above command will show you which use flags are currently active on your system. Down below is a screenshot of the output you should get.

My Opinion On Systemd
I am not against systemd. I used it for a long time, first on Mint and then on Manjaro and Arch and really appreciated its simplicity. However there are many other init systems and I am deeply convinced you should run openrc when installing Gentoo. Otherwise just stick to Arch Linux, you will not see a difference. When switching to Gentoo, you need to be willing to try something else, to open your horizons to a myriad of new possibilities. Openrc is brilliant, so just check out this cheat sheet and adopt it! Seize this opportunity to remove the bloatness of systemd from your computer.
Timezone & Locale
For this step, there are only a few commands to copy and paste from the official guide and into your TTY. I was not certain whether it was actually necessary to add them down here but I figured... you know, I am writing a guide, so I better do it properly. Right?
- ls /usr/share/zoneinfo
- echo "Europe/Brussels" > /etc/timezone
emerge --config sys-libs/timezone-data
With the first command, you will check out which zones are available in /usr/share/zoneinfo. With the second, you will echo into a file the timezone which interests you. Care to replace 'Europe/Brussels' with the timezone you wish to set for your system. Finally you just need to reconfigure the timezone-data package with an emerge command. Piece of cake, right?
Before moving on to configuring your kernel, do select and generate a locale :
- vim /etc/locale.gen : add whatever configuration you want.
- locale-gen
Here is my /etc/locale.gen in case you would need an example.

In case you would like to copy-paste:
- en_US ISO-8859-1
- en_US.UTF-8 UTF-8
Then do the same with eselect to configure your system-wide locale settings.
- eselect locale list
- eselect locale set $number-of-locale-you-want
- Reload the environment with the following command : env-update && source /etc/profile && export PS1="(chroot) ${PS1}"
Configure Your Kernel
This is probably the one step when you want to be reasonable and do something simple. In this guide, I will not make you do anything such as configuring your kernel manually. That would be torture and I am not so cruel. When I first installed Gentoo a few weeks ago, I did not go through that ordeal, and I seriously recommend you do not force yourself to do it. If it is your second or third time installing Gentoo, you have the experience required and that piece of advice do not apply to you. But if it is the first time, beware!
Since we have decided to keep with the default (because the goal is to reach the end of the installation, not to show off), we will run the following commands in our terminal :
- emerge --ask sys-kernel/gentoo-sources : this will be the source of our kernel with emerge.
- emerge --ask sys-kernel/genkernel : this will install genkernel, the program we need to automatically build our kernel.
You also need to be mindful of this bit in the official installation guide. Except you should use vi instead of nano, if you have any taste...
- vi /etc/fstab

- genkernel all
- ls /boot/vmlinu* /boot/initramfs* : run this when the previous command has finished to check if the kernel has been generated correctly.
I would not say you need to configure the kernel modules since it is presented as an optional step in the official documentation and I didn't do it when I installed Gentoo (and everything works perfectly). However, I do recommend you run the following command to install the linux firmware :
- emerge --ask sys-kernel/linux-firmware
Finish Configuring Your System
If you have reached this point in the installation, you must have a lot faith, and I must say you are almost through! I am saying almost because some funny business is still possible. Actually, the installation is just some sort of rite of passage. Your whole experience with Gentoo might expose you to funny business... If you have never written /etc/fstab by hand, for instance, I am here to tell you that you can survive this last challenge. It is a huge pain, but it is possible (proof is, so many people have done it, right?)
/etc/fstab
Gentoo's official guide and the arch-wiki are your best friends to complete this challenge. You may also check the result of the man command. I added a screenshot below so that you have an example :

Here is also mine :

Warning : Do not just copy the examples above! Remember the partition scheme you used and simply put it here. All your mounted partitions should appear in your /etc/fstab. To get the UUIDs (partition labels), you can use the blkid command, like so :
- sudo blkid /dev/sdaX
Grub2
Beware, this is supposed to be easy but if you do not do this bit properly, your system will not boot. I could have presented another boot loader, such as systemd's, lilo, or syslinux, but for obvious reasons I will not.
- emerge --ask --verbose sys-boot/grub:2
- Warning : Some commands vary if you use UEFI or not.
emerge --ask --update --newuse --verbose sys-boot/grub:2
- BIOS : grub-install /dev/sda
- UEFI : grub-install --target=x86_64-efi --efi-directory=/boot
root & users
Do not forget to set the root password & do create a user account for daily use. Since you are installing Gentoo, I will consider you are advanced users and already know commands such as passwd, useradd, usermod. Now that you know the words, I am certain you will not be against a bit of DIY, right?
Networking Information
- vim /etc/conf.d/hostname : Set a name for your computer. Any name. All characters should be lower case.
- emerge --ask --noreplace net-misc/netifrc
- vim /etc/hosts : Exhibit A below.

Install Essential Packages
Some programs can obviously wait until you reboot, like LibreOffice, but there is no harm in doing it directly from the chroot environment. Especially if you do it the smart way and install all these programs at night. Anyway, I merely intended to give you a non-exhaustive list of useful programs.
If you wish to install brave as your main browser, you will not be able to do so before setting up an overlay, which roughly is the equivalent of the AUR for Arch users. By the way, I am not certain I still want to recommend brave as a main browser. There is a lot of controversy around it and I honestly am rather confused.
- Network manager : Takes hours to compile but it is worth it.
- Firefox-bin : Because having a web browser is cool.
- A window manager of your choice such as : Qtile, I3, Dwm, Awesome... Desktop managers are so bloat, right? ^_^ ( I mean, if you are switching to Gentoo, you have to agree with this last statement).
- Thunderbird-bin : To manage your emails, or (neo)mutt.
- Libreoffice : This one can wait until after you reboot, but it really is up to you.
- Vim, Neovim : Can anyone live without them?
- Git : Can anyone live without Git?
- A shell : bash (the default), zsh, fish...
- Acpi : To manage your battery
- A terminal emulator of your choice : Terminator, termite, urxvt, st, alacritty...
- Some other programs :
- mlocate
- alsamixer / pulseaudio / pavucontrol : To manage sound.
- xorg / wayland : Generally, people only need one, but some of you will want both.
- setxkbbmap & libXklavier: check out my YouTube video about it to configure your keyboard layout. Otherwise Ibus does the job, I guess...
- sudo
Conclusion & Sign-Off
This guide should not be an excuse to avoid reading the official documentation. I voluntarily skipped some parts which I considered unnecessary here. If you need anything, such as more information about your init system (openrc), do check out Gentoo's documentation. Be curious!
Thank you for taking the time to read this blog post! If you liked it, feel free to let me know via email, by subscribing, liking, and/or commenting. You may also check out some more of my work. I also have a Patreon page, a YouTube channel, if you wish to support me there, and a GoodReads account.
Take care of yourselves,
Phil.
