XEN GUEST // GENTOO LINUX

Base system

grab the latest stage 3 build

cd /data/ISO-IMAGES/
wget https://bouncer.gentoo.org/fetch/root/all/releases/amd64/autobuilds/20210428T214503Z/stage3-amd64-20210428T214503Z.tar.xz

prepare and mount the virtual disk

mkdir -p /data/guests/gentoo/lala/
cd /data/guests/gentoo/

#dd if=/dev/zero of=gentoo.ext4 bs=1G count=0 seek=10
#mkfs.ext4 gentoo.ext4
#mount -o loop,rw gentoo.ext4 lala/

dd if=/dev/zero of=gentoo.reiser4 bs=1G count=0 seek=10
mkfs.reiser4 -d --yes --force gentoo.reiser4
mount -o loop,rw gentoo.reiser4 lala/

deploy the base system

tar xJpf /data/ISO-IMAGES/stage3-amd64-20210428T214503Z.tar.xz --xattrs-include='*.*' --numeric-owner -C lala/

System preparation

mv -i lala/etc/fstab lala/etc/fstab.dist
vi lala/etc/fstab

#/dev/xvda1 / ext4 noatime 0 1
/dev/xvda1 / reiser4 noatime 0 1

cp -pi lala/etc/inittab lala/etc/inittab.dist
vi lala/etc/inittab

s0:12345:respawn:/sbin/agetty --noclear -L 115200 hvc0 linux

chroot lala/ passwd --delete --unlock root
chroot lala/ rc-update show default | grep netmount
chroot lala/ rc-update -a del netmount

Kernel modules

We’re enabling TMEM

mkdir lala/lib/modules/
file /data/kernels/vmlinuz
tar xvzf /data/kernels/lib.modules.5.2.14.domureiser4.tar.gz -C lala/lib/modules/

mkdir lala/etc/modules-load.d/
echo tmem > lala/etc/modules-load.d/tmem.conf

Ready to go

umount lala/
rmdir lala/
vi gentoo

kernel = "/data/kernels/vmlinuz"
root = "/dev/xvda1 ro console=hvc0 mitigations=off"
memory = 7168
name = "gentoo"
vcpus = 16
maxvcpus = 16
disk = ['file:/data/guests/gentoo/gentoo.reiser4,xvda1,w']
vif = [ 'bridge=xenbr0, vifname=gentoo.0' ]

xl create gentoo -c

Post-install

And within the guest, eventually grab and deploy the latest portage snapshot

wget http://distfiles.gentoo.org/snapshots/portage-latest.tar.xz
tar xJf portage-latest.tar.xz -C /usr/

Resources

install

Gentoo AMD64 Handbook https://wiki.gentoo.org/wiki/Handbook:AMD64

Gentoo Linux amd64 Handbook: Installing Gentoo https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation

Installing the Gentoo installation files https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Stage

Installing the Gentoo base system https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Base

chroot

Creating the system on the server https://wiki.gentoo.org/wiki/Installation_alternatives#Creating_the_system_on_the_server

Chrooting https://wiki.gentoo.org/wiki/Installation_alternatives#Chrooting

xen

Gentoo as a DomU https://wiki.prgmr.com/mediawiki/index.php/Gentoo_as_a_DomU

x32

x32 ABI https://en.wikipedia.org/wiki/X32_ABI

Gentoo Does An x32 Stage 3 Release Candidate https://www.phoronix.com/scan.php?page=news_item&px=MTExNTE

hardened

Hardened Gentoo https://wiki.gentoo.org/wiki/Hardened_Gentoo

Project:Hardened https://wiki.gentoo.org/wiki/Project:Hardened

Gentoo Hardened vs other distros https://security.stackexchange.com/questions/117653/gentoo-hardened-vs-other-distros


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun