Location : VISA Research Lab »
InstallXen
1. Install Ubuntu on your host system
After your Ubuntu is installed, remove network-manager since it may conflict with Xen's networking setting:
2. Install Xen from source package
2.1. Install the packages needed by Xen
Run:
2.2. Download Xen
Download the latest release of Xen from http://www.xen.org/products/xen_source.html
(In the rest of this tutorial, we assume that the Xen version number is 3.3.0 and the Linux kernel version supported by Xen is 2.6.18.)
2.3. Build Xen kernel
Run:
(The above process will build eveything inculding Xen and a kernel that can be used by the VMs. It will take a while. You can use the -j flag for the make command to speed it up, if you have more than one CPU/core. For example, if you have dual cores, you can run make world -j 2.)
Now Xen is installed. In order to start the Xen services at boot time, do the following:
We need a ramdisk for our new Xen kernel, therefore we do the following:
Next we add our new kernel to Grub, our bootloader. We can do this with one simple command:
update-grub
Now reboot the system. At the boot prompt, Grub should now list Xen 3.3.0 as the first kernel and boot it automatically.
If your system comes up without problems, then everything is fine! Log in as usual and you are in dom0.
(Note:
If your system cannot be booted into the new kernel, chances are you are missing some device drivers, particularly the drivers for your hard disks. To solve this problem, you can reconfigure your kernel to include the necessary drivers using the following command:
)
You can now use the 2.6.18-xen kernel for both the host system and the virtual machines, or you compile a dom0 kernel and a domU kernel (which allows you to create special kernels for each use case).
(The kernel we built above is a full kernel that can be used for both dom0 and domU. You can also build a kernel specifically for domU by run: make KERNELS="linux-2.6-xenU". The kernel source code is under the build-linux-2.6.18-xen_x86_32 direcotry. You can work on it as well as build and deploy it just like a regular Linux kernel. Make world is only needed for the first time you build everything; afterwards, you only need to build the things that you have changed. Refer to the README and Makefile for more details.)
3. Creating Virtual Machines (domU)
We will use xen-tools to create VMs. xen-tools make it very easy to create virtual machines. First, we install xen-tools:
Next we edit /etc/xen-tools/xen-tools.conf. This file contains the default values that are used by the xen-create-image script to create VMs. You can also specify the values on the command line when you run xen-create-image. You can changed some of them as follows and left the rest untouched. (Read the comnents in the file for explanation about the values.)
Set the default install-method to debootstrap:
Set the default distribution to install to your favorite Debian/Ubuntu (Here we use feisty):
Set the networking to use DHCP:
Set the default mirror for debootstrap to http://archive.ubuntu.com/ubuntu:
Uncomment the passwd line so you can specify a root password for the VM:
Comment out the initrd line since it is not needed:
Now let's create our first guest domain, xen1:
(To learn more about the available options, take a look at the xen-create-image man page).
You will be prompted to input the root password for the VM. If you see "All done" at the end, you've got your first Xen VM! Its configurations are stored in file /etc/xen/xen1, and its disks are stored in /home/xen/domains/xen1. (If the VM creation is not successful, check the log for errors.)
Create a guest domain from your new VM:
You will see the guest's booting process just like a regular Linux, and in the end, you can log in the guest's console as root. You can get out of the guest's console by typing CTRL+] or CTRL+5; you can get back into the console by run:
(Note:
If you have trouble with the guest's console, you may need to change the console's configuration. To do that, add the following line in your VM's configuration file:
)
To get a list of running virtual machines, type
To shut down xen1, do this:
If you want vm01 to start automatically at the next boot of the system, then do this:
(Run xm without argumetns to find out what commands you can use to manage the VMs.)
A list of all virtual machines that were created with the xen-create-image command is available under:
(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.)
InstallXen
1. Install Ubuntu on your host system
After your Ubuntu is installed, remove network-manager since it may conflict with Xen's networking setting:
apt-get remove network-manager
2. Install Xen from source package
2.1. Install the packages needed by Xen
Run:
apt-get install libssl-dev libx11-dev gettext libncurses-dev python-dev iproute bridge-utils python-twisted debootstrap patch texinfo libc6-dev mercurial gawk initramfs-tools bin86 bcc
2.2. Download Xen
Download the latest release of Xen from http://www.xen.org/products/xen_source.html
(In the rest of this tutorial, we assume that the Xen version number is 3.3.0 and the Linux kernel version supported by Xen is 2.6.18.)
2.3. Build Xen kernel
Run:
cd xen-3.3.0/
make world
make install
mv /lib/tls /lib/tls.disabled
make world
make install
mv /lib/tls /lib/tls.disabled
(The above process will build eveything inculding Xen and a kernel that can be used by the VMs. It will take a while. You can use the -j flag for the make command to speed it up, if you have more than one CPU/core. For example, if you have dual cores, you can run make world -j 2.)
Now Xen is installed. In order to start the Xen services at boot time, do the following:
update-rc.d xend defaults 20 21
update-rc.d xendomains defaults 21 20
update-rc.d xendomains defaults 21 20
We need a ramdisk for our new Xen kernel, therefore we do the following:
mkinitramfs -o /boot/initrd.img-2.6.18.8-xen 2.6.18.8-xen
Next we add our new kernel to Grub, our bootloader. We can do this with one simple command:
update-grub
Now reboot the system. At the boot prompt, Grub should now list Xen 3.3.0 as the first kernel and boot it automatically.
If your system comes up without problems, then everything is fine! Log in as usual and you are in dom0.
(Note:
If your system cannot be booted into the new kernel, chances are you are missing some device drivers, particularly the drivers for your hard disks. To solve this problem, you can reconfigure your kernel to include the necessary drivers using the following command:
make linux-2.6-xen-config CONFIGMODE=menuconfig (or xconfig)
Then you build and install the kernel as follows:
make linux-2.6-xen-build
make linux-2.6-xen-install
Then you build and install the kernel as follows:
make linux-2.6-xen-build
make linux-2.6-xen-install
)
You can now use the 2.6.18-xen kernel for both the host system and the virtual machines, or you compile a dom0 kernel and a domU kernel (which allows you to create special kernels for each use case).
(The kernel we built above is a full kernel that can be used for both dom0 and domU. You can also build a kernel specifically for domU by run: make KERNELS="linux-2.6-xenU". The kernel source code is under the build-linux-2.6.18-xen_x86_32 direcotry. You can work on it as well as build and deploy it just like a regular Linux kernel. Make world is only needed for the first time you build everything; afterwards, you only need to build the things that you have changed. Refer to the README and Makefile for more details.)
3. Creating Virtual Machines (domU)
We will use xen-tools to create VMs. xen-tools make it very easy to create virtual machines. First, we install xen-tools:
apt-get install xen-tools
Next we edit /etc/xen-tools/xen-tools.conf. This file contains the default values that are used by the xen-create-image script to create VMs. You can also specify the values on the command line when you run xen-create-image. You can changed some of them as follows and left the rest untouched. (Read the comnents in the file for explanation about the values.)
Set the default install-method to debootstrap:
install-method = debootstrap
Set the default distribution to install to your favorite Debian/Ubuntu (Here we use feisty):
dist = feisty
Set the networking to use DHCP:
dhcp = 1
Set the default mirror for debootstrap to http://archive.ubuntu.com/ubuntu:
mirror = http://archive.ubuntu.com/ubuntu
Uncomment the passwd line so you can specify a root password for the VM:
passwd = 1
Comment out the initrd line since it is not needed:
# initrd = /boot/initrd.img-2.6.16-2-xen-686
Now let's create our first guest domain, xen1:
xen-create-image --hostname=xen1
(To learn more about the available options, take a look at the xen-create-image man page).
You will be prompted to input the root password for the VM. If you see "All done" at the end, you've got your first Xen VM! Its configurations are stored in file /etc/xen/xen1, and its disks are stored in /home/xen/domains/xen1. (If the VM creation is not successful, check the log for errors.)
Create a guest domain from your new VM:
xm create -c /etc/xen/xen1.cfg
You will see the guest's booting process just like a regular Linux, and in the end, you can log in the guest's console as root. You can get out of the guest's console by typing CTRL+] or CTRL+5; you can get back into the console by run:
(Note:
If you have trouble with the guest's console, you may need to change the console's configuration. To do that, add the following line in your VM's configuration file:
extra = 'xencons=tty'
)
xm console xen1
To get a list of running virtual machines, type
xm list
To shut down xen1, do this:
xm shutdown xen1
If you want vm01 to start automatically at the next boot of the system, then do this:
ln -s /etc/xen/xen1.cfg /etc/xen/auto
(Run xm without argumetns to find out what commands you can use to manage the VMs.)
A list of all virtual machines that were created with the xen-create-image command is available under:
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.)
Sidebar
News
- NSF Award on Cloud Resource Management
- vMoodle goes live
- DOD Award on Real-time Virtualization Research
- FAST2013 Presentations
- Fall 2012 Senior Project presentation
- Dr. Zhao Awarded Excellence in Student Mentoring
- ICAC2012 Presentation
- FeedbackComputing2012 Presentation
- Dm-cache in the Cloud (Call for beta testing)
- VISA undergraduates awarded a CREU grant
