首页 > xen > Xen安装ubuntu-xenDomU

Xen安装ubuntu-xenDomU

2010年1月21日 eric 发表评论 阅读评论

我文章已经写过 linux(ubuntu) install xen-3.4.2 ,没看过的朋友可以去看看,接下来我们安装虚拟系统,因为我的CPU不支持VT,所以我先注重说一下半虚拟化虚拟系统,先说我喜欢用的 debootstrap。

操作环境:

ISO:ubuntu-8.04.2-server-i386.iso

Dom0 : ubuntu-server 8.0.4

xen : 3.4.2

准备安装 虚拟系统

DomU : ubuntu-server 8.0.4

步骤:

一.安装虚拟系统:

新建一个4G的镜象文件,还是希望你用真实磁盘,因为这样会减少I/O平颈。

shell$> dd if=/dev/zero of=ubuntu.img bs=1M count=1 seek=4000

shell$>dd if=/dev/zero of=swap.img bs=1M count=1 seek=256

####格式化镜象文件####

shell$>mkfs.ext3 ubuntu.img

shell$>mkswap swap.img

#### 挂载ISO文件####

shell$>mount -o loop ubuntu-8.04.2-server-i386.iso /mnt

#####挂载空的静象文件到新建立的ubuntu文件夹####

shell$>mkdir  ubuntu

shell$> mount -o loop ubuntu.img ubuntu

#### 初始化环境########

shell$>/usr/bin/env -i HOME=/root TERM=$TERM PATH=/bin:/usr/bin:/sbin:/usr/sbin

####debootstrap通过ISO文件,安装纯净系统####

#### –arch i386 的意思32位,hardy 是ubuntu版本 8.0.4   ubuntu 是安装到哪个目录下###

shell$>/usr/sbin/debootstrap –arch i386 hardy ubuntu/ file:/mnt/ubuntu/

### 复制内核心模块进 虚拟系统###

shell $> cp /lib/modules/2.6.18.8-xenU  ubuntu/lib/modules/ -R

### 挂载 proc  dev ###chroot进系统配置系统

shell$>mount -t proc none ubuntu/proc

shell$>mount -o bind /dev ubuntu/dev

shell$>LANG=C chroot ubuntu /bin/bash

###给root创建密码

shell$>passwd root

shell$>dpkg-reconfigure –default-priority passwd

###加入apt-get 源###

shell$>vim /etc/apt/sources.list

deb http://mirrors.163.com/ubuntu/ hardy main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ hardy-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ hardy-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ hardy-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ hardy main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ hardy-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ hardy-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ hardy-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ hardy-backports main restricted universe multiverse

###更新源###安装openssh-server###

shell$>apt-get update

shell$>apt-get install openssh-server

#### 修改 IP 地址

shell $>vim /etc/network/interfaces

auto lo iface lo inet loopback

# The primary network interface

auto eth0 iface eth0 inet static

address 192.168.6.101

netmask 255.255.255.0
network 192.168.6.0
broadcast 192.168.6.255
gateway 192.168.6.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 202.106.0.20

###修改hostname 和 hosts

shell$>vim /etc/hostname

nginx

shell$>vim /etc/hosts

127.0.0.1       localhost

127.0.1.1       nginx          nginxs.com

#### 修改 fstab####

shell$> vim /etc/fstab

proc            /proc           proc    defaults        0       0
/dev/sda1       /               ext3    defaults,errors=remount-ro 0       1
/dev/sda2       none            swap    sw              0       0

### 卸载挂载区###

shell$>umount ubuntu/proc

shell$>umount ubuntu/dev

shell$>umount ubuntu

二. 创建 xen配置文件系统

shell $> cd /opt/

shell$>vim ubuntu.cfg

kernel = “/boot/vmlinuz-2.6.18.8-xenU”
ramdisk = “/boot/initrd.img-2.6.18.8-xenU”
memory = 256
name = “ubuntu”
disk = ['file:/ubuntu/ubuntu.img,sda1,w','file:/ubuntu/swap.img,sda2,w']
root = “/dev/sda1 ro”
on_poweroff = ‘destroy’
on_reboot   = ‘restart’
on_crash    = ‘restart’
vcpus       = ’2′
extra = ‘xencons=tty1′
vif = [ '' ]

三,启动虚拟机“`

shell $> xm create ubuntu.cfg

shell $>xm list

xm list Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0   502     2     r—–  22161.
ubuntu                                          1   256     2     -b—-    439.0

四,连接虚拟机。

##xm console  可以连接 Domain 名 也可以连接ID ,我就连接的ID

shell$> xm console  1

转载请注明:文章转载自:Eric's linux and nginx! (http://www.nginxs.com)
本文地址:http://www.nginxs.com/linux/13.html

分类: xen 标签: , , , ,
  1. 2018年5月15日18:58 | #1

    Mildew can be found in carpet and in the air.

  2. 2018年5月15日20:40 | #2

    There are numerous types of carpet cleaning.

  3. 2018年5月15日21:55 | #3

    Carpet cleaning utilizing dry foam has quite a few advantages.

  4. 2018年5月15日22:50 | #4

    Mildew spores is not going to survive in dry climates.

  5. 2018年5月16日04:41 | #5

    Waterproofing is nothing to procrastinate about.

  6. 2018年5月16日06:53 | #6

    Waterproofing is nothing to procrastinate about.

  7. 2018年5月16日11:53 | #7

    Save up to 75 on quality strong & engineered floors.

  8. 2018年5月16日15:58 | #8

    Strong hardwood flooring is another widespread option.

  9. 2018年5月17日04:08 | #9

    They’re certified arborists and workers are insured.

  10. 2018年5月17日06:58 | #10

    They offer pruning, shaping, cabling and tree care.

  11. 2018年5月17日08:37 | #11

    We offer instructional and restore services for
    owners.

  12. 2018年5月19日19:36 | #12

    Crown Cleaning, Vista Pruning & Tree Removals.

  13. 2018年5月23日23:24 | #13

    Our companies embrace all facets of tree surgical procedure.

  14. 2018年5月24日04:07 | #14

    We offer educational and repair companies for householders.

  15. 2018年5月24日05:27 | #15

    NH CUSTOM WOOD FLOORING and STAIRWAYS.

  16. 2018年5月24日06:50 | #16

    We offer academic and restore companies for householders.

  17. 2018年5月25日18:10 | #17

    Clothes might be infested with mildew progress too.

  18. 2018年5月25日18:12 | #18

    We did not discover results for: hvac restore.

  19. 2018年5月27日11:06 | #19

    How a lot a limousine rental should value.

  20. 2018年5月27日11:35 | #20

    How a lot a limousine rental should price.

  21. 2018年5月28日08:10 | #21

    The easy reply is to make use of a tree care service.

  22. 2018年5月28日15:27 | #22

    Your furnace is the heating heart of your house.

  23. 2018年5月29日07:07 | #23

    Watch out to purchase a heating and cooling unit.

  24. 2018年5月29日08:42 | #24

    That’s why black mold health problems are so common.

  25. 2018年5月31日10:45 | #25

    How does a commercial window cleaning service work?

  26. 2018年5月31日12:25 | #26

    Add mulch to the soil so the crops grow properly.

  27. 2018年5月31日22:39 | #27

    The first step could be planning your landscaping space.

  28. 2018年6月1日01:42 | #28

    Storage door repairs shouldn’t be chosen haphazardly.

  29. 2018年6月1日04:14 | #29

    smettere di fumare

  30. 2018年6月6日05:09 | #30

    How does a commercial window cleansing service
    work?

  31. 2018年6月6日06:01 | #31

    This enables the vehicle to be towed on one axle.

  32. 2018年6月6日21:49 | #32

    Towing yards are fortified prisons for autos.

  33. 2018年6月7日15:01 | #33

    Many roadside repair services promote towing.

  34. 2018年6月7日18:40 | #34

    Many roadside repair providers promote towing.

  35. 2018年6月8日14:34 | #35

    youtube viagra commercial 2015 asian actresses
    [url=http://viagrapipls.com/]buy viagra[/url]
    brand viagra online canadian pharmacy paypal
    buy generic viagra online
    viagra preco araujo

  36. 2018年6月14日03:59 | #36

    buy viagra online united kingdom
    erfahrungsberichte viagra online kaufen
    [url=http://hqmdwww.com/]best site to order cialis[/url]
    viagra 50 mg u.k

  37. 2018年6月17日14:08 | #37

    dosage for generic viagra
    [url=http://viagrapipls.com/]buy generic viagra online[/url]
    is viagra without a doctor prescription safe
    buy viagra online
    viagra prices uk

  38. 2018年6月18日06:47 | #38

    kamagra store
    buy kamagra oral jelly
    kamagra kopen amsterdam
    [url=http://kamagraonl.com/]buy kamagra[/url]
    kamagra oral jelly kopen in rotterdam

  39. 2018年6月18日06:57 | #39

    viagra commercial woman in blue dress
    buy generic viagra
    viagra naturale italy
    [url=http://amsboatyard.com/]buy generic viagra[/url]
    viagra dose instructions

评论分页
订阅评论
3+7= (必填)