1. Boot the system with Gentoo-minimal ISO CD.
Burn the CD and boot the system.
2. Determine interface name using ifconfig command.
In my case, it is “eno16777728”. Configure the network interface. IP will change according to your network.
# ifconfig eth0 192.168.1.109 broadcast 192.168.1.255 netmask 255.255.255.0 up
# route add default gw 192.168.1.1
Add the following entry in resolve.conf file.
# nano /etc/resolv.conf
nameserver 192.168.1.1
nameserver 8.8.8.8
3. Start sshd service.
To do the installation over ssh, start the sshd service and provide the root password.
#/etc/init.d/sshd start
# passwd
4. Create partitions as per the requirement.
In my case, I am going to create following partitions as on my virtual machine I am having only 20 GB of /dev/sda disk size.
Partitions and its size will vary depending on your system.
In my case, I am going to create following partitions as on my virtual machine I am having only 20 GB of /dev/sda disk size.
Partitions and its size will vary depending on your system.
1. /boot -- 500M
2. / -- 18G
3. swap -- 1024M
5. Formatting partitions.
Now Format created partitions with the supported filesystem(here formatted with ext4 filesystem).
#mkfs.ext4 /dev/sda1
#mkfs.ext4 /dev/sda2
Activate the swap partition.
#swapon /dev/sda3
6. Setting date.
Check date and time of the system. In case of time desynchronization use following command to set time.
#date MMDDhhmmYYYY
7. Mounting root partition.
Mount the root and boot partition under /mnt/gentoo.
#mount /dev/sda2 /mnt/gentoo
#mkdir /mnt/gentoo/boot
#mount /dev/sda1 /mnt/gentoo/boot
8. Downloading stage3 tarball.
Once downloaded dump it into /mnt/gentoo.
Now unpack the tar ball under /mnt/gentoo directory.
#tar xvjpf stage3-*.tar.bz2 --xattrs --numeric-owner
After extracting stage3 tar ball it will look like in below image.
9. Copy dns info.
Before entering the new environment copy the DNS information in /etc/resolv.conf.
#cp -L /etc/resolv.conf /mnt/gentoo/etc/
10. Mounting the necessary filesystems.
Mount the /proc, /sys and /dev directories to /mnt/gentoo installation system path, as this contains all the important hardware information of your system gathered by the kernel when the live CD is booted.
#mount -t proc /proc /mnt/gentoo/proc
#mount --rbind /sys /mnt/gentoo/sys
#mount --rbind /dev /mnt/gentoo/dev
11. Entering the new environment
Now go to the chroot environment, load previous system settings provided by /etc/profile file and change $PS1 Command Prompt.
#chroot /mnt/gentoo /bin/bash
#source /etc/profile
#export PS1="(chroot) $PS1"
12. Install ebuild repository snapshot from the web.
#emerge-webrsync
13. Choosing the right profile.
After Portage finishes synchronization select a profile for your future system destination.
#eselect profile list
I am going to select default profile i.e. 1
#eselect profile set 1
14. Setting time zone.
Next, configure your system Time Zone.
# ls /usr/share/zoneinfo
# cp /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
# echo " Asia/Kolkata " > /etc/timezone
15. Configuring locales.
Configure Locales by uncommenting your preferred language from /etc/locale.gen file using the following series of commands.
#nano /etc/locale.gen
Uncomment your system locale, I have uncommented below one.
en_US.UTF-8 UTF-8
run locale-gen command to generate all the locale specified in /etc/locale.gen
#locale-gen
Now reload the environment.
#env-update && source /etc/profile
16. Installing the sources.
#emerge --ask sys-kernel/gentoo-sources
17. Installing pciutils.
#emerge --ask sys-apps/pciutils
18. Configuring Linux kernel.
Go to the kernel source directory and execute make menuconfig.
#cd /usr/src/linux
#make menuconfig
Now configuration screen will appear on the terminal. The Linux kernel configuration has many, many sections. Select/Verify appropriate modules has been selected or not. Select if not and finally save the configuration.
Exit the configuration and start the compilation process
#make && make modules_install
#make install
Copy the kernel image file to the boot directory.
#cp arch/x86_64/boot/bzImage /boot/kernel-4.12.5-gentoo
19. Open /etc/fstab file and add the following content.
Next step is to configure fstab file to automatically mount system partitions during the boot process.
20. Installing system bootloader.
To make Gentoo start after reboot install GRUB Boot Loader on your first hard disk and generate its configuration file by running the following commands.
#emerge sys-boot/grub
#grub-install /dev/sda
#grub-mkconfig -o /boot/grub/grub.cfg
21. Set the hostname.
Set a hostname for your system by editing /etc/conf.d/hostname file.
22. Install DHCP client.
Configure your network settings with DHCP install dhcpcd Client.
rc-update will add it in system startup process.
#emerge
#rc-update add dhcpcd default
23. Install other important packages.
#emerge virtual/ssh
#emerge syslog-ng
#emerge cronie
#emerge mlocate
#rc-update add sshd default
#rc-update add syslog-ng default
#rc-update add cronie default
#emerge sudo
#emerge net-misc/netkit-telnetd
#emerge tcpdump
24. Provide root password in chroot environment.
#passwd
25. Rebooting the system
Exit the chrooted environment and unmount all mounted partitions.
#exit
#cd
#umount -l /mnt/gentoo/dev{/shm,/pts,}
#umount -R /mnt/gentoo
#umount -l /mnt/gentoo/dev{/shm,/pts,}
#umount -R /mnt/gentoo
#reboot
Reference Link: https://wiki.gentoo.org/ and https://www.tecmint.com/