Gentoo Installation Notes (With Systemd)

0. My first time to try Gentoo. Compared to Arch, users can have more control over the kernel and packages easily.
Therefore the outcome of installation could be different from user to user and you have to change kernel options and
USE flags to your preference.

1. Get ISO from here.

2. Boot from CD. Press just Enter on boot prompt unless you want to specify kernel and boot option to boot.

3. modprobe necessary module. For most cases this is not necessary

4. Set password for root user, and create a normal user, and start sshd if you want to configure remotely.

useradd -m -G users username
/etc/init.d/sshd start

5. Configure network if it is not automatically set.

6. Partitioning (Using parted, mbr, one partition, no swap)

parted -a opt /dev/sda
mklabel msdos
unit mib
mkpart primary ext4 2 -1
set 1 boot on
mkfs.ext4 /dev/sda1
mount /dev/sda1 /mnt/gentoo

7. Choose your favourite mirror and download the latest stage3 tar.bz2.

8. Extract it

cd /mnt/gentoo
tar jxvf /root/stage3-*.tar.bz2

9. Edit /mnt/gentoo/etc/portage/make.conf to optimise later compilation.
echo 'MAKEOPTS="-j2"' >> /mnt/gentoo/etc/portage/make.conf

10. For chroot environment

mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf
cp -L /etc/resolv.conf /mnt/gentoo/etc/
mount -t proc proc /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev

11. Chrooting

chroot /mnt/gentoo /bin/bash
source /etc/profile
export PS1="(chroot) $PS1"

12. Initial setup of Portage

emerge --sync --quiet

If your get the news and want to read.

eselect news list
eselect news read

13. Select profile. Choose desktop profile. (Not necessary)

eselect profile list
eselect profile set 2

14. Set global USE flags.
See available flag here.
less /usr/portage/profiles/use.desc
For this installation, I just added “systemd”.
nano -w /etc/portage/make.conf

15. Timezone and Locale

echo "Japan" > /etc/timezone
emerge --config sys-libs/timezone-data
nano -w /etc/locale.gen and appen en_GB.UTF-8 UTF-8
eselect locale list
eselect locale set 3
env-update && source /etc/profile

16. Kernel Configuration (

emerge gentoo-sources
cd /usr/src/linux
make menuconfig

Here is my kernel options.
Gentoo Linux —>
Support for init systems, system and service managers —>
[ ] OpenRC
[*] systemdProcessor type and features —>
[*] Symmetric multi-processing support

—-General Setup
[ ] Support for paging of anonymous memory (swap)
[ ] System V IPC
[ ] POSIX Message Queues

Enable block layer—- enable only
i/o scheduler

Processor type and features” -> “Built-in kernel command line”.
[ ] Support for extended (non-PC) x86 platforms
[ ] IBM Calgary IOMMU support
[ ] EFI runtime service support
[*] Built-in kernel command line
[ ] Linux guest support

Executable file formats / Emulations
[ ] IA32 Emulation

Networking support for non wifi bt user
[ ] Amateur Radio support —>
RF switch subsystem support —-

Device Drivers
[ ] Macintosh device drivers —-
[*] Virtualization drivers (NEW) —-

X86 platform specifc drivers
disable all

multiple devices driver support
disable all

serial ata ~~
disable nvidia related thing

disable network drives

Network File Systems
[ ] Miscellaneous filesystems —-
[ ] Network File Systems (NEW) —>

Security Options
[ ] NSA SELinux Support

Make other changes according to your preference, and then run,
make -j3 && make modules_install
cp arch/x86_64/boot/bzImage /boot/kernel-3.12.13-gentoo

if you cannot be bothered to customise kernel run…

emerge genkernel
genkernel all
ls /boot/kernel* /boot/initramfs*

16. Building an initramfs. (Optional)

emerge genkernel
genkernel --install initramfs

17. Load modules
specify module s you want to load on startup.
find /lib/modules// -type f -iname ‘*.o’ -or -iname ‘*.ko’ | less

18. fstab (ssd)

vi /etc/fstab
/dev/sda1 / ext4 rw,noatime,discard 0 1

19. Set root passwd, create user, hostname, remove legacy packages and install new ones.

useradd -m username
passwd username
echo “hostname” > /etc/hostname
USE="-systemd" emerge sys-apps/dbus
emerge -1av systemd
ln -sf /proc/self/mounts /etc/mtab
emerge -C sysvinit
emerge -C openrc
emerge iproute2
emerge -C net-tools
emerge dhcpcd
emerge sys-apps/systemd-sysv-utils

To see all packages installed do,
cd /var/db/pkg/* && ls -d */* | less

To check dependencies, run
emerge -pv –depclean “pkg name”

24. GRUB

emerge sys-boot/grub

# Append parameters to the linux kernel command line

grub2-install /dev/sda
grub2-mkconfig -o /boot/grub/grub.cfg

25. Reboot

umount -l /mnt/gentoo

That’s all!