Alpine Linux on ARM64

Here are the steps to install Alpine linux on Scaleway ARM64 servers.

Bootstrap Alpinelinux on Scaleway ARM64

Installation

  1. Boot to rescue mode
  2. Format hard drive
    # mkfs.ext4 /dev/vda
  3. Mount hard drive
    # mount /dev/vda /mnt
  4. Download and extract apk-tools-static for aarch64
    # cd /dev/shm
    # wget
    # tar xvzf apk-tools-static-2.8.2-r0.apk
  5. Bootstrap Alpine Linux
    # ./sbin/apk.static --arch aarch64 -X -U --allow-untrusted --root /mnt --initdb add alpine-base
  6. Download and copy dynamic-getty to Alpine
    # wget
    # mkdir /mnt/usr/local/sbin
    # mv dynamic-getty /mnt/usr/local/sbin/
    # chmod +x /mnt/usr/local/sbin/dynamic-getty
  7. Edit /etc/inittab
    # vi /mnt/etc/inittab
    > # /etc/inittab
    >
    > ::sysinit:/sbin/rc sysinit
    > ::wait:/sbin/rc default
    >
    > ::respawn:/usr/local/sbin/dynamic-getty
    >
    > ::shutdown:/sbin/rc shutdown
  8. Copy resolv.conf to Alpine
    # cp /etc/resolv.conf /mnt/etc/
  9. Setup apk repositories
    # echo > /mnt/etc/apk/repositories
  10. Chroot into Alpine
    # chroot /mnt /bin/sh
  11. Set correct permissions on folders
    # chmod 0755 /etc /usr /usr/local /usr/local/bin /usr/local/sbin
  12. Setup root password and SSH key
    # passwd
    # mkdir /root/.ssh
    # vi /root/.ssh/authorized_keys
    # chmod 0600 /root/.ssh/authorized_keys
    # chmod 0750 /root
  13. Reboot
    # reboot
  1. Login and run setup-alpine
    # setup-alpine
  2. Setup Scaleway stuffs
    # apk add bash curl tar wget
    # wget -qO - | FLAVORS=common,docker-based,openrc bash -e
    # rc-update add scw-hostname
    # rc-update add scw-ssh-keys
    # rc-update add scw-sshd-keys
    # rc-update add scw-swapfile
    # rc-update add scw-sync-kernel-extra
    # rc-update add scw-initramfs-shutdown shutdown
  3. Set correct permissions on folders
    # chmod 0755 /etc /usr /usr/local /usr/local/bin /usr/local/sbin
    # chmod 0600 /root/.ssh/authorized_keys
    # chmod 0750 /root