Gentoo
Installation
Fetch an installation image and extract it in a logical volume for use with Xen)
Partitioning
fdisk /dev/xvda
Welcome to fdisk (util-linux 2.41.3).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS (MBR) disklabel with disk identifier 0xeada774e.
Command (m for help): o
Created a new DOS (MBR) disklabel with disk identifier 0x10aabe84.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (1-4, default 1):
First sector (2048-67108863, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-67108863, default 67108863): +1G
Created a new partition 1 of type 'Linux' and of size 1 GiB.
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (2-4, default 2):
First sector (2099200-67108863, default 2099200):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2099200-67108863, default 67108863): +4G
Created a new partition 2 of type 'Linux' and of size 4 GiB.
Command (m for help): t
Partition number (1,2, default 2):
Hex code or alias (type L to list all): 82
Changed type of partition 'Linux' to 'Linux swap / Solaris'.
Command (m for help): n
Partition type
p primary (2 primary, 0 extended, 2 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (3,4, default 3):
First sector (10487808-67108863, default 10487808):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (10487808-67108863, default 67108863):
Created a new partition 3 of type 'Linux' and of size 27 GiB.
Command (m for help): p
Disk /dev/xvda: 32 GiB, 34359738368 bytes, 67108864 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x10aabe84
Device Boot Start End Sectors Size Id Type
/dev/xvda1 2048 2099199 2097152 1G 83 Linux
/dev/xvda2 2099200 10487807 8388608 4G 82 Linux swap / Solaris
/dev/xvda3 10487808 67108863 56621056 27G 83 Linux
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
Filesystem creation
mkfs.xfs -c options=/usr/share/xfsprogs/mkfs/lts_6.18.conf /dev/xvda3
mkfs.ext4 /dev/xvda1
mkswap /dev/xvda2
mkdir --parents /mnt/gentoo
mount /dev/xvda3 /mnt/gentoo
swapon /dev/xvda2
mkdir /mnt/gentoo/boot
mount /dev/xvda1 /mnt/gentoo/boot
Stage installation
wget https://distfiles.gentoo.org/releases/amd64/autobuilds/20260503T164604Z/stage3-amd64-hardened-openrc-20260503T164604Z.tar.xz
Verify files:
wget https://distfiles.gentoo.org/releases/amd64/autobuilds/20260503T164604Z/stage3-amd64-hardened-openrc-20260503T164604Z.tar.xz.asc
wget https://distfiles.gentoo.org/releases/amd64/autobuilds/20260503T164604Z/stage3-amd64-hardened-openrc-20260503T164604Z.tar.xz.CONTENTS.gz
wget https://distfiles.gentoo.org/releases/amd64/autobuilds/20260503T164604Z/stage3-amd64-hardened-openrc-20260503T164604Z.tar.xz.DIGESTS
wget https://distfiles.gentoo.org/releases/amd64/autobuilds/20260503T164604Z/stage3-amd64-hardened-openrc-20260503T164604Z.tar.xz.sha256
gpg --import /usr/share/openpgp-keys/gentoo-release.asc
gpg --verify stage3-amd64-hardened-openrc-20260503T164604Z.tar.xz.asc stage3-amd64-hardened-openrc-20260503T164604Z.tar.xz
gpg --output stage3-amd64-hardened-openrc-20260503T164604Z.tar.xz.DIGESTS.verified --verify stage3-amd64-hardened-openrc-20260503T164604Z.tar.xz.DIGESTS
gpg --output stage3-amd64-hardened-openrc-20260503T164604Z.tar.xz.sha256.verified --verify stage3-amd64-hardened-openrc-20260503T164604Z.tar.xz.sha256
Install files:
tar xpvf stage3-amd64-hardened-openrc-20260503T164604Z.tar.xz --xattrs-include='*.*' --numeric-owner -C /mnt/gentoo
Chrooting
cp --dereference /etc/resolv.conf /mnt/gentoo/etc/
mount --types proc /proc /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev
mount --bind /run /mnt/gentoo/run
chroot /mnt/gentoo /bin/bash
source /etc/profile
Emerge configuration
emerge-webrsync
emerge --ask --verbose --oneshot app-portage/mirrorselect
mirrorselect -i -o >> /etc/portage/make.conf
System configuration
ln -sf ../usr/share/zoneinfo/Europe/Helsinki /etc/localtime
Uncomment wanted locales and select the default one:
nano /etc/locale.gen
locale-gen
eselect locale list
eselect locale set <x>
Port management
Install signatures for binary packages:
/usr/bin/getuto
Kernel compilation
Install sources:
emerge --ask sys-kernel/gentoo-sources
eselect kernel list
eselect kernel set 1
emerge --ask sys-kernel/modprobed-db
modprobed-db store
modprobed-db recall
cd /usr/src/linux
make LSMOD=/root/.config/modprobed.db localmodconfig
make menuconfig
make -j 2 && make modules_install
make install
Package management
Search a package:
emerge --search openssh
Install a package:
emerge --sync
Upgrade packages:
emerge --ask --verbose --update --deep --newuse @world
See USEs of a package and update them:
equery uses sys-process/htop
echo sys-process/htop hwloc >> /etc/portage/packaage.use
Tags: