install_gentoo
Table of Contents
Gentoo - Install
Points of departure:
- MBR: Master boot record. Grub will install boot.img here, hardware will boot from this. Then it wil load first sector from core.img.
- core.img: Will load its configuration file and any other modules needed, particularly file system drivers. It will load config from /boot/grub
- GPT: GUID partition table.
- BTRFS: file system.
- GRUB2: bootloader
- SystemD: init system.
Download iso
- Download 64 bit ISO and verification files: http://distfiles.gentoo.org/releases/amd64/current-iso/
- Verify signature:
gpg --recv-keys 0xBB572E0E2D182910 gpg --verify install-amd64-minimal-20141204.iso.DIGESTS.asc
- Verify key with: https://www.gentoo.org/proj/en/releng/.
- Verify integrity:
grep -A 1 -i sha512 install-amd64-minimal-20141204.iso.DIGESTS.asc sha512sum install-amd64-minimal-20141204.iso.DIGESTS.asc #or openssl dgst -sha512 install-amd64-minimal-20141204.iso
Boot ISO
- Mount ISO via iLO, IPMI, etc…
- Boot server from ISO (F11 on X9SCL/Supermicro).
- Boot Gentoo:
boot: gentoo
- Select keymap, or leave default.
Configure network
- Configure networking, for example DHCP:
dhcpcd enp4s0
- Change root password, create user and start SSHd
# passwd # useradd -m -G users,wheel john # passwd john # /etc/init.d/sshd start
- Log in via SSH and switch to root.
Configure disk layout and btrfs RAID1
- I've played a lot with software RAID, LVM, GPT etc. So lets completely wipe the SSDs. See: secure_wipe
- Create GPT partitions including swap on sda:
gdisk /dev/sda o #create empty new GUID partition table. n #add new partition. 1 #partition number 1. 2048 #default first sector. +2MiB #BIOS boot partition size. ef02 #partition type. n #add new partition. 2 #partition number 2. <default> #default next sector. +2GiB #SWAP partition size. 8200 #partition type. n #add new partition. 3 #partition number 3. <default> #default next sector. <default> #Rest of disk. 8300 #partition type. w #write changes and exit.
- Create GPT partitions swap on sdb:
gdisk /dev/sdb o #create empty new GUID partition table. n #add new partition. 1 #partition number 1. 2048 #default first sector. +2MiB #BIOS boot partition size. ef02 #partition type. n #add new partition. 2 #partition number 2. <default> #default next sector. <default> #Rest of disk. 8300 #partition type. w #write changes and exit.
- Create RAID1 filesystem:
# mkfs.btrfs -L btrfsmirror -m raid1 -d raid1 /dev/sda3 /dev/sdb2 WARNING! - Btrfs v3.14.2 IS EXPERIMENTAL WARNING! - see http://btrfs.wiki.kernel.org before using Performing full device TRIM (57.62GiB) ... Turning ON incompat feature 'extref': increased hardlink limit per file to 65536 Performing full device TRIM (59.62GiB) ... adding device /dev/sdb2 id 2 fs created label SSDRAID1 on /dev/sda3 nodesize 16384 leafsize 16384 sectorsize 4096 size 117.25GiB Btrfs v3.14.2
- Verify:
# btrfs filesystem show Label: 'SSDRAID1' uuid: 3a69524a-97d1-4255-ab39-9ebf206f3f61 Total devices 2 FS bytes used 112.00KiB devid 1 size 57.62GiB used 2.03GiB path /dev/sda3 devid 2 size 59.62GiB used 2.01GiB path /dev/sdb2 Btrfs v3.14.2
- Add to /etc/fstab:
LABEL=btrfsmirror /mnt/gentoo btrfs defaults,noatime 0 0 LABEL=btrfsmirror /mnt/gentoo/root btrfs defaults,noatime,compress=lzo,autodefrag,subvol=root 0 0
- Mount new btrfs filesystem:
# mount /mnt/gentoo
- Create BTRFS subvolumes:
btrfs subvolume create /mnt/gentoo/root btrfs subvolume create /mnt/gentoo/root/home btrfs subvolume create /mnt/gentoo/root/var
- Verify:
# btrfs subvolume list /mnt/gentoo/ ID 258 gen 9 top level 5 path root ID 259 gen 8 top level 258 path root/home ID 260 gen 9 top level 258 path root/var # btrfs fi df /mnt/gentoo Data, RAID1: total=1.00GiB, used=512.00KiB Data, single: total=8.00MiB, used=0.00 System, RAID1: total=8.00MiB, used=16.00KiB System, single: total=4.00MiB, used=0.00 Metadata, RAID1: total=1.00GiB, used=160.00KiB Metadata, single: total=8.00MiB, used=0.00 unknown, single: total=16.00MiB, used=0.00
Install stage
- Check and set date:
# date Thu Dec 18 19:56:19 UTC 2014 # date [MMDDhhmm[[CC]YY][.ss]] #or ntpdate ntp1.polaire.nl
- Download stage3 tarballs, go to releases/amd64/autobuilds/ on a mirror nearby:
# cd /mnt/gentoo/root # links http://www.gentoo.org/main/en/mirrors.xml stage3-amd64-20141204.tar.bz2.CONTENTS stage3-amd64-20141204.tar.bz2.DIGESTS stage3-amd64-20141204.tar.bz2.DIGESTS.asc
- Verify integrity:
# openssl dgst -r -sha512 stage3-amd64-<release>.tar.bz2
- Verify cryptographic signature:
# gpg --recv-keys 0xBB572E0E2D182910 # gpg --verify stage3-amd64-20141204.tar.bz2.DIGESTS.asc
- Unpack tarball:
# tar xvjpf stage3-*.tar.bz2
Install base
- Edit /mnt/gentoo/root/etc/portage/make.conf:
# vi /mnt/gentoo/root/etc/portage/make.conf CFLAGS="-march=native -O2 -pipe" CXXFLAGS="${CFLAGS}" MAKEOPTS="-j5" USE="bindist mmx sse sse2 systemd -consolekit"
- Select mirror:
# mirrorselect -i -o >> /mnt/gentoo/root/etc/portage/make.conf # mirrorselect -i -r -o >> /mnt/gentoo/root/etc/portage/make.conf
- Copy DNS info:
# cp -L /etc/resolv.conf /mnt/gentoo/root/etc/
- Mount special file systems:
# mount -t proc proc /mnt/gentoo/root/proc # mount --rbind /sys /mnt/gentoo/root/sys # mount --rbind /dev /mnt/gentoo/root/dev
- Enter new environment:
# chroot /mnt/gentoo/root /bin/bash # source /etc/profile # export PS1="(chroot) $PS1"
Configure portage
- Install a portage snapshot:
# emerge-webrsync
- Update portage tree to latest version:
# emerge --sync --quiet
- Select profile if needed:
# eselect profile list # eselect profile set <num>
- Create symlink for SystemD:
# ln -sf /proc/self/mounts /etc/mtab
- Re emerge in order to compile with systemd :
# emerge -avDN @world
- Install VIM:
# emerge --ask vim
- Configure timezone:
# echo "Europe/Amsterdam" > /etc/timezone
- Reconfigure the sys-libs/timezone-data package:
# emerge --config sys-libs/timezone-data
- Configure locale:
# vi /etc/locale.gen en_US ISO-8859-1 en_US.UTF-8 UTF-8 # locale-gen # locale -a
- Set system wide locale:
# eselect locale list # eselect locale set <num>
- Reload environment:
# env-update && source /etc/profile
Configure Kernel
- Install kernel sources:
# emerge --ask sys-kernel/gentoo-sources
- Install pci utils:
# emerge --ask sys-apps/pciutils
- Configure kernel:
# cd /usr/src/linux # make menuconfig CONFIG_AUTOFS4_FS CONFIG_CGROUPS CONFIG_FANOTIFY ##BTRFS General setup ---> [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support File systems ---> <*> Btrfs filesystem support [*] Btrfs POSIX Access Control Lists ##SystemD Gentoo Linux ---> Support for init systems, system and service managers ---> [*] systemd ##devtmpfs Device Drivers ---> Generic Driver Options ---> -*- Maintain a devtmpfs filesystem to mount at /dev [*] Automount devtmpfs at /dev, after the kernel mounted the rootf
- Compile kernel:
make -j5 && make modules_install make install
- Build initramfs:
# emerge genkernel # genkernel --install initramfs # ls /boot/initramfs*
- Create swap:
# mkswap /dev/sda2 Setting up swapspace version 1, size = 2097148 KiB no label, UUID=6de68c5a-1c90-4b25-b019-00def47e6c35
- Configure /etc/fstab:
LABEL=btrfsmirror / btrfs defaults,noatime,compress=lzo,autodefrag,subvol=root 0 0 UUID="6de68c5a-1c90-4b25-b019-00def47e6c35" none swap sw 0 0
- Configure networking:
# vi /etc/conf.d/hostname # vi /etc/conf.d/net dns_domain_lo="homenetwork" config_enp4s0="dhcp" # emerge --ask --noreplace net-misc/netifrc
- Edit /etc/hosts
127.0.0.1 tux.homenetwork tux localhost
- Set root password:
passwd
- Edit /etc/rc.conf
- Edit /etc/conf.d/keymaps
- Edit /etc/conf.d/hwclock
Install tools
- Install mailx:
# emerge --ask virtual/mailx # emerge --config =mail-mta/nullmailer-1.13-r4
- Install logrotate:
# emerge --ask app-admin/logrotate
- Install syslogger:
# emerge --ask app-admin/syslog-ng # systemctl enable syslog-ng.service
- Install cron:
# emerge --ask sys-process/cronie # systemctl enable cronie.service
- Install file indexing:
# emerge --ask sys-apps/mlocate
- Install DHCP client:
# emerge --ask net-misc/dhcpcd
Install bootloader
- Install grub2:
# vi /etc/portage/package.use sys-boot/grub:2 device-mapper # emerge --ask sys-boot/grub # vi /etc/default/grub # Append parameters to the linux kernel command line GRUB_CMDLINE_LINUX="rootfstype=btrfs rootflags=device=/dev/sda3,device=/dev/sdb2,subvol=root init=/usr/lib/systemd/systemd"
- Install grub2 on disks:
# grub2-install /dev/sda # grub2-install /dev/sdb
- Generate config:
# grub2-mkconfig -o /boot/grub/grub.cfg
Reboot system
- Exit chroot:
exit
- Umount:
umount -l /mnt/gentoo/dev{/shm,/pts,} umount /mnt/gentoo{/boot,/sys,/proc,} reboot
install_gentoo.txt · Last modified: 2021/10/09 15:14 by 127.0.0.1