31
Xen Virtualization Last Update 2011.01.01 1.0.0 1 Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com

Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Embed Size (px)

Citation preview

Page 1: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Xen VirtualizationLast Update 2011.01.01

1.0.0

1Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com

Page 2: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Objectives of This Section

• Learn– About the Xen approach to virtualization

2Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com

Page 3: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Xen Virtualization

• This will be a basic discussion of Xen virtualization mostly because it is based on Linux

• Despite using Linux off and on since 1995 I really do not like it

• It is just a pain to install and use compared to Windows as we will see another example of here

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 3

Page 4: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Xen Virtualization

• I realize the ability to script actions is useful in large environments such as one would see in virtualization, but I still find Linux to be irritating every time I use it

• So to really find out about Xen I suggest consulting this book

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 4

Page 5: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Xen Virtualization

• The Book of Xen by Takemura and Crawford

• It has a few years on it now, but it is still very useful as the move from version 3 to 4 does not appear to have fundamentally altered how Xen works

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 5

Page 6: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Xen Virtualization

• There is Xen and there is Xen• Here we are talking about the free version

from www.xen.org• There is another set of programs both free

and paid available from Citrix who purchased Xen back in 2007

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 6

Page 7: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Xen Virtualization

• They left the open source product we are covering here

• The also offer a free version called XenServer

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 7

Page 8: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Xen Architecture

• Xen is a bare metal virtualization method• It has three main layers

– Xen Hypervisor– Domain 0 or dom0– Domain U or domU

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 8

Page 9: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Xen Architecture

• The Xen hypervisor takes control of the physical hardware

• This is a paravirtualized hypervisor• The dom0 partition is used to manage the

guest operating systems stored in the various domU partitions

• A modified Linux kernel is used by dom0 itself

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 9

Page 10: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Xen Architecture

• A modified or unmodified operating system may be used in domU

• When modified these are called PV guests as they are paravirtualized

• They have no direct access to the hardware

• Linux and the various versions of Unix fit in this category

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 10

Page 11: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Xen Architecture

• Windows can be run unmodified• This is a HVM guest as they are fully

virtualized

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 11

Page 12: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Xen Architecture

• Xen calls their hypervisor a thin hypervisor as it does not use device drivers

• It uses dom0 for this• In contrast VMware does use device

drivers• Microsoft follows the Xen model• Here are the diagrams they show

illustrating this

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 12

Page 13: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Xen Architecture

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 13

Page 14: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

VMware Architecture

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 14

Page 15: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Microsoft Architecture

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 15

Page 16: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Xen Installation

• Let’s install Xen now• This example uses CentOS 5.5 installed

with the server defaults• CentOS provides built-in Xen support

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 16

Page 17: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

CentOS Installation

• To install CentOS– Boot from disk with the CentOS IOS on it– Install it as you prefer– The book and I used

• Default partitioning– Which creates a small /boot partition and devotes the

rest of the drive to an LVM group, with a logical volume for swap and a volume for root

• Default configuration for the GRUB boot loader• Default network configuration

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 17

Page 18: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

CentOS Installation

• Next select the time zone• Enter a password• Select the packages to load

– Required» Virtualization server package group

– Not required but as I am a GUI sort of person» GNOME desktop» Server-gui

– Select Next– After the reboot the normal Linux load occurs

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 18

Page 19: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

CentOS Installation

• After the ISO boots• Press Enter to use the graphical

installation process• The load begins showing the usually Linux

stuff ending in a character based GUI of sorts

• Bypass the media test by selecting Skip• A real GUI appears

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 19

Page 20: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

CentOS Installation

• Select Next• Select the language• Select the keyboard language• Setup the desired partitions in this case

the default is used• The partition layout is shown• Select Next

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 20

Page 21: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

CentOS Installation

• The GRUB setup screen is shown• Select Next• The network setup screen is shown• Select Next• The timezone screen is show• Select the timezone then Next• Enter a password• Select Next

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 21

Page 22: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Xen Installation

• Select the packages to load– In this case I selected

• Desktop – GNOME• Server – GUI• Virtualization

• Select Next• The installation is ready to begin• Select Next• The installation commences

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 22

Page 23: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

CentOS Installation

• At its conclusion Click Reboot• Remove the media from the drive• Go through the setup steps for CentOS• In this case it asks you to setup

– A firewall– Security Enhanced Linux– Kdump– The date and time

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 23

Page 24: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

CentOS Installation

– Create a regular user account– Setup the sound card– Load anything else

• Click Finish• My setup required a reboot• Login

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 24

Page 25: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Xen Installation

• And we have a bare metal hypervisor with in this case a GUI interface as I am a GUI person

• Select from the Applications menu System Tools Virtual Machine Manager– This is virt-manager

• We see the dom0 guest operating system shown as Domain-0

• Wasn’t that easy, even for LinuxCopyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 25

Page 26: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Creating a Virtual Machine

• Now let’s create a virtual machine• Select localhost• Click New• This starts the virtual machine wizard• One of the little Linux oddities pops up

here, which serves to remind me why I hate Linux

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 26

Page 27: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Creating a Virtual Machine

• You cannot load a paravirtualized guest operating system from a disc in a drive or from an IOS file on the physical hard drive

• Only a fully virtualized operating system such as Windows can be

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 27

Page 28: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Creating a Virtual Machine

• Linux just drives me crazy• So instead of just loading the same

CentOS that was just used to create the hypervisor we will load Windows XP Pro instead

• Place it in the drive• Back to the wizard

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 28

Page 29: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Creating a Virtual Machine

• Enter a name for the domU• Select Fully virtualized• Select Local install media• Tell it the OS Type• Tell it the OS Variant• Browse to the ISO file location• Tell it where to store the virtual machine• Tell it how to setup the virtual network

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 29

Page 30: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Creating a Virtual Machine

• Adjust the memory and CPU allocations if desired

• Click Finish• The virtual machine is created• The operating system is installed in it• Part way through the Windows installation

the virtual machine window will appear where you must click Run to let it finish the installation

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 30

Page 31: Xen Virtualization Last Update 2011.01.01 1.0.0 1Copyright 2011 Kenneth M. Chipps Ph.D

Creating a Virtual Machine

• Now wasn’t that easy as well despite the obstacles Linux placed in our way

Copyright 2011 Kenneth M. Chipps Ph.D. www.chipps.com 31