Installing and configuring Xen on Debian

Source: Internet
Author: User

SUN will have some depreciation servers every other time to donate to universities, laboratories, research institutions, etc. Our project team has just "fooled" a few free sun Fire servers and, of course, with our long-term customers, sun (perhaps now Oracle), our servers are basically sun-related. Now as soon as the new machine comes in first virtualization, virtualization can be on the cabinet, technology changes too fast, remember a few years ago we buy a machine first installed is the operating system, now hypervisor instead of the operating system.

To minimize the installation of 64-bit Debian, the following installation steps and configuration procedures are based on Debian 5.04, and the CentOS version can refer to: Install and configure the Xen,ubuntu version on CentOS, see: Installing and configuring Xen on Ubuntu, opens Olaris version See: Install and configure Xen on OpenSolaris.

Install Xen
Check the source list:

# vi/etc/apt/sources.list

Deb Http://http.us.debian.org/debian stable main contrib Non-free
#deb Http://non-us.debian.org/debian-non-US stable/non-us Main contrib Non-free
Deb http://security.debian.org stable/updates main contrib Non-free
Install Xen and related tools:

# 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
We need a lot of loop devices to mount a file-based virtual machine, so the number limit for loop device needs to be set to maximum:

# Vi/etc/modules

Loop max_loop=64
After installing Xen, the Xen default network configuration on Debian is Network-dummy, and CentOS is a bit different, we need to modify it to bridge so that each virtual machine runs on the network like a stand-alone machine:

# vi/etc/xen/xend-config.sxp

# (Network-script network-dummy)
(Network-script Network-bridge)
After the installation is successful, check that the Xen kernel is installed and add dom0_mem=256m to the kernel to limit Xen Dom0 memory to prevent DOM0 from depleting the memory:

# Vi/boot/grub/menu.lst

...
Title Xen 3.2-1-amd64/debian Gnu/linux, kernel 2.6.26-2-xen-amd64
Root (hd0,0)
Kernel/xen-3.2-1-amd64.gz dom0_mem=256m
Module/vmlinuz-2.6.26-2-xen-amd64 root=/dev/mapper/vpsee-root ro console=tty0
Module/initrd.img-2.6.26-2-xen-amd64
...
After restarting the system, check to see if the Xen kernel and Xen are started:

# reboot

# Uname-r
2.6.26-2-xen-amd64

# XM List
Name ID Mem Vcpus State time (s)
Domain-0 0 256 2 R-----9.3
Create and install Guest
If the operating system of the Xen kernel is considered host, then the operating system running on the host can be viewed as guest. First build a directory to store all the guest operating system IMAGE,VM01.IMG,VM02.IMG, 1 guest corresponds to 1 image.

# MKDIR/VM

# xen-create-image--HOSTNAME=VM01--size=10gb--swap=512mb--ide/
--ip=172.16.39.121--netmask=255.255.254.0--gateway=172.16.38.1--force/
--DIR=/VM--MEMORY=512MB--arch=i386/
--KERNEL=/BOOT/VMLINUZ-2.6.26-2-XEN-AMD64/
--debootstrap--dist=etch--mirror=http://ftp2.de.debian.org/debian/--password
/etc/xen-tools/xen-tools.conf can be adjusted to suit your needs

Enter Guest
After the installation is successful, add a Xen profile to the corresponding virtual machine so Xen can start the virtual machine:

# VI/ETC/XEN/VM01

Kernel = '/boot/vmlinuz-2.6.26-2-xen-amd64 '
RAMDisk = '/boot/initrd.img-2.6.26-2-xen-amd64 '
Memory = ' 512 '
root = '/dev/xvda2 ro '
disk = [
' File:/vm/domains/vm01/swap.img,xvda1,w ',
' File:/vm/domains/vm01/disk.img,xvda2,w ',
]
name = ' VM01 '
Vif = [' Ip=172.16.39.121,mac=00:16:3e:c0:21:de ']
On_poweroff = ' Destroy '
On_reboot = ' Restart '
On_crash = ' Restart '
You can log on after you start the Debian virtual machine that you just installed.

# XM Create Vm01
# XM Console Vm01
If you want to quit guest, use Ctrl +] and you'll return to host.

If you want to start guest automatically each time the host is started:

# ln-s/etc/xen/vm01/etc/xen/auto
More lazy way.
If it feels too cumbersome to install the guest operating system, you can download a mounted mirrored file to http://stacklet.com/, adjust the profile of Xen Guest, and then start the guest mirror under host, which is described in more detail here and here.

Add swap
How to add swap to the guest system (DOMU) is described here.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.