Установка XEN на Debian Etch (4.0)

Обновляем списки пакетов:

apt-get update

Обновляемся:

apt-get upgrade

Ставим необходимые пакеты из репозитория (для xen и дополнительно mc и ee):

apt-get install xen-linux-system-2.6.18-6-xen-686 xen-linux-system-2.6.18-6-xen-vserver-686 xen-hypervisor-3.0.3-1-i386 xen-tools xen-utils-3.0.3-1 xen-ioemu-3.0.3-1 bridge-utils ee mc locales

Меняем локаль по умолчанию на UTF-8:

dpkg-reconfigure locales

Generating locales (this might take a while)...
en_US.UTF-8... done
Generation complete.

Перелогиниваемся и проверяем локаль:

test-vm:~# locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Теперь перезагружаемся с новым ядром (с поддержкой виртуализации).
Убедимся в наличии интерфейса xenbr:

xen1:/home/mavrichev# ifconfig
eth0 Link encap:Ethernet HWaddr 00:14:5E:2E:28:2C
inet addr:192.168.100.240 Bcast:192.168.100.255 Mask:255.255.255.0
inet6 addr: fe80::214:5eff:fe2e:282c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3301 errors:0 dropped:0 overruns:0 frame:0
TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2443894 (2.3 MiB) TX bytes:1550 (1.5 KiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:560 (560.0 b) TX bytes:560 (560.0 b)

peth0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
RX packets:2699 errors:0 dropped:0 overruns:0 frame:0
TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1969060 (1.8 MiB) TX bytes:1416 (1.3 KiB)
Interrupt:18

vif0.0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
RX packets:15 errors:0 dropped:0 overruns:0 frame:0
TX packets:3301 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1550 (1.5 KiB) TX bytes:2443894 (2.3 MiB)

xenbr0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
RX packets:15 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:12376 (12.0 KiB) TX bytes:0 (0.0 b)

Готовим шаблон конфига для виртуальных машин и создаём каталог для них:

mkdir /home/xen


ee /etc/xen-tools/xen-tools.conf


dir = /home/xen
debootstrap = 1
gateway = 192.168.100.1
netmask = 255.255.255.0
kernel = /boot/vmlinuz-2.6.18-6-xen-vserver-686
initrd = /boot/initrd.img-2.6.18-6-xen-vserver-686
mirror = http://ftp.ru.debian.org/debian/

Создаём первую вирт.машину:

xen-create-image --debootstrap --hostname test1 --ip=192.168.100.243 --dist=etch

После успешной установки увидим сообщение:

Creating Xen configuration file
Done
All done

При необходимости ,редактируем конф.файл вирт.машины:

ee /etc/xen/test1.cfg


#
# Configuration file for the Xen instance test1, created on
# Fri Apr 18 09:56:07 2008.
#
#
# Kernel + memory size
#
kernel = '/boot/vmlinuz-2.6.18-6-xen-vserver-686'
ramdisk = '/boot/initrd.img-2.6.18-6-xen-vserver-686'
memory = '256'
#
# Disk device(s).
#
root = '/dev/sda1 ro'
disk = [ 'file:/home/xen/domains/test1/disk.img,sda1,w', 'file:/home/xen/domains/test1/swap.img,sda2,w' ]
#
# Hostname
#
name = 'test1'
#
# Networking
#
vif = [ 'mac=00:16:3E:2A:E3:89' ]
#
# Behaviour
#
on_poweroff = 'destroy'
on_reboot = 'restart'
on_crash = 'restart'

Как показала практика, MAC-адрес лучше задать в конфигурации статически, до первого запуска вирт.машины. В противном случае, если MAC не задан, сервер XEN при каждом отключении Вирт.машины будет увеличивать номер интерфейса (eth0->eth1->eth2...), что не приемлемо.

После этого, запускаем созданную ВМ:

xm create -c /etc/xen/test1.cfg


Using config file "/etc/xen/test1.cfg".
Started domain proxy1
Linux version 2.6.18-6-xen-vserver-686 (Debian 2.6.18.dfsg.1-18etch1) (waldi@debian.org) (gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)) #1 SMP Sun Feb 10 22:52:33 UTC 2008
BIOS-provided physical RAM map:
Xen: 0000000000000000 - 0000000010800000 (usable)
0MB HIGHMEM available.
264MB LOWMEM available.
ACPI in unprivileged domain disabled
Built 1 zonelists. Total pages: 67584
Kernel command line: root=/dev/sda1 ro
Enabling fast FPU save and restore... done.
Enabling unmasked SIMD FPU exception support... done.
Initializing CPU#0
PID hash table entries: 2048 (order: 11, 8192 bytes)
Xen reported: 1666.784 MHz processor.
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Software IO TLB disabled
vmalloc area: d1000000-f51fe000, maxmem 2d7fe000
Memory: 245180k/270336k available (1623k kernel code, 16608k reserved, 593k data, 148k init, 0k highmem)
Checking if this processor honours the WP bit even in supervisor mode... Ok.
Calibrating delay using timer specific routine.. 4168.85 BogoMIPS (lpj=8337707)
Security Framework v1.0.0 initialized
SELinux: Disabled at boot.
Capability LSM initialized
Mount-cache hash table entries: 512
CPU: L1 I cache: 32K, L1 D cache: 32K
CPU: L2 cache: 2048K
Checking 'hlt' instruction... OK.
SMP alternatives: switching to UP code
Freeing SMP alternatives: 16k freed
Brought up 1 CPUs
migration_cost=0
checking if image is initramfs... it is
Freeing initrd memory: 10472k freed
Grant table initialized
NET: Registered protocol family 16
Brought up 1 CPUs
PCI: setting up Xen PCI frontend stub
ACPI: Interpreter disabled.
Linux Plug and Play Support v0.97 (c) Adam Belay
pnp: PnP ACPI: disabled
xen_mem: Initialising balloon driver.
PCI: System does not support PCI
PCI: System does not support PCI
NET: Registered protocol family 2
IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
TCP established hash table entries: 16384 (order: 5, 131072 bytes)
TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
TCP: Hash tables configured (established 16384 bind 8192)
TCP reno registered
audit: initializing netlink socket (disabled)
audit(1208525483.574:1): initialized
VFS: Disk quotas dquot_6.5.1
Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
Initializing Cryptographic API
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize
Xen virtual console successfully installed as tty1
Event-channel device installed.
netfront: Initialising virtual ethernet driver.
PNP: No PS/2 controller found. Probing ports directly.
i8042.c: No controller found.
mice: PS/2 mouse device common for all mice
TCP bic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
NET: Registered protocol family 8
NET: Registered protocol family 20
Using IPI No-Shortcut mode
Registering block device major 8
netfront: device eth0 has flipping receive path.
Freeing unused kernel memory: 148k freed
Loading, please wait...
Begin: Loading essential drivers... ...
Done.
Begin: Running /scripts/init-premount ...
FATAL: Error inserting fan (/lib/modules/2.6.18-6-xen-vserver-686/kernel/drivers/acpi/fan.ko): No such device
FATAL: Error inserting thermal (/lib/modules/2.6.18-6-xen-vserver-686/kernel/drivers/acpi/thermal.ko): No such device
Done.
Begin: Mounting root file system... ...
Begin: Running /scripts/local-top ...
Done.
Begin: Running /scripts/local-premount ...
Done.
kjournald starting. Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.
Begin: Running /scripts/local-bottom ...
Done.
Done.
Begin: Running /scripts/init-bottom ...
Done.
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
INIT: version 2.86 booting
* Mount point '/dev/shm' does not exist. Skipping mount.
Activating swap...Adding 262136k swap on /dev/sda2. Priority:-1 extents:1 across:262136k
done.
Checking root file system...fsck 1.40-WIP (14-Nov-2006)
/dev/sda1: clean, 19280/1048576 files, 144102/2097152 blocks
done.
EXT3 FS on sda1, internal journal
Setting the system clock..
Cleaning up ifupdown....
Loading kernel modules...done.
Loading device-mapper supportdevice-mapper: ioctl: 4.7.0-ioctl (2006-06-24) initialised: dm-devel@redhat.com
.
Checking file systems...fsck 1.40-WIP (14-Nov-2006)
done.
Setting kernel variables...done.
Mounting local filesystems...done.
Activating swapfile swap...done.
Setting up networking....
Configuring network interfaces...done.
INIT: Entering runlevel: 2
Starting system log daemon: syslogd.
Starting kernel log daemon: klogd.
* Not starting internet superserver: no services enabled.
Starting OpenBSD Secure Shell server: sshdNET: Registered protocol family 10
lo: Disabled Privacy Extensions
IPv6 over IPv4 tunneling driver
.
Starting periodic command scheduler: crond.

Debian GNU/Linux 4.0 test1 tty1

test1 login: root
Linux test1 2.6.18-6-xen-vserver-686 #1 SMP Sun Feb 10 22:52:33 UTC 2008 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
test1:~#

Всё, на этом закончили. Несколько команд для управления ВМ:

sm list
xm console test1
xm restart test1
xm pause test1
xm unpause test1

Также желательно сконфигурировать локаль внутри ВМ, аналогично вышеописанному.

Дополнение:
Через некоторое время на одной из виртуалок domU проявилась проблема:

May 14 19:45:51 mx2 kernel: Buffer I/O error on device sda1, logical block 1844844
May 14 19:45:51 mx2 kernel: lost page write due to I/O error on sda1

Удалось решить обновлением XEN на версию 3.2.1 из backports:

cat /etc/apt/sources.list
#
#
deb http://ftp.us.debian.org/debian/ etch main
deb-src http://ftp.us.debian.org/debian/ etch main
deb http://security.debian.org/ etch/updates main contrib
deb-src http://security.debian.org/ etch/updates main contrib
#For XEN 3.2.1
deb http://www.backports.org/debian/ etch-backports main contrib non-free


dpkg -l | grep xen
ii dtc-xen 0.3.18-1 SOAP daemon and scripts to allow control pan
ii libc6-xen 2.3.6.ds1-13etch5 GNU C Library: Shared libraries [Xen version
ii libxenstore3.0 3.2.0-3~bpo4+2 Xenstore communications library for Xen
ii linux-image-2.6.18-6-xen-686 2.6.18.dfsg.1-18etch4 Linux 2.6.18 image on i686
ii linux-image-2.6.18-6-xen-vserver-686 2.6.18.dfsg.1-18etch4 Linux 2.6.18 image on i686
ii linux-modules-2.6.18-6-xen-686 2.6.18.dfsg.1-18etch4 Linux 2.6.18 modules on i686
ii linux-modules-2.6.18-6-xen-vserver-686 2.6.18.dfsg.1-18etch4 Linux 2.6.18 modules on i686
rc xen-hypervisor-3.0.3-1-i386 3.0.3-0-4 The Xen Hypervisor on i386
rc xen-hypervisor-3.0.3-1-i386-pae 3.0.3-0-4 The Xen Hypervisor on i386 with pae
ii xen-hypervisor-3.2-1-i386 3.2.0-3~bpo4+2 The Xen Hypervisor on i386
ii xen-tools 3.9-2~bpo40+1 Tools to manage Debian XEN virtual servers
ii xen-utils-3.2-1 3.2.0-3~bpo4+2 XEN administrative tools
ii xen-utils-common 3.2.0-1~bpo4+1 XEN administrative tools - common files
ii xenstore-utils 3.2.0-3~bpo4+2 Xenstore utilities for Xen

Установка из backports: http://www.backports.org/dokuwiki/doku.php?id=instructions

Комментариев нет:

Отправить комментарий