Native Harddisk Install 1.6

From Alpine Linux
Revision as of 19:53, 29 September 2011 by Jbilyk (talk | contribs) (tag obsolete)
This material is obsolete ...

Please feel free to help us make an up-to-date version. (Discuss)

Alpine HD install

NOTE: This document covers 1.6 release. From version 1.7.3 there is an albootstrap script that will install the basic packages (except grub) into a subdir. The script is available here: http://dev.alpinelinux.org/alpine/v1.7/albootstrap

Alpine is more geared toward live-cd or usb-key usage, but it is possible to install it to a harddisk.

This is how it is done. The Alpine version is 1.6.1

Installation

Create partitions with fdisk.

fdisk /dev/hda

You should have 2 partitions: /dev/hda1 as "Linux" (type 83) and /dev/hda2 as "linux swap" (type 82).

Install needed programs for the setup

apk_add e2fsprogs rsync grub

Create filesystem and swap

mkfs.ext3 /dev/hda1
mkswap /dev/hda2

Turn on swap already now

swapon /dev/hda2

Mount file-system

mount -t ext3 /dev/hda1 /mnt

Install base packages on harddisk

ROOT=/mnt apk_add uclibc busybox apk-tools alpine-baselayout alpine-conf grub

If you want pcmcia support, then also add the pcmciautils package

ROOT=/mnt apk_add pcmciautils

Install busybox links

mkdir /mnt/proc
mount --bind /proc /mnt/proc
chroot /mnt /bin/busybox --install -s
umount /mnt/proc

For convenience, copy the apk repository.

rsync -ruav /media/cdrom/apks /mnt

Create the apk.conf:

mkdir /mnt/etc/apk
echo "APK_PATH=file://apks" > /mnt/etc/apk/apk.conf

Copy the hd/ext3 initramfs image, kernel and kernel modules.

rsync -ruav /media/cdrom/kernel/generic/hd-ext3.gz /media/cdrom/kernel/generic/bzImage /mnt
rsync -ruav /lib/modules/* /mnt/lib/modules/

Configure grub

grub-install --root-directory=/mnt /dev/hda1
vi /mnt/boot/grub/menu.lst

It should contain something like:

default 0
timeout 0
title Alpine Linux
root (hd0,0)
kernel /bzImage root_dev=hda1:ext3 alpine_dev=../:ext3
initrd /hd-ext3.gz

Install grub on MBR:

grub
root (hd0,0)
setup (hd0)
quit

Append the swap to fstab:

echo -e "/dev/hda2 none swap sw 0 0" >> /mnt/etc/fstab

Unmount, remove cdrom and reboot. (If you can't eject, just remove it manually as the machine reboots)

umount /mnt
eject 
reboot

After reboot, log in as "root" and run:

setup-alpine