Install Alpine at online.net
18 August, 2015
To install alpine linux on a dedibox SC, start in rescue mode, connect to the box and run the following script as root:
#!/bin/sh
set -ex
PATH=/bin:/sbin:/usr/bin:/usr/sbin
KEYMAP="us us"
PASSWORD="changemestoopid"
HOST=alpine
ROOT_FS=ext4
FEATURES="ata base ide scsi usb virtio $ROOT_FS"
MODULES="sd-mod,usb-storage,$ROOT_FS"
REL=3.5
MIRROR=http://nl.alpinelinux.org/alpine
REPO=$MIRROR/v$REL/main
APKV=2.6.8-r2
DEV=/dev/sda
ROOT_DEV=${DEV}1
ROOT=/mnt
ARCH=$(uname -m)
sgdisk -Z $DEV
sgdisk -n 1:0:0 $DEV
sgdisk -t 1:8300 $DEV
sgdisk -c 1:root $DEV
sgdisk -A 1:set:2 $DEV
mkfs.$ROOT_FS -q -L root $ROOT_DEV
mount $ROOT_DEV $ROOT
curl -s $MIRROR/v$REL/main/$ARCH/apk-tools-static-${APKV}.apk | tar xz
./sbin/apk.static --repository $REPO --update-cache --allow-untrusted --root $ROOT --initdb add alpine-base syslinux dhcpcd
cat << EOF > $ROOT/etc/fstab
$ROOT_DEV / $ROOT_FS defaults,noatime 0 0
EOF
echo $REPO > $ROOT/etc/apk/repositories
cat /etc/resolv.conf > $ROOT/etc/resolv.conf
cat << EOF > $ROOT/etc/update-extlinux.conf
overwrite=1
vesa_menu=0
default_kernel_opts="quiet"
modules=$MODULES
root=$ROOT_DEV
verbose=0
hidden=1
timeout=1
default=grsec
serial_port=
serial_baud=115200
xen_opts=dom0_mem=256M
password=''
EOF
cat << EOF > $ROOT/etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
hostname $HOST
EOF
mount --bind /proc $ROOT/proc
mount --bind /dev $ROOT/dev
mount --bind /sys $ROOT/sys
chroot $ROOT /bin/sh -x << CHROOT
apk update
apk add openssh
setup-hostname -n $HOST
rc-update -q add acpid default
rc-update -q add crond default
rc-update -q add devfs sysinit
rc-update -q add dhcpcd boot
rc-update -q add dmesg sysinit
rc-update -q add hwdrivers sysinit
rc-update -q add mdev sysinit
rc-update -q add modules boot
rc-update -q add networking boot
rc-update -q add urandom boot
rc-update -q add sshd default
rc-update -q add ntpd default
echo features=\""$FEATURES"\" > /etc/mkinitfs/mkinitfs.conf
apk add linux-grsec
extlinux -i /boot
dd bs=440 conv=notrunc count=1 if=/usr/share/syslinux/gptmbr.bin of=$DEV
CHROOT
printf 'root:%s\n' "${PASSWORD}" | chroot $ROOT /usr/sbin/chpasswd
umount $ROOT/proc
umount $ROOT/dev
umount $ROOT/sys
umount $ROOT
Then restart the box into normal mode.