Virtualization With Xen On Debian Lenny (AMD64)
Virtualization With Xen On Debian Lenny (AMD64)Version 1.0 This tutorial provides step-by-step instructions on how to install Xen on a Debian Lenny (5.0) system (AMD64). Xen lets you create guest operating systems (*nix operating systems like Linux and FreeBSD), so called "virtual machines" or domUs, under a host operating system (dom0). Using Xen you can separate your applications into different virtual machines that are totally independent from each other (e.g. a virtual machine for a mail server, a virtual machine for a high-traffic web site, another virtual machine that serves your customers' web sites, a virtual machine for DNS, etc.), but still use the same hardware. This saves money, and what is even more important, it's more secure. If the virtual machine of your DNS server gets hacked, it has no effect on your other virtual machines. Plus, you can move virtual machines from one Xen server to the next one. I do not issue any guarantee that this will work for you!
1 Preliminary NoteI'm using a Debian Lenny system (x86_64) with the hostname server1.example.com and the IP address 192.168.0.100 as the host system (dom0). (The setup might differ slightly if you are on an i386 system.) I will use Debian Lenny for the virtual machines (domU) as well. This guide will explain how to set up image-based virtual machines and also LVM-based virtual machines.
2 Installing XenTo install Xen, we simply run apt-get install xen-hypervisor-3.2-1-amd64 xen-linux-system-2.6.26-1-xen-amd64 xen-utils-3.2-1 xenstore-utils xenwatch xen-shell xen-tools Afterwards we open /etc/modules and make sure that we have the line loop max_loop=64 in it (this step is needed only if you want to create image-based virtual machines - you can skip it if you want to create LVM-based virtual machines): vi /etc/modules
Next we open /etc/xen/xend-config.sxp... vi /etc/xen/xend-config.sxp ... and uncomment the line (network-script network-bridge) and comment out the line (network-script network-dummy). Also make sure that the line (vif-script vif-bridge) is enabled:
Then reboot the system: reboot Run uname -r and your new Xen kernel should show up: server1:~# uname -r
3 Creating Image-Based Virtual MachinesWe will use xen-tools to create virtual machines. xen-tools make it very easy to create virtual machines - please read this tutorial to learn more: http://www.howtoforge.com/xen_tools_xen_shell_argo. We've already installed xen-tools in the previous step (chapter 2). Now we edit /etc/xen-tools/xen-tools.conf. This file contains the default values that are used by the xen-create-image script unless you specify other values on the command line. I changed the following values and left the rest untouched: vi /etc/xen-tools/xen-tools.conf
The dir line specifies where the virtual machine images will be stored. dist specifies the distribution to be installed in the virtual machines (Debian Lenny) (there's a comment in the file that explains what distributions are currently supported). The passwd = 1 line makes that you can specify a root password when you create a new guest domain. In the mirror line specify a Debian mirror close to you. Make sure you specify a gateway, netmask, and broadcast address. If you don't, and you don't specify a gateway and netmask on the command line when using xen-create-image, your guest domains won't have networking even if you specified an IP address! It is very important that you add the line serial_device = hvc0 because otherwise your virtual machines might not boot properly! Before we go on, we must create the directory where the virtual machine images should be stored: mkdir /home/xen Now let's create our first guest domain, xen1.example.com, with the IP address 192.168.0.101: xen-create-image --hostname=xen1.example.com --size=4Gb --swap=256Mb --ip=192.168.0.101 --memory=128Mb --arch=amd64 --role=udev Options that you specify on the command line override the settings in /etc/xen-tools/xen-tools.conf. Options that are not specified on the command line are taken from /etc/xen-tools/xen-tools.conf. Please make sure that you add --role=udev, or your virtual machine might not boot properly! (To learn more about the available options, take a look at the xen-create-image man page: man xen-create-image ) The xen-create-image command will now create the xen1.example.com virtual machine for us. This can take a few minutes. The output should be similar to this one: server1:~# xen-create-image --hostname=xen1.example.com --size=4Gb --swap=256Mb --ip=192.168.0.101 --memory=128Mb --arch=amd64 --role=udev There should now be a xen1.example.com configuration file - /etc/xen/xen1.example.com.cfg. Take a look at it to become familiar with virtual machines configuration files: vi /etc/xen/xen1.example.com.cfg
(Please note: if you have a dual-core or quad-core CPU and want the virtual machine to use all CPU cores, please add the line vcpus = '2' or vcpus = '4' to the configuration file.) To start the virtual machine, run xm create /etc/xen/xen1.example.com.cfg Run xm console xen1.example.com to log in on that virtual machine (type CTRL+] if you are at the console, or CTRL+5 if you're using PuTTY to go back to dom0), or use an SSH client to connect to it (192.168.0.101). To get a list of running virtual machines, type xm list The output should look like this: server1:~# xm list To shut down xen1.example.com, do this: xm shutdown xen1.example.com If you want xen1.example.com to start automatically at the next boot of the system, then do this: ln -s /etc/xen/xen1.example.com.cfg /etc/xen/auto Here are the most important Xen commands: xm create -c /path/to/config - Start a virtual machine. A list of all virtual machines that were created with the xen-create-image command is available under xen-list-images server1:~# xen-list-images To learn more about what you can do with xen-tools, take a look at this tutorial: http://www.howtoforge.com/xen_tools_xen_shell_argo
|
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
6 hours 48 min ago
8 hours 17 min ago
11 hours 51 min ago
14 hours 45 min ago
17 hours 42 min ago
18 hours 23 min ago
18 hours 38 min ago
19 hours 37 min ago
20 hours 42 min ago
21 hours 16 min ago