The Perfect Xen 3.0.3 Setup For Debian Sarge - Page 4
4.4.2 Create And Start The First Virtual MachineNow we create our first virtual machine, vm01, by making a copy of our template: cp -pf /vserver/images/vm_base.img /vserver/images/vm01.img Then we create a Xen configuration file for vm01, /etc/xen/vm01-config.sxp: vi /etc/xen/vm01-config.sxp
In memory you specify the RAM you want to allocate to that virtual machine (here: 32 MB). In disk you specify which images to use and how to mount them (i.e., under which partition, e.g. hda1). This must correspond to the settings in the image's /etc/fstab file! In the network settings we tell vm01 that its IP address is 192.168.0.101 (the main machine's (dom0) IP address is 192.168.0.100), and what hostname it has. If you want vm01 to start automatically at the next boot of the system, then do this: ln -s /etc/xen/vm01-config.sxp /etc/xen/auto Now let's start vm01: xm create -c /etc/xen/vm01-config.sxp If nothing's wrong, vm01 should come up without problems, and you should be able to login. By running iptables -L you should see that iptables is available on vm01. To leave vm01's shell, type CTRL+] if you are at the console, or CTRL+5 if you're using PuTTY. From the outside you should be able to connect to 192.168.0.101 via SSH. Back on dom0's shell, you can shutdown vm01 by running xm shutdown vm01 Here are some other Xen commands: xm create -c /path/to/config - Start a virtual machine. Now you can reboot the main system to see if vm01 comes up automatically (if you created the symlink in /etc/xen/auto): shutdown -r now
4.4.3 Creating And Customizing Further Virtual MachinesYou can create further virtual machines simply by copying the image template: cp -pf /vserver/images/vm_base.img /vserver/images/vm02.img Then you have to create a Xen configuration file, e.g. /etc/xen/vm02-config.sxp: vi /etc/xen/vm02-config.sxp
Start the machine: xm create -c /etc/xen/vm02-config.sxp If you get an error like this: Using config file "/etc/xen/vm02-config.sxp". then this means that the virtual machine tried to use more memory than is available. Edit the configuration file of the virtual machine and decrease the value of memory and try to start it again. Create a symlink, if you want to start the virtual machine at boot time: ln -s /etc/xen/vm02-config.sxp /etc/xen/auto Now you can log into each machine, e.g. via SSH, and configure it as if it was a normal system. You can create as many virtual machines as you like. Your hardware's the limit!
|
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
19 hours 48 min ago
21 hours 17 min ago
1 day 51 min ago
1 day 3 hours ago
1 day 6 hours ago
1 day 7 hours ago
1 day 7 hours ago
1 day 8 hours ago
1 day 9 hours ago
1 day 10 hours ago