Create a Bootable USB

From Alpine Linux
Revision as of 15:40, 1 September 2009 by Ttrask (talk | contribs) (Added manual steps to create bootable USB)
Jump to: navigation, search

Alpine on USB

Manual Process

What you will need

  • USB memory stick
  • Computer
  • Alpine Linux CD

CD images can be downloaded from the Alpine Linux Web site (http://wiki.alpinelinux.org).

Prepare to modify USB Stick

  • Insert the Alpine Linux CD into a computer.
  • Boot the computer from the Alpine Linux CD.

This step may require changes to the BIOS settings to select booting from CD.

  • Login with the username root. No password is needed.
  • Insert the USB stick into the computer.
  • Determine the name Alpine Linux uses for your USB stick. The following step is one way to do this.

After inserting the USB stick, run the command: dmesg. At the end of this command you should see the name of your USB stick, likely starting with sd.

The remainder of these instructions will assume that your USB device is called /dev/sda

Modify partitions

fdisk /dev/sda
  • p Print list of partitions
  • d Delete all partitions (this may take a few steps)
  • n Create a new partition
  • p A primary partition
  • 1 Partition number 1
  • Use defaults for first and last cylinder (just press [Enter]).
  • t Change partition type
  • c Type: Win95 FAT32 (LBA)
  • a Make the partition bootable (set boot flag)
  • 1 Partition number 1
  • w Write your changes to the device
  • Remove and reinsert your USB stick

Install Syslinux on device

apk add syslinux dosfstools
dd if=/usr/share/syslinux/mbr.bin of=/dev/sda
mkdosfs -F32 /dev/sda1
syslinux /dev/sda1

Copy Alpine Linux to device

mount -t vfat /dev/sda1 /media/usb
cd /media/cdrom
cp -a * .alpine-release /media/usb
sync

Modify the syslinux.cfg file

  • Change the line "default generic-hd" to say "default generic-usb".

Automated Process

Starting (and apparently ending) with Alpine 1.9 alpha 13 we distribute both a .img file and a exe file containing USB images.

Please note that writing the Alpine 1.9 image to your USB stick will overwrite all its existing content.

The images are premade the same size as the .iso image + 8MB for an apk overlay. This means that no matter wither you have an 8GB memory stick or a 512MB memory stick, you will only have 8MB free when booting from it.

Download the latest Alpine 1.9:

Installing to media

Linux users

  • Run the following command:
 dd if=/path/to/img/file of=/dev/sdX
  • Where sdX is your USB devive. You can find your USB device by inserting it into your computer and run the following command:
 dmesg
  • This command will tell you the device name of your newly inserted USB device.
  • Please note that most desktop environments automatically mounts inserted USB devices. You should unmount it before running the "dd" command above

Windows users

File:USB-extract.png

  • Download the self extracting exe file (packaged with 7zip), and run it as administrator
  • It will self exctract to a temporary location and launch an image writing program

File:USB-write.png

  • Select the removable drive letter you want to use, and click the "Write" button
  • Wait until its finished, and you will have your usb drive ready to use.

Boot Alpine

Put your AlpineLinux-USB in a computer that can boot from USB.
Note: You might need to change boot-order in your BIOS-settings in order to boot from USB.

When your computer has booted you will get prompted for a username.
On a clean AlpineLinux you just enter root and no password and you will get logged on to your Alpine linux.

Alpine Linux has some special applications that helps you to use it in the way you want.
Some of the first scripts you are suggested to use is:

  • setup-alpine (Configures all basic things on your Alpine Linux)
  • setup-acf (was named setup-webconf before Alpine 1.9 beta 4) (Configures ACF (webconfiguration) so you can manage your box through https)
Note: Just type any of the above commands on your console and hit Enter to execute the script.

Other useful pages