The Perfect Xen 3.0.3 Setup For Debian Sarge - Page 7
5.2 Create A Virtual Machine (domU)(Please note: image creation depends on whether you installed Xen from the sources or from the binaries. If you installed Xen from the sources, please refer to chapter 4.4!) Next we create an image of a virtual machine. It will be a basic Debian system. This image will be the template for all our virtual machines. Whenever we want to create a new virtual machine, we just copy this image, create a new Xen configuration file and boot the copy, and then we can go on and configure the copy to our needs (e.g install a mail server, web server, DNS server, etc. on it). All our images will be on the /vserver partition which should be the largest one we have. mkdir /vserver/vm_base Now we create a 1 GB image file and a 500 MB swap image. In the end the virtual machines will have 1 GB space and 500 MB swap. These are just example values, in the real world you might want to have more space for your virtual machines (e.g. between 5 and 30 GB), so just increase the value of count to create larger images. dd if=/dev/zero of=/vserver/images/vm_base.img bs=1024k count=1000 Then we format /vserver/images/vm_base.img with ext3 and vm_base-swap.img with swap: mkfs.ext3 /vserver/images/vm_base.img When you see the following, answer with y: /vserver/images/mail.img is not a block special device. mkswap /vserver/images/vm_base-swap.img
5.2.1 Install A Basic Debian In The ImageIn order to install a basic Debian system in our image, we mount the image, run debootstrap and a few other commands: mount -o loop /vserver/images/vm_base.img /vserver/vm_base chroot /vserver/vm_base You are asked the following question: Archive access method for apt: <-- http Then select a mirror close to you. Afterwards, edit /etc/apt/sources.list and replace testing with stable. That's how my /etc/apt/sources.list looks: vi /etc/apt/sources.list
Then run apt-get update Now we set up our locales. If we do not do this now, we will see some ugly warnings during base-config like these:
They are not serious, but ugly... So we run apt-get install localeconf You will be asked a few questions: Select locales to be generated. <-- en_US ISO-8859-1 Next run base-config You will see a menu with installation options. This is what we do:
Don't deal with the other menu items, you don't need them. Then we remove nfs-common and delete /etc/hostname: apt-get remove nfs-common Then edit /etc/fstab. It should look like this: vi /etc/fstab
Then create /etc/hosts: vi /etc/hosts
Then do this: mkdir /lib/modules/2.6.16.29-xen Next we edit the scripts /etc/init.d/hwclock.sh and /etc/init.d/hwclockfirst.sh and add the line exit 0 right at the beginning because otherwise these two scripts will really slow down the bootup of our virtual machines: vi /etc/init.d/hwclock.sh
vi /etc/init.d/hwclockfirst.sh
Now we leave the chroot environment: exit Then we unmount the image: mv /vserver/vm_base/lib/tls /vserver/vm_base/lib/tls.disabled Now our virtual machine image template is ready!
|
Join the discussion.
www.seamlessenterprise.com
IP Convergence
Integrate your wireless and wireline networks.
Learn how from the experts at Sprint.
www.seamlessenterprise.com
Wireless & Wireline Integration
Thoughts, strategies and solutions: join the discussion
www.seamlessenterprise.com
Unified Communications 2009
Join the Discussion. Now.
www.seamlessenterprise.com





print: 
Recent comments
10 hours 26 min ago
11 hours 54 min ago
15 hours 29 min ago
18 hours 22 min ago
21 hours 20 min ago
22 hours 1 min ago
22 hours 15 min ago
23 hours 14 min ago
1 day 20 min ago
1 day 53 min ago