ゲストOSとなるドメインUにDebianを使用します。
仮想ディスク作成
# dd if=/dev/zero of=/xen/server01_img bs=1M count=10240
# dd if=/dev/zero of=/xen/server01_swap bs=1M count=512
# mkfs.ext3 /xen/server01_img
# mkswap /xen/server01_swap
of=xxxx :イメージファイルの保存場所
仮想ディスクに10G使用してSWAPには512M使用
容量調整はcountの数字を変更します。
sargeの環境インストール
# mount -o loop /xen/server01_img /mnt
# debootstrap --arch i386 sarge /mnt http://ftp.jp.debian.org/debian
// I: Base system installed successfully, と出れば完了
# echo hostname > /mnt/etc/mailname
# echo hostname > /mnt/etc/hostname
# cp /etc/hosts /etc/resolv.conf /mnt/etc
# vi /mnt/etc/hosts
// 環境に合わせて修正
# vi /mnt/etc/network/interfaces
//固定IP時
--- ここから ---
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.10
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.254
--- ここまで ---
//DHCP時
--- ここから ---
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
--- ここまで ---
fstab修正
# vi /mnt/etc/fstab
--- ここから ---
# UNCONFIGURED FSTAB FOR BASE SYSTEM
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/sda1 / ext3 errors=remount-ro 0 1
/dev/sda2 none swap sw 0 0
--- ここまで ---
ドメインUの設定ファイル修正
# vi /etc/xen/server01.conf
--- ここから ---
kernel = "/boot/vmlinuz-2.6.12-xenU"
memory = 256 //環境に合わせ変更してください。
name = "server01"
nics=1
vif = [ 'mac=aa:00:00:00:00:11, bridge=xenbr0' ]
netmask="255.255.255.0"
gateway="192.168.0.254"
ip="192.168.0.10"
disk = [ 'file:/xen/server01.img,sda1,w','file:/xen/server01.swap,sda2,w' ]
root = "/dev/sda1 ro"
--- ここまで ---
■ドメインUの起動
# umount /mnt
# /etc/rc.d/init.d/xend start
# xm create /etc/xen/server01.conf -c
-c はコンソールにいまのttyを接続するという意味で
コンソール上で起動の過程がずらずら表示されます。
抜けるのは Ctrl + ] で。
■確認
# xm list
Name ID Mem(MiB) VCPUs State Time(s)
Domain-0 0 64 1 r----- 31927.3
server01 1 256 1 -b---- 2618.3
と出てればOK
参考