Debian Sarge on Xen: Difference between revisions

From ConShell
Jump to navigation Jump to search
No edit summary
(revert after Zuza7 destruction)
Line 4: Line 4:
http://wiki.xensource.com/xenwiki/DebianSarge
http://wiki.xensource.com/xenwiki/DebianSarge


=== PROCEDURE ===
Prepare your storage. You can use partitions, LVM volumes or simple file-based images. I choose file-based for the flexibility - for a real server you would NOT want to use a file-based because the IO sucks, use real partitions or LVM volumes.


Choosing a suitably large partition (/usr) I linked it into /opt/xen
  mkdir /usr/xen
  ln -s /usr/xen /opt/xen


Bootstrap Debian into a file-based image (note: this is a meager setup of 1GB root / and 128MB swap, you'll likely want much more for a real-world VM)
  mkdir -p /opt/xen/domains/vm01
  dd if=/dev/zero of=/opt/xen/domains/vm01/diskimage bs=1024k count=1024
  dd if=/dev/zero of=/opt/xen/domains/vm01/swapimage bs=1024k count=128
  mkfs.ext3 /opt/xen/domains/vm01/diskimage
  mkswap /opt/xen/domains/vm01/swapimage
  mkdir /mnt/disk
  mount -o loop /opt/xen/domains/vm01/diskimage /mnt/disk
  apt-get install debootstrap #If necessary
  debootstrap --arch i386 sarge /mnt/disk http://ftp.us.debian.org/debian
  chroot /mnt/disk /bin/bash
  cd /etc; vi hostname hosts resolv.conf


Add minimal entries as desired.


Create an ''/etc/fstab'' file
  /dev/sda1    /    ext3    errors=remount-ro    0    1
  /dev/sda2    none  swap    sw                    0    0
  proc          /proc proc    defaults              0    0


Logout and unmount ''/mnt/disk''


Now you can setup the first VM (aka vm01)
  cat > /etc/xen/vm01.cfg
  kernel = "/boot/vmlinuz-2.6.10-xenU"
  memory = 96
  name = "vm01"
  dhcp = "dhcp"
  disk = [ 'file:/opt/xen/domains/vm01/diskimage,sda1,w','file:/opt/xen/domains/vm01/swapimage,sda2,w' ]
  root = "/dev/sda1 ro"


<div id="wikitikitavi" style="overflow:auto; height: 1px; ">
Start it
[[http://WTHP1.coolhost.biz] [WTHPD1]]
  xm create vm01.cfg -c
[http://WTHP2.coolhost.biz  WTHPD2]
  > Using config file "/etc/xen/vm01.cfg".
[[http://WTHP3.coolhost.biz | WTHPD3]]
  > Started domain vm01, console on port 9601
[http://WTHP4.coolhost.biz | WTHPD4]
 
[WTHPD5 | http://WTHP5.coolhost.biz]
Show it
[[http://WTHP6.coolhost.biz WTHPD6]]
  xm list
</div>
 
Attach to it (already done if used -c above)
  xm console vm01
 
Login as root (no password yet set), set the root password and update.
  passwd root
  /usr/sbin/base-config
  apt-get update
  apt-get dist-upgrade

Revision as of 10:35, 27 October 2005

Quick instructions for installing a Debian Sarge VM on Xen

REFERENCE

http://wiki.xensource.com/xenwiki/DebianSarge

PROCEDURE

Prepare your storage. You can use partitions, LVM volumes or simple file-based images. I choose file-based for the flexibility - for a real server you would NOT want to use a file-based because the IO sucks, use real partitions or LVM volumes.

Choosing a suitably large partition (/usr) I linked it into /opt/xen

 mkdir /usr/xen
 ln -s /usr/xen /opt/xen

Bootstrap Debian into a file-based image (note: this is a meager setup of 1GB root / and 128MB swap, you'll likely want much more for a real-world VM)

 mkdir -p /opt/xen/domains/vm01
 dd if=/dev/zero of=/opt/xen/domains/vm01/diskimage bs=1024k count=1024
 dd if=/dev/zero of=/opt/xen/domains/vm01/swapimage bs=1024k count=128
 mkfs.ext3 /opt/xen/domains/vm01/diskimage
 mkswap /opt/xen/domains/vm01/swapimage
 mkdir /mnt/disk
 mount -o loop /opt/xen/domains/vm01/diskimage /mnt/disk
 apt-get install debootstrap #If necessary
 debootstrap --arch i386 sarge /mnt/disk http://ftp.us.debian.org/debian
 chroot /mnt/disk /bin/bash
 cd /etc; vi hostname hosts resolv.conf

Add minimal entries as desired.

Create an /etc/fstab file

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

Logout and unmount /mnt/disk

Now you can setup the first VM (aka vm01)

 cat > /etc/xen/vm01.cfg
 kernel = "/boot/vmlinuz-2.6.10-xenU"
 memory = 96
 name = "vm01"
 dhcp = "dhcp"
 disk = [ 'file:/opt/xen/domains/vm01/diskimage,sda1,w','file:/opt/xen/domains/vm01/swapimage,sda2,w' ]
 root = "/dev/sda1 ro"

Start it

 xm create vm01.cfg -c
 > Using config file "/etc/xen/vm01.cfg".
 > Started domain vm01, console on port 9601

Show it

 xm list

Attach to it (already done if used -c above)

 xm console vm01

Login as root (no password yet set), set the root password and update.

 passwd root
 /usr/sbin/base-config
 apt-get update
 apt-get dist-upgrade