1
1
freepoteries-doc/content/bootstrap_alpine.rst
2025-02-02 22:28:46 +01:00

38 lines
1.8 KiB
ReStructuredText

1 - boot a VM with the last alpine linux iso and a hard disk
2 - setup network interface (setup-interfaces, then ifup eth0)
3 - setup dns (add gateway / any DNS to /etc/resolv.conf)
4 - apk add e2fsprogs
5 - mkfs.ext4 /dev/vda
6 - mount -t ext4 /dev/vda /mnt
7 - /sbin/apk --arch x86_64 -X http://dl-cdn.alpinelinux.org/alpine/latest-stable/main/ -U --allow-untrusted --root /mnt --initdb add alpine-base agetty # replace latest-stable by the wanted version
8 - echo "UUID=`blkid -s UUID -o value /dev/vda` / ext4 defaults,errors=remount-ro,discard,noatime 0 1" > /mnt/etc/fstab
9 - (optional) tty1::respawn:/sbin/agetty --autologin root tty1 linux # replace tty line from /etc/inittab with this line to have autologin - no need to set root password. you can remove other ttys
10 - cp /etc/network/interfaces /mnt/etc/network/interfaces
11 - cp /etc/resolv.conf /mnt/etc/resolv.conf
12 - vi /mnt/etc/hostname # setup hostname
13 - cp /etc/apk/repositories /mnt/etc/apk/repositories # setup alpine repos (edit to set alpine version), enable community
14 - for a in proc sys dev; do mount -o bind /$a /mnt/$a; done; chroot /mnt /bin/ash # chroot into target
15 - apk update
16 - apk add linux-virt linux-firmware-none acpi mkinitfs vim screen qemu-guest-agent
17 - enable services
rc-update add seedrng boot
rc-update add swap boot
rc-update add networking boot
rc-update add modules boot
rc-update add hostname boot
rc-update add hwclock boot
rc-update add bootmisc boot
rc-update add acpid default
rc-update add crond default
rc-update add qemu-guest-agent default
rc-update add devfs sysinit
rc-update add dmesg sysinit
rc-update add mdev sysinit
rc-update add hwdrivers sysinit
rc-update add killprocs shutdown
rc-update add mount-ro shutdown
rc-update add savecache shutdown
18 - shutdown VM (force)
19 - setup kernel