Create Alpine Linux PV DomU: Difference between revisions

From Alpine Linux
No edit summary
Line 83: Line 83:
Installation is complete. Please reboot.
Installation is complete. Please reboot.
</pre>
</pre>
# halt


== Adjust domU config file for booting from disk ==
== Adjust domU config file for booting from disk ==

Revision as of 14:13, 11 June 2014

To create an Alpine Linux PV DomU you will need a Dom0 and an Alpine Linux iso, here we will use the "mini" iso.

Copy the kernel

The first step it to mount the image and extract the kernel and initramfs:

# mkdir -p /mnt/alpine_iso
# mount -o loop /path/to/the/iso /mnt/alpine_iso
# cp /mnt/alpine_iso/boot/grsec /path/to/save/kernel/
# cp /mnt/alpine_iso/boot/grsec.gz /path/to/save/kernel/
# umount /mnt/alpine_iso
# rmdir /mnt/alpine_iso

Now we have the kernel at /path/to/save/kernel/grsec and the initramfs at /path/to/save/kernel/grsec.gz.

Create the disk image

Now we should create an empty file, that will be the hard drive of the DomU, you can also use a physical partition if you like (in this example we are using a 3GB disk):

# dd if=/dev/zero of=/path/to/disk.img bs=1M count=3000

Configure for booting ISO image

The next step is to create a basic configuration file, so we can launch the DomU (save it where you like, although the most common place is /etc/xen/).

# Alpine Linux PV DomU

# Kernel paths for install
kernel = "/path/to/save/kernel/grsec"
ramdisk = "/path/to/save/kernel/grsec.gz"
extra="alpine_dev=xvdc:iso9660 modules=loop,squashfs,sd-mod,usb-storage modloop=/boot/grsec.modloop.squashfs console=hvc0"

# Path to HDD and iso file
disk = [
        'format=raw, vdev=xvdc, access=r, target=/path/to/disk.img',
        'format=raw, vdev=xvdc, access=r, devtype=cdrom, target=/path/to/the/iso'
       ]

# Network configuration
vif = ['bridge=br0']

# DomU settings
memory = 512
name = "alpine"
vcpus = 1
maxvcpus = 1

Install the guest

Now that we have all the necessary files, we can start the DomU to proceed with the install:

# xl create -f /path/to/conf -c

Login into the system with user "root" and no password, and proceed with the normal install:

# setup-alpine

After configuring the basic system, you will be asked where would you like to install Alpine, choose xvda and sys.

This will create three partitions on your disk, xvda1 for /boot, xvda2 for swap and xvda3 for /

Available disks are:
  xvda	(3.1 GB  )
Which disk(s) would you like to use? (or '?' for help or 'none') [none] xvda
The following disk is selected:
  xvda	(3.1 GB  )
How would you like to use it? ('sys', 'data' or '?' for help) [?] sys
WARNING: The following disk(s) will be erased:
  xvda	(3.1 GB  )
WARNING: Erase the above disk(s) and continue? [y/N]: y
Initializing partitions on /dev/xvda...
Creating file systems...
Installing system on /dev/xvda3:


Installation is complete. Please reboot.
  1. halt

Adjust domU config file for booting from disk

As the installation suggests, halt the DomU machine and edit the config file, to remove the xvdc disk (iso image), and change to use pvgrub. At the end it should look similar to this:

# Alpine Linux PV DomU

bootloader = '/usr/bin/pygrub'

# Path to HDD and iso file
disk = [
        'file:/path/to/disk.img,xvda,w',
        ]

# Network configuration
vif = ['bridge=br0']

# DomU settings
memory = 128
name = "alpine"
vcpus = 1

So now you are good to go, you can boot into your new Alpine Linux DomU:

# xl create -f /path/to/conf -c