Create Alpine Linux PV DomU: Difference between revisions

From Alpine Linux
No edit summary
No edit summary
Line 1: Line 1:
To create an Alpine Linux PV DomU you will need a Dom0 and an Alpine Linux iso, here we will use the "mini" iso. The first step it to mount the image and extract the kernel and initramfs images:
To create an Alpine Linux PV DomU you will need a Dom0 and an Alpine Linux iso, here we will use the "mini" iso. The first step it to mount the image and extract the kernel and initramfs:


<pre>
<pre>
Line 10: Line 10:
</pre>
</pre>


Now we have the kernel at /path/to/save/kernel/grsec and the initramfs at /path/to/save/kernel/grsec.gz. 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 2GB disk):
Now we have the kernel at /path/to/save/kernel/grsec and the initramfs at /path/to/save/kernel/grsec.gz. 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):


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



Revision as of 12:11, 30 December 2011

To create an Alpine Linux PV DomU you will need a Dom0 and an Alpine Linux iso, here we will use the "mini" iso. 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
# rm -f /mnt/alpine_iso

Now we have the kernel at /path/to/save/kernel/grsec and the initramfs at /path/to/save/kernel/grsec.gz. 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

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 = [
        'file:/path/to/disk.img,xvda,w',
        'file:/path/to/the/iso,xvdc:cdrom,r'
        ]

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

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

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

# xl create -c /path/to/conf

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, as shown above:

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.

As the installation suggests, halt the DomU machine and edit the config file, to remove the xvdc disk, and change the "extra" line, since pygrub and extlinux doesn't seem to get along, we will have to boot with the same kernel and ramdisk. At the end it should look similar to this:

# Alpine Linux PV DomU

# Kernel paths for install
kernel = "/path/to/save/kernel/grsec"
ramdisk = "/path/to/save/kernel/grsec.gz"
extra="root=/dev/xvda3 modules=sd-mod,usb-storage,ext4 xen"

# 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 -c /path/to/conf