Mit dem aktuellen Server-Release von Ubuntu ist es einfach, einen Server für XEN3 aufzusetzen. Schritte zur Installation/Anpassung sind im folgenden dargestellt.
Voraussetzung: Minimal Installation mit “Server”-Image + apt-get install openssh-server
/etc/apt/sources.list anpassen
#deb cdrom:[Ubuntu-Server 6.10 _Edgy Eft_ - Release i386 (20061025.1)]/ edgy main restricted deb http://de.archive.ubuntu.com/ubuntu/ edgy main restricted deb-src http://de.archive.ubuntu.com/ubuntu/ edgy main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb http://de.archive.ubuntu.com/ubuntu/ edgy-updates main restricted deb-src http://de.archive.ubuntu.com/ubuntu/ edgy-updates main restricted ## Uncomment the following two lines to add software from the 'universe' ## repository. ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## universe WILL NOT receive any review or updates from the Ubuntu security ## team. deb http://de.archive.ubuntu.com/ubuntu/ edgy universe deb-src http://de.archive.ubuntu.com/ubuntu/ edgy universe ## Uncomment the following two lines to add software from the 'backports' ## repository. ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. # deb http://de.archive.ubuntu.com/ubuntu/ edgy-backports main restricted universe multiverse # deb-src http://de.archive.ubuntu.com/ubuntu/ edgy-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu edgy-security main restricted deb-src http://security.ubuntu.com/ubuntu edgy-security main restricted deb http://security.ubuntu.com/ubuntu edgy-security universe deb-src http://security.ubuntu.com/ubuntu edgy-security universe
Paketinstallation
sys@tem:~# LC_ALL=C apt-get install libxen3.0 python-xen3.0 xen-docs-3.0 xen-hypervisor-3.0-i386 \ xen-image-xen0-2.6.17-6-generic-xen0 xen-headers-2.6.17-6-generic-xen0 xen-tools xen-utils-3.0 Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: debootstrap libtext-template-perl python-central xen-headers-2.6.17-6 Suggested packages: xen-doc-2.6.17 Recommended packages: xfsprogs rpmstrap bridge-utils libc6-xen The following NEW packages will be installed: debootstrap libtext-template-perl libxen3.0 python-central python-xen3.0 xen-docs-3.0 xen-headers-2.6.17-6 xen-headers-2.6.17-6-generic-xen0 xen-hypervisor-3.0-i386 xen-image-xen0-2.6.17-6-generic-xen0 xen-tools xen-utils-3.0 0 upgraded, 12 newly installed, 0 to remove and 0 not upgraded. Need to get 31.4MB of archives. After unpacking 154MB of additional disk space will be used. Do you want to continue [Y/n]? ...
Anschließend ist noch die initrd für den XEN-DOM0-Kernel anzulegen:
mkinitramfs -o /boot/xen0-initrd-2.6.17-6-generic-xen0 2.6.17-6-generic-xen0
/boot/grub/menu.lst
title Ubuntu, xen-kernel root (hd0,0) kernel /boot/xen-3.0-i386.gz dom0_mem=192000 sched=sedf #kernel /boot/xen-3.0-i386.gz dom0_mem=127000 sched=sedf console=com1 com1=57600,8n1 module /boot/xen0-linux-2.6.17-6-generic-xen0 root=/dev/sda1 ro quiet splash locale=de_DE xencons=ttyS module /boot/xen0-initrd-2.6.17-6-generic-xen0 savedefault boot
apt-get install bridge-utils
Paketlisten werden gelesen... Fertig Abhängigkeitsbaum wird aufgebaut Reading state information... Fertig Die folgenden NEUEN Pakete werden installiert: bridge-utils 0 aktualisiert, 1 neu installiert, 0 zu entfernen und 0 nicht aktualisiert. Es müssen 28,0kB Archive geholt werden. Nach dem Auspacken werden 152kB Plattenplatz zusätzlich benutzt.
LC_ALL=C apt-get install shorewall
Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: shorewall-doc make The following NEW packages will be installed: shorewall 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 238kB of archives. After unpacking 1122kB of additional disk space will be used.
Sparse File erzeugen
dd if=/dev/zero of=xguest1.img bs=1M seek=1024 count=0 dd if=/dev/zero of=xguest1swap.img bs=1M seek=1024 count=0
ls -Als
0 -rw-r--r-- 1 root root 1073741824 2007-01-18 20:45 xguest1.img
Hier wird auch die tatsächliche Größe der Datei angezeigt. Aktuell reserviert ist 1G.
mkfs/mkswap
sys@tem:/# mkfs.ext3 /var/xenguest/xguest1.img
mke2fs 1.39 (29-May-2006)
/var/xenguest/xguest1.img is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
131072 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
sys@tem:/# tune2fs -c0 /var/xenguest/xguest1.img
tune2fs 1.39 (29-May-2006)
Setting maximal mount count to -1
tdomU
kernel = "/boot/vmlinuz-2.6.12.6-xenU" memory = 384 name = "tdomU" vif = [''] disk = [ 'file:/var/xenguest/xguest1.img,hda1,w', 'file:/var/xenguest/xguest1swap.img,hda2,w' ] root = "/dev/hda1 ro"
debootstrap --arch i386 dapper /mnt/1 http://debian.charite.de/ubuntu/
I: Retrieving Release I: Retrieving Packages I: Validating Packages I: Resolving dependencies of required packages... I: Resolving dependencies of base packages... I: Checking component main on http://debian.charite.de/ubuntu... ... I: Configuring gnupg... I: Configuring ubuntu-keyring... I: Configuring ubuntu-minimal... I: Base system installed successfully.
interfaces
auto lo eth0 iface lo inet loopback iface eth0 inet static address 192.168.100.22 netmask 255.255.255.0 network 192.168.100.0 broadcast 192.168.100.255 gateway 192.168.100.1 #ip route add to default via 192.168.100.1 metric 0
fstab
/dev/hda1 / ext3 defaults 0 1 /dev/hda2 none swap sw proc /proc proc defaults 0 0 sys /sys sysfs defaults 0 0 none /tmp tmpfs defaults 0 0
sources.list
#Ubuntu deb http://de.archive.ubuntu.com/ubuntu/ dapper main restricted universe multiverse deb-src http://de.archive.ubuntu.com/ubuntu/ dapper main restricted universe multiverse #Ubuntu Updates deb http://de.archive.ubuntu.com/ubuntu/ dapper-updates main restricted universe multiverse deb-src http://de.archive.ubuntu.com/ubuntu/ dapper-updates main restricted universe multiverse #Ubuntu Backports deb http://de.archive.ubuntu.com/ubuntu/ dapper-backports main restricted universe multiverse deb-src http://de.archive.ubuntu.com/ubuntu/ dapper-backports main restricted universe multiverse #Ubuntu Security (Orig) #deb http://security.ubuntu.com/ubuntu dapper-security main restricted universe multiverse #deb-src http://security.ubuntu.com/ubuntu dapper-security main restricted universe multiverse #Ubuntu Security (deutscher Mirror) deb http://de.archive.ubuntu.com/ubuntu/ dapper-security main restricted universe multiverse deb-src http://de.archive.ubuntu.com/ubuntu/ dapper-security main restricted universe multiverse
Nach erfolgter Installation exit.
Jetzt kopieren wir die domU-Modules in unser image: cp -ar /lib/modules/2.6.12.6-xenU /mnt/1/lib/modules. Schlussendlich umount /mnt/1.
ls -Als
total 388016 388016 -rw-r--r-- 1 root root 1073741824 2007-01-18 20:55 xguest1.img
xm create -c /etc/xen/conf/tdomU
Using config file "/etc/xen/conf/tdomU".
Started domain tdomU
Linux version 2.6.12.6-xenU (xenod@freefall.cl.cam.ac.uk) (gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7)) #1 SMP Tue Jan 31 16:08:40 GMT 2006
BIOS-provided physical RAM map:
Xen: 0000000000000000 - 0000000018000000 (usable)
0MB HIGHMEM available.
392MB LOWMEM available.
IRQ lockup detection disabled
Built 1 zonelists
Kernel command line: root=/dev/hda1 ro
Initializing CPU#0
PID hash table entries: 2048 (order: 11, 32768 bytes)
Xen reported: 996.844 MHz processor.
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
vmalloc area: d9000000-fb7fe000, maxmem 34000000
Memory: 385792k/401408k available (1695k kernel code, 7144k reserved, 465k data, 136k init, 0k highmem)
Checking if this processor honours the WP bit even in supervisor mode... Ok.
Mount-cache hash table entries: 512
CPU: L1 I cache: 16K, L1 D cache: 16K
CPU: L2 cache: 256K
Enabling fast FPU save and restore... done.
Enabling unmasked SIMD FPU exception support... done.
Checking 'hlt' instruction... disabled
Brought up 1 CPUs
Grant table initialized
NET: Registered protocol family 16
Brought up 1 CPUs
xen_mem: Initialising balloon driver.
Initializing Cryptographic API
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
Xen virtual console successfully installed as tty1
Event-channel device installed.
netfront: Initialising virtual ethernet driver.
NET: Registered protocol family 2
Registering block device major 3
IP: routing cache hash table of 4096 buckets, 32Kbytes
TCP established hash table entries: 16384 (order: 5, 131072 bytes)
TCP bind hash table entries: 16384 (order: 5, 131072 bytes)
TCP: Hash tables configured (established 16384 bind 16384)
NET: Registered protocol family 1
NET: Registered protocol family 17
kjournald starting. Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.
VFS: Mounted root (ext3 filesystem) readonly.
Freeing unused kernel memory: 136k freed
* INIT: version 2.86 booting
* Starting basic networking... [ ok ]
* Starting PCMCIA services... [fail]
* Loading manual drivers... [ ok ]
* Checking root file system... /dev/shm/root: clean, 11369/131072 files, 75772/262144 blocks
[ ok ]
EXT3 FS on hda1, internal journal
* Checking all filesystems... [ ok ]
* Configuring network interfaces... [ ok ]
* INIT: Entering runlevel: 2
* Starting system log... [ ok ]
* Starting kernel log... [ ok ]
* Starting OpenBSD Secure Shell server... [ ok ]
* Running local boot scripts (/etc/rc.local) [ ok ]
Ubuntu 6.06.1 LTS tdomU tty1
tdomU login: