Same as Arch Linux, Gentoo is an Open Source meta-distribution build from sources, based on Linux Kernel, embracing the same rolling release model, aimed for speed and complete customizable for different hardware architectures which compiles software sources locally for best performance using an advanced package management – Portage.
Because the final user can choose which components are to be installed, Gentoo Linux installation is a very difficult process for unexperienced users, but this tutorial uses for simplification a pre-build environment provided by a LiveDVD and a stage 3 tarball with minimal system software required to complete installation.
This tutorial shows you a step by step Gentoo installation simplified single-boot procedure, divided into two parts, using a 64-bit image with the last Stage 3 Tarball, using a GPT partition scheme and a customized Kernel image provided by Gentoo developers, so arm yourself with plenty of patience because installing Gentoo can be a long time consuming process.
Step 1: Download Gentoo DVD Image and Prepare Network Configurations
1. Before proceeding with installation go to Gentoo Download page and grab the last released LiveDVD image.
2. After you burn the ISO image place the DVD in your system DVD drive, reboot your computer, select your bootable DVD and Gentoo prompt LiveDVD should appear on your screen. Select the first option (Gentoo x86_64) which boots the default Gentoo Kernel then press Enter key to continue.
3. After Gentoo DVD content is loaded you will be prompted with Gentoo main login screen which provides the default credentials for live session. Press Enter to login then go to KDE start button and open a Terminal window.
4. Now it’s time to check your network configuration and Internet connectivity using ifconfig command and ping against a domain. If you are behind a DHCP server, your network card should be automatically configured for you else use net-setup or pppoe-setup and pppoe-start commands or dhcpcd eth0 (replace it with your NIC plugged cable) in case your NIC has problems with automatically detect DHCP settings.
For static network configurations use the following commands but replace IPs according to your network settings.
$ sudo su - # ifconfig eth0 192.168.1.100 broadcast 192.168.1.255 netmask 255.255.255.0 up # route add default gw 192.168.1.1
# nano /etc/resolv.conf nameserver 192.168.1.1 nameserver 126.96.36.199
Step 2: Create Disk Partitions and Filesystems
5. After you network connectivity has been established and confirmed it’s time to prepare Hard Disk. The following GPT partition layout will be used, but the same partition scheme can be also applied on a MBR BIOS disk using fdisk utility.
/dev/sda1 - 20M size – unformatted = BIOS boot partition /dev/sda2 – 500M size – ext2 filesystem = Boot partition /dev/sda3 - 1000M size – Swap = Swap partition /dev/sda4 - rest of space – ext4 filesystem = Root Partition
To create system disk partition switch to root account and run Parted utility with optimum alignment.
$ sudo su - # parted -a optimal /dev/sda
6. After entering parted CLI interface set GPT label on your hard disk.
# mklabel gpt
7. Use print to show your disk partition current state and remove any partitions (if case) using rm partition number command. Then supply parted with MB or mib size unit, create the first partition with mkpart primary, give it a name and set the boot flag on this partition.
(parted) unit MB (parted) mkpart primary 1 20 (parted) name 1 grub (parted) set 1 bios_grub on (parted) print
The way that Parted deals with partition sizes is to tell it to start from 1MB + the desired value size (in this case start a 1 MB and end at 20 MB which results in a 19 MB partition size).
8. Then create all the partitions using the same method as above.
(parted) mkpart primary 21 500 (parted) name 2 boot
(parted) mkpart primary 501 1501 (parted) name 3 swap
(parted) mkpart primary 1502 -1 (parted) name 4 root
As you can see Root partition uses -1 as maximum value which means that it’s using all the remaining space -1 MB at the end of disk space. After you complete with disk slices use print to see your final partition layout (should look like in the image below) and quit parted.
9. Now it’s time to format partitions using a specific Linux filesystem, activate Swap file and mount Root and Boot partitions to /mnt/gentoo path.
# mkfs.ext2 /dev/sda2 # mkfs.ext4 /dev/sda4 # mkswap /dev/sda3 # swapon /dev/sda3
Step 3: Download and extract Gentoo Stage 3 Tarball
10. Before downloading Gentoo Stage 3 Tarball check your system time and date using date command and, in case, there’s a huge time desynchronization use the following syntax to synchronize time.
# date MMDDhhmmYYYY ##(Month, Day, hour, minute and Year)
11. Now it’s time to download Gentoo Stage 3 Tarball. Proceed to /mnt/gentoo path and use links command to navigate to Gentoo Mirror list and select your Country nearest mirrors -> releases -> amd64 (or your system architecture) -> current-iso -> stage3-cpu-architecure-release-date.tar.bz2.
# cd /mnt/gentoo # links http://www.gentoo.org/main/en/mirrors.xml
After selecting the Tarball press [Enter] key, select OK, wait for the download to finish and quit links.
12. On the next step, extract Stage 3 Tarball archive using the following command.
# tar xvjpf stage3-amb64-20140522.tar.bz2
Now you have a minimal Gentoo environment installed on your computer but the installation process is far from being finished. To continue the installation process follow Install Gentoo Linux – Part 2 tutorial.