What is Gentoo Linux? How to install?
Gentoo Linux is a powerful and scalable distribution that sticks to the original source-based package management mechanism.
Gentoo Linux is a powerful and scalable distribution that sticks to the original source-based package management mechanism. Furthermore, the package manager, portage, is a powerful utility that allows you to tweak and tweak each aspect of the distribution. However, it is not an easy distribution to install and use. The following article will show you how to install Gentoo Linux to enjoy its countless benefits.
What is Gentoo Linux?
At its core, Gentoo Linux is a highly modular Linux distribution that gives you the power to create custom Linux machines for any purpose. Unlike other distributions, it does this by providing tools to compile and modify every installable package on the system.
One of the biggest advantages of this approach is that it removes the middleman between you and your system packages. You are not tied to a specific package manager and application format. With the source code, you can compile your own packages and customize them to suit your needs.
Download Gentoo
You can get your copy of Gentoo from its website. You can choose installers for different platforms. Gentoo supports both amd64 and arm64 along with other legacy architectures.
With the downloaded ISO file, you can use a USB burning program like balenaEtcher and dd to create a bootable flash drive.
Install Gentoo Linux
Before proceeding with Gentoo installation, it is important to note that this process is completely manual, which means a lot of commands will be executed during the process. Therefore, you should not only refer to this guide but also check Gentoo's official manual for further instructions during the installation process.
Plug the flash drive into the computer and boot it. It will take you to the Gentoo Installer desktop.
Step 1: Set up a network connection
To install Gentoo, you need an Internet connection. The installer will automatically connect on a wired connection. Check if you are currently online by running the following command:
ping -c 5 maketecheasier.com
If you need to connect to a wireless network, you need to set up wpa_supplicant , which will connect you to the wireless access point.
wpa_passphrase 'Your_SSID_Here' 'Your_Password_Here' >> /etc/wpa_supplicant/wpa_supplicant.conf
Reload the dhcpcd daemon to start your wireless network connection:
rc-service dhcpcd restart
Step 2: Create EFI drive partition
Format the drive you want to install Gentoo on. Do that using the fdisk command, followed by the device file on your computer's drive:
fdisk /your/disklabel
If you are not sure about your current drive partition structure, check it with the -l flag:
fdisk -l
Once in fdisk, press G to wipe the drive for any existing partitions.
Press N to tell fdisk that you want to create a new partition. Fdisk will ask you for the partition number you want to use. Press Enter to use the default.
Type '+100M' into the 'Last sector' prompt, then press Enter .
Change your first partition type by pressing T . This will tell fdisk that you want to change the type of partition you just created. From there, set this partition to 'EFI System' by typing 1 , then pressing Enter .
Step 3: Partition the rest of the drive
The next partition you have to create is the '/boot' partition where the Linux kernel and bootloader will be saved. Press N , then Enter to create a second partition for your system.
Type '2' , then press Enter to tell Fdisk that you are editing a second partition for the current drive.
Press Enter to accept the default first sector value for the partition, then type '+1G' , then press Enter to set the partition size to 1GB.
Press N again, then type '3' to create a third partition for your hard drive. This will act as a swap partition on your machine, which can automatically swap out memory whenever it runs out of space.
Press Enter to set the default first sector value, then type '+4G' , then press Enter to set the swap partition size to 4GB.
Note : The general rule for swap size is 1/2 to 2 times the amount of physical memory in your computer. This means that if you have a 16GB system, you can set swap between 8 and 32 GB.
Press T , then type '3' to change the third partition type.
Enter '19' to properly set this partition as the swap area, then press Enter .
Create a root partition where the rest of the system will be installed. Press N again, then type '4' to place the fourth partition on the drive.
Pressing Enter on both the first and last sectors will prompt to allocate the remainder of the drive to your root partition.
Press P to check if the partition table layout you made is correct.
Press W to confirm and write the new partition table to the drive.
Step 4: Format the drive in Gentoo
Format the EFI System partition as FAT using the following command:
mkfs.vfat /dev/sda1
Creating a file system for the '/boot' partition using the simpler ext2 file system.
mkfs.ext2 /dev/sda2
Create and enable a swap partition to tell Gentoo that this partition can be used for direct memory swapping. To do that, run the following:
mkswap /dev/sda3 swapon /dev/sda3
Create an ext4 file system for the root partition by running the following command:
mkfs.ext4 /dev/sda4
Step 5: Download Gentoo Stage 3 Tarball
Mount the root partition you just created into the '/mnt/gentoo' directory because the installation will be done on your computer's hard drive.
mount /dev/sda4 /mnt/gentoo && cd /mnt/gentoo
Download the Stage 3 tarball from the gentoo.org website using wget:
wget https://distfiles.gentoo.org/releases/amd64/autobuilds/20231112T170154Z/stage3-amd64-desktop-openrc-20231112T170154Z.tar.xz
Once that's done, extract it in the '/mnt/gentoo' directory using tar:
tar xpvf ./stage3-amd64-desktop-openrc-20231112T170154Z.tar.xz --xattrs-include='*.*' --numeric-owner
Step 6: Select Download Copy and copy DNS information
Figure out where you want to download your packages for this system by running the mirrorselect command:
mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf
This will open the TUI program where you can select the server location closest to you.
Copy Gentoo's default repository file to your '/etc/portage' directory. Here is the configuration file that tells Portage how to download its packages:
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
Copy the resolver information from your USB installer into the '/mnt/gentoo' directory :
cp --dereference /etc/resolv.conf /mnt/gentoo/etc/
Step 7: Mount the device file and Chroot
Mount special folders from the USB installer to your hard drive:
mount --types proc /proc /mnt/gentoo/proc mount --rbind /sys /mnt/gentoo/sys mount --make-rslave /mnt/gentoo/sys mount --rbind /dev /mnt/gentoo/dev mount --make-rslave /mnt/gentoo/dev mount --bind /run /mnt/gentoo/run mount --make-slave /mnt/gentoo/run
Change the root of the current shell session from the Live ISO to the '/mnt/gentoo' directory :
chroot /mnt/gentoo /bin/bash source /etc/profile export PS1="[chroot] ${PS1}"
Step 8: Mount /boot partition and update Gentoo
Mount the '/boot' partition to your Gentoo machine to ensure that when you install the kernel later, it will be saved in the correct location:
mount /dev/sda2 /boot mkdir /boot/efi mount /dev/sda1 /boot/efi
Update your Gentoo repository to ensure you get the latest packages when you do your first system update:
emerge-webrsync
Update and install all basic EBUILDS to your system by running this emerge command:
emerge --ask --verbose --update --deep --newuse @world
Step 9: Time zone and location
Once done, set up your system's region-specific information, including your system time zone and locale. To set the time zone for your zone, find the location closest to you listed in the '/usr/share/zoneinfo' directory.
ls /usr/share/zoneinfo
Write the path to the directory and zonefile to the file '/etc/timezone' . For example, the nearest location is 'Asia/Manila':
echo "Asia/Manila" > /etc/timezone emerge --config sys-libs/timezone-data
Open the file 'locale.gen' with your favorite text editor:
nano -w /etc/locale.gen
Delete the pound sign (#) in front of the first two lines in the locale.gen file.
Note : You can see the full list of available languages by running the following command:
cat /usr/share/i18n/SUPPORTED
Apply your new locale settings by running the locale-gen program.
Step 10: Install Linux kernel and configure fstab
There are many ways to install Linux Kernel in Gentoo. Either manually configure all its features or use pre-made ones from Gentoo developers. The example would choose the latter.
To get started, install the installkernel and kernel packages:
emerge --ask sys-kernel/installkernel-gentoo sys-kernel/gentoo-kernel-bin
With the kernel installed, open the fstab file with your favorite text editor:
nano -w /etc/fstab
Shows all the partitions you created in fdisk. For example, in a UEFI system, your fstab file might look like this:
[.] /dev/sda1 /boot/efi vfat defaults 0 2 /dev/sda2 /boot ext2 defaults,noatime 0 2 /dev/sda3 none swap sw 0 0 /dev/sda4 / ext4 noatime 0 1
Step 11: Set up root password and install additional tools
Create a root password for your system. This will ensure that you can still access your system after the installation process:
passwd
Install additional network support tools for your Gentoo system. For example, if you want both Ethernet and wireless connections, set up as follows:
emerge --ask net-misc/dhcpcd net-wireless/iw net-wireless/wpa_supplicant rc-update add dhcpcd default
Once done, install a syslogger if you want to monitor system activity:
emerge --ask app-admin/sysklogd rc-update add sysklogd default
Finally, install file system utilities for the most common file systems you will interact with:
emerge --ask sys-fs/dosfstools sys-fs/ntfs3g
Step 12: Install Bootloader
The final step in the Gentoo installation process is the bootloader. This is a small program that loads right after the computer's BIOS and prepares to load the operating system's kernel.
To install GRUB Bootloader, run the following command:
emerge --ask sys-boot/grub
Once installed, run the following commands to properly initialize and configure GRUB:
grub-install --target=x86_64-efi --efi-directory=/boot/efi grub-mkconfig -o /boot/grub/grub.cfg
Disconnect the USB installer and reboot the system by running the following:
exit cd umount -l /mnt/gentoo/dev{/shm,/pts,} umount -R /mnt/gentoo reboot
Installing Gentoo Linux is just the first step in understanding how your Linux distribution works. Learn how you can further optimize your system by speeding up compile times in Gentoo.
However, if you're still not sure which desktop environment to install, check out the best desktop environments on Linux.
You should read it
- 11 best Linux distributions for programmers
- 12 best Linux server operating systems
- How to install Solus Linux
- How to install and use Kali Linux on VmWare virtual machine
- How to install Kali Linux on macOS
- 14 interesting Linux commands in Terminal
- How to install Kali Linux on Android using Linux Deploy
- 5 ways to make Linux desktops look great
- How to install NVIDIA drivers on Kali Linux
- 5 reasons to install Linux on old computers
- How to Learn Linux
- What is Puppy Linux? Everything you need to know about Puppy Linux
Maybe you are interested
TOP of the best Soulslike games How to reset Windows Backup settings to default on Windows 10 Warning: New research has identified the corona virus to remain on the mask for more than a week What does Hangover mean? In what circumstances? What is CTFMON.EXE and how to delete it Instructions to stamp photos, add watermark to images on Android phones