본문 바로가기

Technical/Cloud, Virtualization, Containers

OpenSuse 11.2 dom0 - PV domU VM creation from CentOS5.4 DVD & http setup


오랜만에 Posting...^_^;;;

Sorry for all these English notations.

1. Get Cent5.4 DVD iso file be prepared in local disk(download it!)
 # wget http://blahblah/*.iso  => save it to /home/vmimg_src/cent54dvd.iso

2. Prepare sparse file for disk image & get filesystem ready(24GB virtual disk image)
 # dd if=/dev/zero of=/home/vmimg/centvdisk.img bs=6k seek=4096k count=1
 # mkfs.ext3 /home/vmimg/centvdisk,img

3. Mount iso image to loop device
 # losetup -f => Check free loop device number, consider its loop7
 # losetup -f /home/vmimg_src/cent54dvd.iso => assign iso to /dev/loop7
 # mkdir -p /mnt/iso/cent54dvd
 # mount -t iso9660 /dev/loop7 /mnt/iso/cent54dvd

4. Make httpd be prepared and copy all the installation files
 # mkdir /home/www/cent54
 # vi /etc/apache2/default-server.conf, modify
<Directory “/home/www/cent54”>
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
 # /etc/init.d/apache2 restart
 # cp -a /mnt/iso/cent54dvd /home/www/cent54

5. Make VM boot loader be prepared
 # cd /home/vmimg
 # mkdir cent54boot; cd cent54boot
 # cp /home/www/cent54/images/xen/vmlinuz ./vmlinuz-install-xen
 # cp /home/www/cent54/images/xen/initrd.img ./initrd-install-xen

6. edit CentOS PV domu configuration
 # cd ~/xen_config
 # vi cent54domu.cfg
-----------------------------------------------------------------------------
name='centOSdomU'
# After installation boot, disable these 2 lines
kernel='/home/vmimg/cent54boot/vmlinuz-install-xen'
ramdisk='/home/vmimg/cent54boot/initrd-install-xen'
# After installation boot, enable below 1 line
#bootloader='/usr/bin/pygrub'
extra='text'
memory=1024
vcpus=1
# After installation boot, disable below 1 line
disk=['file:/home/vmimg/centvdisk.img,xvda,w']
# After installation boot, enable below 1 line
#disk=['tap:aio:/home/vmimages/centvdisk.img,xvda,w']
audio=0
vif=['bridge=br0']
# After installation boot, disable below 1 line
on_poweroff='destroy'
on_reboot='restart'
on_crash='restart'
-----------------------------------------------------------------------------
* As for this process, U need to make root/swap partition manually

7. Create VM with xm command
 # xm create -c cent54domu.cfg => installation starts
   * If  reboot starts after installation, kill it!
 # xm destroy domain_number
 # cp cent54domu.cfg cent54domu_init.cfg
 # vi cent54domu.cfg => Do as the comment says & save it
 # xm create cent54domu.cfg

  * Now VM starts as a normal boot process
  * All done.