Use XEN3.2 on Ubuntu8.04 (build a virtual machine based on the direct replication system and debootstrap)

Source: Internet
Author: User
When vgcreateUbuntu8.04 is selected as the server role, select the openssh-server feature and run apt-get-yupgrade to upgrade the system. Install the Xen module apt-get-yinstallubuntu-xen-server to modify the loop module. add the following loopmax_loop = 64 to/etc/modules. Because lvm is used for storage, the installation of lvm2a is required for the VM.

Vgcreate
Select the openssh-server function when selecting the server role during Ubuntu 8.04 CD installation

Run
Apt-get-y upgrade
Upgrade System

Install Xen Module
Apt-get-y install ubuntu-xen-server

Modify the loop module and add the following line to/etc/modules:
Loop max_loop = 64

Considering the use of lvm for storage
Lvm2 needs to be installed
Apt-get-y install lvm

Restart the system
Convert/dev/sda5 to lvm

Pvcreate/dev/sda5
Vgcreate/dev/sda5 leif

A lvm volume named leif is created.

Now start to install the Virtual Machine (guest OS)
1. Directly copy the original system to the Virtual Machine (guest OS)
1. Create the root partition (5 Gb) and swap (256 MB) space used by the VM.
Lvcreate-L 5G-nvm1_root leif
Lvcreate-L 256 M-nvm1_swap leif
2. Format vmbench root as ext3
Mkfs. ext/dev/leif/vm1_root
3. copy the file to vmbench Root
Mount/dev/leif/vm1_root/mnt
Rsync-av-one-file-system // mnt
4. Modify the fstab host name and IP address and Related Files
/Etc/hosts
/Etc/network/interfaces
Modify IP address and Host Name
Clear the/etc/fstab file and add the following lines:
Proc/proc defaults 0 0
/Dev/hda1/ext3 defaults, errors = remount-ro 0 1
/Dev/hdb1 none swap sw 0 0
Run again
Mv/mnt/lib/tls. disabled
5. Define a vm1.cfg File
Vi/etc/xen/vm1.cfg write
Kernel = "/boot/vmlinuz-2.6.24-21-xen"
Ramdisk = "/boot/initrd. img-2.6.24-21-xen"
Memory = 128
Name = "vm1 ″
Disk = ['phy:/dev/leif/vm1_root, hda1, W', 'phy:/dev/leif/vm1_swap, hdb1, W']
Root = "/dev/hda1 ro"
On_poweroff = 'deststroy'
On_reboot = 'restart'
On_crash = 'restart'
Vcpus = '2 ′
Extra = 'xencons = tty1 ′
Vif = ['']

OK
Run xm create-c/etc/xen/vm1.cfg.
You can enable this virtual machine.
The account and password are the same as the source system

Ii. Use debootstrap to build a virtual machine
1. First, put the ubuntu 8.04 CD into the optical drive
Moun/dev/cdrom/mnt
Run again
Debootstrap-arch i386 hard/xenvm/vm1 file:/mnt/
/Xenvm1/vm1:/dev/leif/vm1 mount point

Soon the installation is complete
Run again
Mount-bind/dev/xenvm/vm1/dev
Mount proc/xenvm/vm1/proc-t proc
Cp/etc/resolv. conf/xenvm/vm1/etc/
Cp/etc/network/interface/xenvm/vm1/etc/network
Cp/etc/apt/source. list/xenvm/vm1/etc/apt/sources. list
Cp-R/lib/modules/2.6.24-17-xen/xenvm/vm1/lib/modules/
Chroot/mnt/bin/bash
Mv/mnt/lib/tls. disabled
Apt-get update
Apt-get upgrade
Apt-get install vim ssh
Modify the/etc/fstab file as follows:
Proc/proc defaults 0 0
/Dev/hda1/ext3 defaults, errors = remount-ro 0 1
/Dev/hdb1 none swap sw 0 0

Modify IP address Host Name
Change the root password.
Passwd root
After everything is done, exit chroot.

Then, define a vm1.cfg file in step 5th of the method for directly copying the original system to the virtual machine.

Related Article

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.