- xen manual yum groupinstall "Virtualization" yum -y install "*xen*" --exclude="*drbd*" echo "alias scsi_hostadapter xenblk" >>/etc/modprobe.conf grep -lr "DEFAULTKERNEL=kernel" /etc/sysconfig/kernel | xargs sed -i 's/DEFAULTKERNEL=kernel/DEFAULTKERNEL=kernel-xen/g' grep -lr "default=." /boot/grub/menu.lst | xargs sed -i 's/default=./default=0/g' reboot mount -t iso9660 -o loop iso/CentOS-5.3-x86_64-bin-DVD.iso /var/www/html/centos virt-install \ --paravirt \ --name=web1 \ --ram=2000 \ --file=/home/web1 \ --file-size=10 \ --location=http://192.168.11.1/centos \ --nographics \ --nonsparse or dd if=/dev/zero of=vm2.img bs=1k seek=3000k count=1 mkfs -t ext3 vm1.img mount -o loop vm1.img /mnt cp -ax /{root,dev,var,etc,usr,bin,sbin,lib,lib64} /mnt cp -ax /{root,dev,var,etc,usr,bin,sbin,lib} /mnt mkdir /mnt/{tmp,home,proc,sys} chmod 777 /mnt/mtp http://wiki.xensource.com/xenwiki/Fedora5Xen0DomU mkinitrd --with=xennet --preload=xenblk /boot/$KERNEL-$DOMNAME.img $KERNEL mkinitrd --with=xennet --preload=xenblk initrd.vm2.img 2.6.18-53.1.14.el5xen [root@localhost xen]# cat /etc/modprobe.conf alias eth0 xennet alias scsi_hostadapter xenblk [root@localhost ~]# cat /etc/sysconfig/kernel DEFAULTKERNEL=kernel-xen [root@localhost xen]# cat /image/vm1 kernel = "/boot/vmlinuz-2.6.18-53.1.14.el5xen" ramdisk = "/boot/initrd-2.6.18-53.1.14.el5xen.img" memory = 1024 name = "vm1" vif = [ 'bridge=xenbr0' ] disk = [ 'tap:aio:/images/vm1.img,hda1,w' ] root = "/dev/hda1 ro" [root@localhost xen]# cat /mnt/etc/fstab /dev/hda1 / ext3 defaults 1 1 #LABEL=/boot /boot ext3 defaults 1 2 #devpts /dev/pts devpts gid=5,mode=620 0 0 #tmpfs /dev/shm tmpfs defaults 0 0 #proc /proc proc defaults 0 0 #sysfs /sys sysfs defaults 0 0 #/dev/VolGroup00/LogVol01 swap swap defaults 0 0 xm create -c vm1.img - Other Command xm list xm mem-set 0 1024 brctl show depmod == debin aptitude install xen-linux-system-2.6.26-1-xen-686 xen-tools vim /etc/xen/xend-config.sxp (network-script network-bridge) #(network-script network-dummy) mkdir /home/xen vim /etc/xen-tools/xen-tools.conf dir = /home/xen debootstrap = 1 dist = etch gateway = 192.168.1.1 netmask = 255.255.255.0 kernel = /boot/vmlinuz-2.6.18-6-xen-amd64 initrd = /boot/initrd.img-2.6.18-6-xen-amd64 xen-create-image --ip 192.168.11.51 --hostname condor1 xm create -c /etc/xen/xen01.cfg 自動起動 mkdir /etc/xen/auto ln -s /etc/xen/xen01.cfg /etc/xen/auto/ NICが2枚ある場合は以下 cp network-bridge network-bridge.xen vim /etc/xen/scripts/multi-network-bridge # !/bin/sh # Exit if anything goes wrong set -e # First arg is operation. OP=$1 shift script=/etc/xen/scripts/network-bridge.xen case ${OP} in start) $script start vifnum=0 bridge=xenbr0 netdev=eth0 $script start vifnum=1 bridge=xenbr1 netdev=eth1 ;; stop) $script stop vifnum=0 bridge=xenbr0 netdev=eth0 $script stop vifnum=1 bridge=xenbr1 netdev=eth1 ;; status) $script status vifnum=0 bridge=xenbr0 netdev=eth0 $script status vifnum=1 bridge=xenbr1 netdev=eth1 ;; *) echo 'Unknown command: ' ${OP} echo 'Valid commands are: start, stop, status' exit 1 esac chmod 755 /etc/xen/scripts/multi-network-bridge vim /xen/xend-config.sxp #(network-script network-bridge) (network-script multi-network-bridge) /etc/xen/scripts/network-bridge stop /etc/xen/scripts/multi-network-bridge start vim /etc/xen/xen01.cfg vif = [ 'bridge=xenbr0','bridge=xenbr1']