XEN GUEST // SOURCEMAGE GNU/LINUX

assuming you got a custom XEN-compatible kernel ready already :^)

VDISK & SYSTEM

Grab the latest chroot image release from some mirror

cd /data/ISO-IMAGES/

#129M
#wget http://download.sourcemage.org/image/official/smgl-stable-0.62-11-basesystem-x86_64.tar.xz

#267M
wget http://download.sourcemage.org/image/official/test/smgl-test-0.63-20190513_0600-basesystem-x86_64.tar.xz

mkdir -p /data/guests/smgl/lala/
touch /data/guests/smgl/lala/NOT_MOUNTED
cd /data/guests/smgl/

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

tar xJf /data/ISO-IMAGES/smgl-test-0.63-20190513_0600-basesystem-x86_64.tar.xz -C lala/
ls -lF lala/lib/modules/
rm -rf lala/lib/modules/*
file -L /data/kernels/vmlinuz
tar xzf /data/kernels/lib.modules.5.2.14.domureiser4.tar.gz -C lala/lib/modules/
cat lala/etc/modules
echo tmem >> lala/etc/modules

cp -pi lala/etc/inittab lala/etc/inittab.dist
echo s0:linux:/sbin/agetty --noclear -L 115200 hvc0 linux >> lala/etc/inittab

cat lala/etc/hostname
echo smgl > lala/etc/hostname
cat lala/etc/defaultdomain #noexist
echo localdomain > lala/etc/defaultdomain

Define an IP for your guest template

vi lala/etc/network/interfaces

auto eth0
iface eth0 inet static
        address x.x.x.x/xx
        gateway x.x.x.x

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

127.0.0.1   localhost
x.x.x.x smgl
x.x.x.x gw

mv -i lala/etc/resolv.conf lala/etc/resolv.conf.dist
echo nameserver x.x.x.x > lala/etc/resolv.conf

cat lala/etc/fstab
mv -i lala/etc/fstab lala/etc/fstab.dist
cat > lala/etc/fstab <<EOF
/dev/xvda1  /   reiser4 noatime     0 1
proc        /proc   proc    defaults    0 0
devpts      /dev/pts devpts defaults    0 0
tmpfs       /dev/shm tmpfs  size=128m   0 0
EOF

ls -lF lala/etc/localtime
ln -sf ../usr/share/zoneinfo/Europe/Moscow lala/etc/localtime

CHROOT

#chroot lala/ depmod -a 5.2.14.domureiser4
chroot lala/ passwd --delete --unlock root
ls -lF lala/etc/ssl/certs/ #hashes are there on v0.63
#chroot lala/ update-ca-certificates
umount lala/

GUEST CONFIG

cat > smgl <<EOF
kernel = "/data/kernels/vmlinuz"
root = "/dev/xvda1 ro console=hvc0 ipv6.disable=1 mitigations=off"
memory = 7168
name = "smgl"
vcpus = 16
maxvcpus = 16
disk = ['file:/data/guests/smgl/smgl.reiser4,xvda1,w']
vif = [ 'bridge=xenbr0, vifname=smgl.0' ]
EOF
vi smgl

READY TO GO

eventually start the guest

fsck.reiser4 --fix --yes smgl.reiser4 
xl create smgl -c

now see SOURCEMAGE POST-INSTALL and eventually generate a template out of that

newtemplate.bash smgl #1152MB

RESOURCES

Get Source Mage https://sourcemage.org/Download

Chroot Install Guide https://sourcemage.org/Install/Chroot

/dev/pts/

8.2. Creating the /etc/fstab File http://www.linuxfromscratch.org/lfs/view/development/chapter08/fstab.html

8.2. Creating the /etc/fstab File http://www.linuxfromscratch.org/lfs/view/6.7/chapter08/fstab.html


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