Install to disk: Difference between revisions

From Alpine Linux
(install alpine to disk)
 
m (macros)
Line 1: Line 1:
=Install Alpine on Harddisk=
{{Note|This document covers 1.9.x release.}}
'''NOTE''': This document covers 1.9.x release.
For 1.8.x and older please see [[Native Harddisk Install 1.6]]
For 1.8.x and older please see [[Native Harddisk Install 1.6]]


== Installation ==
== Installation ==
Run ''setup-alpine'' to configure the keyboard, hostname and networking.
Run ''setup-alpine'' to configure the keyboard, hostname and networking.
{{Cmd|setup-alpine}}


Create partitions with fdisk.  
Create partitions with fdisk.  


fdisk /dev/sda
{{Cmd|fdisk /dev/sda}}


You should have 2 partitions: /dev/sda1 as "Linux" (type 83) and /dev/sda2 as "linux swap" (type 82). The /dev/sda1 should be bootable.
You should have 2 partitions: /dev/sda1 as "Linux" (type 83) and /dev/sda2 as "linux swap" (type 82). The /dev/sda1 should be bootable.
Line 15: Line 15:
Install needed programs for the setup  
Install needed programs for the setup  


apk_add e2fsprogs syslinux mkinitfs
{{Cmd|apk add e2fsprogs syslinux mkinitfs}}


Create filesystem and swap  
Create filesystem and swap  


mkfs.ext3 /dev/sda1
{{Cmd|mkfs.ext3 /dev/sda1
mkswap /dev/sda2
mkswap /dev/sda2}}


Mount file-system  
Mount file-system  


mount -t ext3 /dev/sda1 /mnt
{{Cmd|mount -t ext3 /dev/sda1 /mnt}}


Clone the current running config created by setup-alpine (hostname, networking root password)
Clone the current running config created by setup-alpine (hostname, networking root password)


lbu package - | tar -C /mnt -zx
{{Cmd|<nowiki>lbu package - | tar -C /mnt -zx</nowiki>}}


Install base packages on harddisk
Install base packages on harddisk


apk add --root=/mnt --initdb apk-tools alpine-baselayout alpine-conf linux-grsec linux-grsec-mod acct mkinitfs
{{Cmd|<nowiki>apk add --root=/mnt --initdb apk-tools alpine-baselayout alpine-conf linux-grsec linux-grsec-mod acct mkinitfsy</nowiki>}}


Generate new initramfs image:
Generate new initramfs image:


chroot /mnt /sbin/mkinitfs
{{Cmd|chroot /mnt /sbin/mkinitfs}}


Create the repositories list. In this example we use the cdrom as repository:
Create the repositories list. In this example we use the cdrom as repository:


mkdir -p /mnt/etc/apk
{{Cmd|mkdir -p /mnt/etc/apk
echo "/media/cdrom/packages/core" &gt;&gt; /mnt/etc/apk/repositories
echo "/media/cdrom/packages/core"     /mnt/etc/apk/repositories
echo "/media/cdrom/packages/extra" &gt;&gt; /mnt/etc/apk/repositories
echo "/media/cdrom/packages/extra"   /mnt/etc/apk/repositories}}


Append the / and swap to fstab:
Append the / and swap to fstab:
echo -e "/dev/sda1 /    ext3  defaults 1 1" &gt;&gt; /mnt/etc/fstab
{{Cmd|echo -e "/dev/sda1 /    ext3  defaults 1 1" &gt;&gt; /mnt/etc/fstab
echo -e "/dev/sda2 none swap  sw      0 0" &gt;&gt; /mnt/etc/fstab
echo -e "/dev/sda2 none swap  sw      0 0" &gt;&gt; /mnt/etc/fstab}}


Configure the boot loader, extlinux. We use sthe provided syslinux as base.
Configure the boot loader, extlinux. We use sthe provided syslinux as base.


cp /media/cdrom/syslinux.cf /mnt/boot/extlinux.conf
{{Cmd|cp /media/cdrom/syslinux.cf /mnt/boot/extlinux.conf
vi /mnt/boot/extlinux.conf
vi /mnt/boot/extlinux.conf}}


It should contain something like:  
It should contain something like:  
Line 62: Line 62:


Install the bootloader:
Install the bootloader:
extlinux -i /mnt/boot
{{Cmd|extlinux -i /mnt/boot}}


Fix the MBR so its bootable (note that its sda and not sda1)
Fix the MBR so its bootable (note that its sda and not sda1)
dd if=/usr/share/syslinux/mbr.bin of=/dev/sda


Unmount, remove cdrom and reboot. (If you can't eject, just remove it manually as the machine reboots)  
{{Cmd|<nowiki>dd if=/usr/share/syslinux/mbr.bin of=/dev/sda</nowiki>}}
 
Unmount, remove cdrom, and reboot. (If you can't eject, just remove it manually as the machine reboots)  


umount /mnt
{{Cmd|umount /mnt
umount /.modloop
umount /.modloop
eject  
eject  
reboot
reboot}}


After reboot, you should be able to log in as roto with the password you created in setup-alpine.
After reboot, you should be able to log in as root with the password you created in <tt>setup-alpine</tt>.

Revision as of 05:06, 13 July 2011

Note: This document covers 1.9.x release.

For 1.8.x and older please see Native Harddisk Install 1.6

Installation

Run setup-alpine to configure the keyboard, hostname and networking.

setup-alpine

Create partitions with fdisk.

fdisk /dev/sda

You should have 2 partitions: /dev/sda1 as "Linux" (type 83) and /dev/sda2 as "linux swap" (type 82). The /dev/sda1 should be bootable.

Install needed programs for the setup

apk add e2fsprogs syslinux mkinitfs

Create filesystem and swap

mkfs.ext3 /dev/sda1 mkswap /dev/sda2

Mount file-system

mount -t ext3 /dev/sda1 /mnt

Clone the current running config created by setup-alpine (hostname, networking root password)

lbu package - | tar -C /mnt -zx

Install base packages on harddisk

apk add --root=/mnt --initdb apk-tools alpine-baselayout alpine-conf linux-grsec linux-grsec-mod acct mkinitfsy

Generate new initramfs image:

chroot /mnt /sbin/mkinitfs

Create the repositories list. In this example we use the cdrom as repository:

mkdir -p /mnt/etc/apk echo "/media/cdrom/packages/core" /mnt/etc/apk/repositories echo "/media/cdrom/packages/extra" /mnt/etc/apk/repositories

Append the / and swap to fstab:

echo -e "/dev/sda1 / ext3 defaults 1 1" >> /mnt/etc/fstab echo -e "/dev/sda2 none swap sw 0 0" >> /mnt/etc/fstab

Configure the boot loader, extlinux. We use sthe provided syslinux as base.

cp /media/cdrom/syslinux.cf /mnt/boot/extlinux.conf vi /mnt/boot/extlinux.conf

It should contain something like:

timeout 20
prompt 1
default grsec
label grsec
    kernel /boot/grsec
    append initrd=/boot/grsec.gz root=/dev/sda1 modules=ext3 quiet

Install the bootloader:

extlinux -i /mnt/boot

Fix the MBR so its bootable (note that its sda and not sda1)

dd if=/usr/share/syslinux/mbr.bin of=/dev/sda

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

umount /mnt umount /.modloop eject reboot

After reboot, you should be able to log in as root with the password you created in setup-alpine.