首页 > 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年6月22日13:10 | #1

    Head turns allow the eyes to touch upon a state of affairs.

  2. 2018年6月22日16:38 | #2

    Most actors make investments their time and efforts poorly.

  3. 2018年6月22日17:14 | #3

    Most actors make investments their time and efforts poorly.

  4. 2018年6月23日00:12 | #4

    What Do Talent Agents Look For In Actors?

  5. 2018年6月23日03:55 | #5

    What Do Expertise Agents Look For In Actors?

  6. 2018年6月23日05:44 | #6

    Most actors invest their time and efforts poorly.

  7. 2018年6月23日12:25 | #7

    Head turns permit the eyes to touch upon a scenario.

  8. 2018年6月23日15:38 | #8

    Effectively rounded people often make good actors.

  9. 2018年6月23日18:38 | #9

    Head turns permit the eyes to touch upon a state of affairs.

  10. 2018年6月23日19:09 | #10

    Head turns allow the eyes to comment on a scenario.

  11. 2018年6月23日21:28 | #11

    Most actors make investments their time and efforts poorly.

  12. 2018年6月24日01:08 | #12

    Well rounded people normally make good actors.

  13. 2018年6月24日01:34 | #13

    Most actors make investments their time and efforts poorly.

  14. 2018年6月24日07:59 | #14

    Nicely rounded individuals often make good actors.

  15. 2018年6月24日08:10 | #15

    Head turns allow the eyes to touch upon a situation.

  16. 2018年6月24日08:24 | #16

    generic viagra any good
    [url=http://amsboatyard.com/]buy generic viagra[/url]
    viagra generic name
    buy viagra
    viagra generic release date usa

  17. 2018年6月24日09:21 | #17

    Nicely rounded people often make good actors.

  18. 2018年6月24日09:27 | #18

    Head turns enable the eyes to touch upon a scenario.

  19. 2018年6月24日11:08 | #19

    Most actors invest their time and efforts poorly.

  20. 2018年6月24日14:41 | #20

    What Do Expertise Brokers Look For In Actors?

  21. 2018年6月24日15:51 | #21

    Most actors make investments their time and efforts poorly.

  22. 2018年6月24日15:55 | #22

    Most actors make investments their time and efforts poorly.

  23. 2018年6月24日19:32 | #23

    Head turns permit the eyes to comment on a situation.

  24. 2018年6月24日19:55 | #24

    kamagra in usa kaufen dundee health
    [url=http://kamagradyn.com/]buy kamagra[/url]
    kamagra gold 100mg
    buy kamagra 100 mg
    kamagra oral jelly forum hr

  25. 2018年6月24日21:50 | #25

    Most actors invest their time and efforts poorly.

  26. 2018年6月25日04:26 | #26

    Effectively rounded folks often make good actors.

  27. 2018年6月25日13:12 | #27

    Most actors make investments their time and efforts poorly.

  28. 2018年7月4日22:45 | #28

    Online canadian https://www.ning.com/?p=13591 Cost comparison uk.

  29. 2018年7月5日04:27 | #29

    Hey there, You’ve done a fantastic job. I will certainly digg it
    and personally suggest to my friends. I’m confident they will be benefited from this site.

  30. 2018年7月5日05:20 | #30

    Buy cheap online with prescription https://www.ning.com/?p=13910 price after insurance.

  31. 2018年7月13日21:13 | #31

    kamagra 100 chewable tablets
    kamagra jelly
    kamagra 100mg oral jelly sildenafil reviews
    [url=https://www.kamagrajellyk.com/]kamagra 100mg[/url]
    kamagra forum pl

  32. 2018年7月15日08:46 | #32

    You must spend time on Twitter and get to know people.

  33. 2018年7月16日12:29 | #33

    Rinse off the cleaner completely with clear water.

  34. 2018年7月17日14:32 | #34

    kamagra 100 gold upotreba
    buy kamagra
    kamagra store
    [url=https://www.kamagradax.com/]kamagra 100mg[/url]
    kamagra reviews users

  35. 2018年7月20日19:37 | #35

    Small business accountants for bookkeeping in London.

  36. 2018年7月21日05:14 | #36

    Small enterprise accountants for bookkeeping in London.

  37. 2018年7月21日07:08 | #37

    The double entry system uses nominal ledger accounts.

  38. 2018年7月21日08:03 | #38

    Accountants give orders; bookkeepers comply with them.

  39. 2018年7月30日07:29 | #39

    The double entry system uses nominal ledger accounts.

  40. 2018年7月30日10:11 | #40

    You must spend time on Twitter and get to know people.

  41. 2018年8月10日15:48 | #41

    sildenafil magnus 100 mg
    buy viagra in uk
    where i can get viagra in hyderabad

  42. 2018年8月13日21:33 | #42

    cheapest levitra uk
    viagra for sale birmingham
    can you buy viagra over the counter in the usa

  43. 2018年8月16日03:24 | #43

    where to order viagra online
    viagra generic
    venta de viagra online chile

评论分页
1 2 3 4 13
订阅评论
2+6= (必填)