~jpastuszek/blog#50: 
Post: Installing Void on EC2 instance via chroot

#Install

Make a snapshot of AMZ2 instance ROOT volume. Attach as xvdf (sdf). We will use it as base for the OS since it contains some boot partitions stuff.

#Format

mkfs.ext4 /dev/xvdf1
mkdir /mnt/void
mount /dev/xvdf1 /mnt/void/

#Install root

cd /mnt/void/
curl https://alpha.de.repo.voidlinux.org/live/current/void-x86_64-ROOTFS-20191109.tar.xz | xz -d | tar xv

#Chroot

mount -o bind /dev /mnt/void/dev
mount -o bind /sys /mnt/void/sys
mount -o bind /proc /mnt/void/proc
cp /etc/resolv.conf /mnt/void/etc/
chroot /mnt/void /bin/bash

#Setup OS

xbps-reconfigure  -a -f
xbps-install -Su
xbps-install grub2
xbps-install linux-5.7_1

grub-install /dev/xvdf
chmod -x /etc/grub.d/30_os-prober

xbps-reconfigure  -a -f

ln -s /etc/sv/dhcpcd /etc/runit/runsvdir/default/
ln -s /etc/sv/sshd /etc/runit/runsvdir/default/

passwd

useradd -m <user>
passwd <user>

#Extras

xbps-install htop fish-shell
chsh -s /usr/bin/fish
chsh -s /usr/bin/fish <user>

#Cleanup

umount /mnt/void/dev
umount /mnt/void/sys
umount /mnt/void/proc
umount /mnt/void

Stop instance and detach both disks. Attach the new disk as /dev/xvda. Boot!

ssh <user>@<ip>
Status
REPORTED
Submitter
~jpastuszek
Assigned to
No-one
Submitted
1 year, 5 months ago
Updated
1 year, 5 months ago
Labels
No labels applied.