PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Für Xen ein Root-Image erstellen



G-S-X
26.06.05, 20:06
Hallo,

wie kann ich am einfachsten für eine virtuelle Maschien ein Root Image erstellen. Muß ich die gewünschte Distritbution auf eine frische Partition installieren und dann auf das gemountete Loop Device kopieren, oder gibts da schnellere oder elegantere Möglichkeiten wie z.B. debootstrap bei Debian.

akku111
29.06.05, 09:22
Ganz einfach, hier ein Teil der Installationsanleitung von der Xen-Homepage.


Here's some info how to install Debian 3.1 (Sarge) for an unprivileged Xen domain:

1. Set up Xen 2.0 and test that it's working, as described earlier in this manual.

2. Create disk images for root-fs and swap (alternatively, you might create dedicated partitions, LVM logical volumes, etc. if that suits your setup).


dd if=/dev/zero of=/path/diskimage bs=1024k count=size_in_mbytes
dd if=/dev/zero of=/path/swapimage bs=1024k count=size_in_mbytes

If you're going to use this filesystem / disk image only as a `template' for other vm disk images, something like 300 MB should be enough.. (of course it depends what kind of packages you are planning to install to the template)

3. Create the filesystem and initialise the swap image

mkfs.ext3 /path/diskimage
mkswap /path/swapimage

4. Mount the disk image for installation

mount -o loop /path/diskimage /mnt/disk

5. Install debootstrap

Make sure you have debootstrap installed on the host. If you are running Debian sarge (3.1 / testing) or unstable you can install it by running apt-get install debootstrap. Otherwise, it can be downloaded from the Debian project website.

6. Install Debian base to the disk image:

debootstrap --arch i386 sarge /mnt/disk \
http://ftp.<countrycode>.debian.org/debian

You can use any other Debian http/ftp mirror you want.

7. When debootstrap completes successfully, modify settings:

chroot /mnt/disk /bin/bash

Edit the following files using vi or nano and make needed changes:

/etc/hostname
/etc/hosts
/etc/resolv.conf
/etc/network/interfaces
/etc/networks

Set up access to the services, edit:

/etc/hosts.deny
/etc/hosts.allow
/etc/inetd.conf

Add Debian mirror to:

/etc/apt/sources.list

Create fstab like this:

/dev/sda1 / ext3 errors=remount-ro 0 1
/dev/sda2 none swap sw 0 0
proc /proc proc defaults 0 0

Logout

8. Unmount the disk image

umount /mnt/disk

9. Create Xen 2.0 configuration file for the new domain. You can use the example-configurations coming with Xen as a template.

Make sure you have the following set up:

disk = [ 'file:/path/diskimage,sda1,w', 'file:/path/swapimage,sda2,w' ]
root = "/dev/sda1 ro"

10. Start the new domain

xm create -f domain_config_file

Check that the new domain is running:

xm list

11. Attach to the console of the new domain. You should see something like this when starting the new domain:

Started domain testdomain2, console on port 9626

There you can see the ID of the console: 26. You can also list the consoles with xm consoles (ID is the last two digits of the port number.)

Attach to the console:

xm console 26

or by telnetting to the port 9626 of localhost (the xm console program works better).

12. Log in and run base-config

As a default there's no password for the root.

Check that everything looks OK, and the system started without errors. Check that the swap is active, and the network settings are correct.

Run /usr/sbin/base-config to set up the Debian settings.

Set up the password for root using passwd.

13. Done. You can exit the console by pressing Ctrl + ]

If you need to create new domains, you can just copy the contents of the `template'-image to the new disk images, either by mounting the template and the new image, and using cp -a or tar or by simply copying the image file. Once this is done, modify the image-specific settings (hostname, network settings, etc).

Temp
03.07.05, 08:17
wie mach ich das eigentlich wenn ich ein SuSE da hinein installieren will. Ne Xen-0 läuft bei mir unter debian mit einer Dom-1 die wiederum ein debian enthält, das per debootstrap installiert wurde (find ich übrigens arsch komfortabel - so schnell installiert man kein debian mit dem installer ;) ) Aber wie krieg ich da ein SuSE rein ? :)

Gruß Temp

LordDarkmage
03.07.05, 10:53
Schreib mich mal per ICQ 78132462 an. Ich denke ich kann dir helfen. Hab grad nämlich SuSE installiert und eine ve erzeugt. Das kann ich dir geben.

lkwg82
09.07.05, 23:40
ja schreibe mal bitte wie du das gemacht hast !!

apohl
17.07.05, 13:58
Wäre ebenfalls für ein kurzes HowTo sehr dankbar !

Mallah
15.10.07, 15:42
und hats funktioniert?

lkwg82
15.10.07, 18:40
schau dir lieber neue Howtos an, es ist doch schon XEN 3.x raus.

Vielleicht ist es einfacher geworden oder es hat sich etwas geändert.

lkwg82
15.10.07, 23:25
schau mal hier http://www.howtoforge.com/ganeti_xen_cluster_management_debian_etch