---
title: "ubuntu 半虚拟化domU的安装方法"
author: "unixboy"
date: "2010-06-05T21:12:02Z"
tags: ["C", "Linux", "RedHat", "SSH", "Ubuntu"]
categories: ["操作系统"]
slug: "ubuntu-domu"
draft: false
lastmod: "2010-06-07T17:31:11Z"
id: 684888
url: "https://unixboy.iteye.com/blog/684888"
---

ubuntu还没有通过http://方法安装,不像redhat系的发行版.一种可行的方法是,先用iso安装成全虚拟化,然后再改成半虚拟化内核.

这里介绍另一种可能的方法.

**1. install debootstrap from ubuntu site:**

wget http://cn.archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/debootstrap\_1.0.23.tar.gz

tar zxvf debootstrap\_1.0.23.tar.gz -C /usr/share

**2. bootstrap a mini ubuntu**

/usr/share/debootstrap lucid lucid\_base

**3. install a EC2 image**

cd lucid\_base  
chroot .  
apt-get install linux-image-2.6.32-305-ec2  
apt-get install ssh

passwd (update password for root)

**4. setup grub boot menu.lst**

mkdir /boot/grub  
vi /boot/grub/menu.lst

 

as:

default=0  
timeout=10  
title ubuntu  
root (hd0,0)  
kernel /vmlinuz console=hvc0 root=/dev/**sda1** ro  
initrd /initrd.img

**5. create vdisk ,共 10G 动态增长.**

 

dd if=/dev/zero of=ubuntu.lucid.10G.img bs=1 count=0 seek=10G

 

mkfs.ext3 ubuntu.lucid.10G.img

 

mount -o loop ubuntu.lucid.10G.img /mnt

 

cp lucid\_base/* /mnt * -avpr

 

umount /mnt

 

**6. create a vm.cfg as :**

 

name = "ubuntu"  
memory = "256"  
disk = \[ 'file:/opt/images/oraclevmm/ubuntu.lucid.10G.img,**sda1** ,w', ]  
vif = \[ 'mac=00:16:3e:21:11:29, bridge=xenbr0', ]  
vfb = \["type=vnc,vncunused=1"]  
uuid = "4030b5cb-f298-90fa-2673-b809e09bb136"  
bootloader="/usr/bin/pygrub"  
vcpus=2  
on\_reboot   = 'restart'  
on\_crash    = 'restart'