This article details how to install and run Windows 7 on the Xen HVM as a detailed step to run as a Xen virtual client.
Keywords: Xen HVM virtual Machine Windows 7
Prerequisites for Xen virtual Windows 7
This chapter assumes that the kernel running the main system can run Xen and install standard Xen tools such as XM, and that hardware virtualization requires the hardware of the primary system to support INTEL-VT or amd-v virtualization, in order to verify that the command can be run on the main system
For the Intel cpu:grep vmx/proc/cpuinfo for AMD cpu:grep svm/proc/cpuinfo
If the above command does not have any output after execution, then your hardware does not support these features and cannot run the Xen HVM client. how Windows 7 is installed
To install window 7 in Xen HVM, you first need the installation disk for Windows 7, or you can download an ISO image from the official website of Microsoft. It can then be installed via a CD or mirror. If you want to make a mirror through the CD, please put the CD into the optical drive, and if you run the automatic load uninstall first, and then execute the following command (such as the optical drive is/dev/cdrom)
DD If=/dev/cdrom Of=windows7.iso Prepare storage space for Windows 7
Installing the Windows 7 operating system on the client will certainly require space for it. This space can be a physical disk drive, or it can be a disk image file. If it is a disk drive, be aware of its device name. Usually/DEV/SD OR/DEV/HD, followed by a letter (such as/DEV/SDC or/dev/hdb), generates a disk image that can be used as the following DD command-line tool:
DD If=/dev/zero of=xenwin7.img bs=1024k seek=10000 count=0
This command creates a 10Gb mirrored file named Xenwin7.img. Create a configuration file for Xen Windows 7
The next step is to create the configuration files that Windows 7 must have as Xen clients, and here is an example of a minimal configuration of a Windows 7 Xen client:
Import OS, re
Arch = Os.uname () [4]
If Re.search (' ', Arch '):
Arch_libdir = ' lib64 '
Else
Arch_libdir= ' Lib '
Kernel = "/usr/lib/xen/boot/hvmloader"
Builder= ' HVM '
Memory = 1024
# Should to least 2KB per MB of domain memory, plus a few MB per Vcpu.
Shadow_memory = 8
Name = "Xenwin7"
Vif = [' Type=ioemu, Bridge=xenbr0 ']
ACPI = 1
APIC = 1
disk = [' File:/home/xen/xenwin7.img,hda,w ', ' file:/home/xen/windows7.iso,hdc:cdrom,r ']
Device_model = '/usr/' + arch_libdir + '/XEN/BIN/QEMU-DM '
#-----------------------------------------------------------------------------
# Boot on Floppy (a), hard disk (c) or CD-ROM (d)
# Default:hard disk, CD-ROM, floppy
Boot= "DC"
Sdl=0
Vnc=1
Vncconsole=1
Vncpasswd= '
Serial= ' Pty '
Usbdevice= ' tablet '
The above example is installed with a Windows 7 ISO image file, and if it is installed with a physical disk, the disk indicator should be changed to the following (replace/dev/sdb with the physical device name):
disk = [' Phy:/dev/sdb,hda,w ', ' file:/home/xen/windows7.iso,hdc:cdrom,r ']
So, if you are installing with a CD-ROM, the command can be changed to the following (/dev/cdrom is the path to the physical CD drive):
disk = [' Phy:/dev/sdb,hda,w ', ' PHY:/DEV/CDROM,HDC:CDROM.R ']
The above command maps the physical disk-driven/DEV/SDB in the primary system to the client's/dev/had,/dev/cdrom to the client's CD/DVD device (note that the CD/DVD device in the primary system is different in the distribution of the Linux version).
If you are installing with a disk-mirrored file, the command line should be replaced by:
disk = [' File:/home/xen/xenwin2008.img,hda,w ', ' phy:/dev/cdrom,hdc:cdrom,r ']
The set of configurations shown in the example above is designed to start a graphics console for Windows 7 clients. When the client is running, Xen can provide a VNC or SDL graphics console. Instead, the following command selects the console for VNC:
VNC = 1
Sdl=0
The following command is to select the SDL console:
VNC = 0
SDL = 1
Both VNC and SDL provide a good image display for Windows 7 clients, and VNC has more advantages than SDL. First, VNC is more flexible than SDL at remote access, and can connect to the client system either locally or via the Internet or on different systems. Second, when you turn off the VNC Viewer window, the client is still running, and the next time you reconnect, you can go back to the state you left last time. However, when the SDL window is turned off, the client will immediately turn off and potentially lose data.
By default, Xen does not automatically start the VNC console when the client is started. If you want to start automatically, you should set the following command:
Vncconsole=1
Some other configuration options can also be set, but the above setting is to run a minimum configuration of a Windows 7 client. When a configuration file is written, it can be saved as a xenwin7.cfg.
Start the Xen Windows 7 HVM Client
Once all the configuration is complete, you can start the Xen client:
XM Create Xenwin7.cfg
Using config file "./xenwin7.cfg".
Started domain xenwin7
After a few seconds, VNC or SDL (depending on your configuration) will appear, and the Windows 7 Installer will start, and the following image is an example of Xen HVM client windows 7 in VNC: