Install to disk: Difference between revisions

From Alpine Linux
m (typo)
(removed obsolete content as everything moved to other pages already. Redirect to correct installation page)
Tag: Redirect target changed
 
(13 intermediate revisions by 8 users not shown)
Line 1: Line 1:
= If using Alpine Linux 2.2.3 or later =
#REDIRECT [[Setting_up_disks_manually]]
{{:Installing Alpine on HDD overwriting everything}}
 
= If using Alpine Linux 2.2.2 or earlier =
 
A number of steps are nowadays included in the setup-disk and setup-lbu scripts, which are invoked by setup-alpine. But in these older systems, these steps have to be performed manually.
 
Run <code>setup-alpine</code> to configure the keyboard, hostname and networking.
{{Cmd|setup-alpine}}
 
Now for the manual steps. Create partitions with <code>fdisk</code>.
{{Cmd|fdisk /dev/sda}}
 
You should have 2 partitions: {{Path|/dev/sda1}} as "Linux" (type 83) and {{Path|/dev/sda2}} as "linux swap" (type 82). The {{Path|/dev/sda1}} must be bootable (command "a" within <code>fdisk</code>).
 
Install needed programs for the setup:
{{Cmd|apk add e2fsprogs syslinux mkinitfs}}
 
Create filesystem and swap:
{{Cmd|mkfs.ext4 /dev/sda1
mkswap /dev/sda2}}
 
Mount filesystem:
{{Cmd|mount -t ext4 /dev/sda1 /mnt}}
 
Clone the current running config created by <code>setup-alpine</code> (hostname, networking root password):
{{Cmd|<nowiki>lbu package - | tar -C /mnt -zx</nowiki>}}
 
Install base packages on harddisk:
{{Cmd|<nowiki>apk add --root=/mnt --initdb $(cat /etc/apk/world)</nowiki>}}
 
Append the / and swap to {{Path|/etc/fstab}}:
{{Cmd|echo -e "/dev/sda1 /    ext4  defaults 1 1" &gt;&gt; /mnt/etc/fstab
echo -e "/dev/sda2 none swap  sw      0 0" &gt;&gt; /mnt/etc/fstab}}
 
Configure the boot loader, <code>extlinux</code>. We use the provided {{Path|syslinux.cfg}} as base.
{{Cmd|cp /media/cdrom/syslinux.cfg /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=ext4 quiet
 
Install the bootloader:
{{Cmd|extlinux -i /mnt/boot}}
 
Install syslinux bootloader at the beginning of the MBR so its bootable (note that its <code>sda</code> and not <code>sda1</code>)
{{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)
{{Cmd|umount /mnt
umount /.modloop
eject
reboot}}
 
After reboot, you should be able to log in as root with the password you created in <code>setup-alpine</code>.

Latest revision as of 18:02, 26 April 2025