首页 > 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年1月1日19:01 | #1

    casino games
    [url=http://bom777casino.com/]casino online[/url]
    real money casino
    casino games

  2. 2018年1月2日00:10 | #2

    real money casino
    [url=http://bom777casino.com/]online casino[/url]
    casino online
    casino games

  3. 2018年1月2日02:02 | #3

    online casino
    [url=http://bom777casino.com/]online casino[/url]
    casino online
    casino games

  4. 2018年1月2日02:11 | #4

    real money casino
    [url=http://bom777casino.com/]online casino[/url]
    real money casino
    casino games

  5. 2018年1月2日05:30 | #5

    casino online
    [url=http://bom777casino.com/]real money casino[/url]
    free casino games
    casino games

  6. 2018年1月2日19:07 | #6

    free casino games
    [url=http://bom777casino.com/]free casino games[/url]
    real money casino
    casino games

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

    I think the admin of this website is genuinely working hard for his web page, for the reason that
    here every data is quality based data.

  8. 2018年1月5日17:39 | #8

    I don’t know if it’s just me or if perhaps everyone else experiencing problems with
    your website. It appears as though some of the text in your content are running off
    the screen. Can someone else please provide feedback and let me know
    if this is happening to them as well? This might
    be a issue with my browser because I’ve had this happen previously.

    Many thanks

  9. 2018年1月7日02:47 | #9

    free casino slots
    [url=http://casinobablogames.com/]free casino slot games[/url]
    free slot games
    casino games slots free

  10. 2018年1月7日11:24 | #10

    free casino games
    [url=http://casinobablogames.com/]casino free games[/url]
    free online slots
    casino games online

  11. 2018年1月7日21:57 | #11

    freeslots
    [url=http://casinobablogames.com/]free slots casino games[/url]
    slots casino
    free slot games

  12. 2018年1月8日18:03 | #12

    free casino games slot
    [url=http://casinobablogames.com/]free online slots[/url]
    free slots online
    casino slots free

  13. 2018年1月9日02:03 | #13

    casino games online
    [url=http://casinobablogames.com/]aol slots[/url]
    free slot games
    free casino games slot machines

  14. 2018年1月10日12:11 | #14

    I know this if off topic but I’m looking into starting my own blog and was wondering what
    all is needed to get setup? I’m assuming having a blog
    like yours would cost a pretty penny? I’m not very internet savvy
    so I’m not 100% certain. Any recommendations
    or advice would be greatly appreciated. Many thanks

  15. 2018年1月11日02:29 | #15

    Hi there friends, its great post about teachingand completely defined, keep it
    up all the time.

  16. 2018年1月11日08:32 | #16

    loans for bad credit
    [url=http://paydayhjkfg.com/]payday loans no credit check[/url]
    payday loans online no credit check
    payday loans no credit check

  17. 2018年1月12日12:18 | #17

    autocad x64 download
    autodesk autocad
    curso de autocad online

  18. 2018年1月13日02:49 | #18

    payday loans online no credit check
    [url=http://paydayhjkfg.com/]payday loans online no credit check[/url]
    loans no credit check
    payday loans online no credit check

  19. 2018年1月13日17:36 | #19

    Pretty portion of content. I just stumbled upon your blog and in accession capital to
    say that I acquire actually enjoyed account your blog posts.
    Any way I’ll be subscribing in your feeds and even I fulfillment you access persistently fast.

  20. 2018年1月13日17:53 | #20

    Thanks for finally talking about >Eric’s linux and nginx!

    > Xen安装ubuntu-xenDomU <Loved it!

  21. 2018年1月18日22:25 | #21

    payday loans no credit check
    payday loans
    payday loans no credit check
    payday loans online
    payday loans

  22. 2018年1月20日07:21 | #22

    Great post. I was checking constantly this blog and I’m impressed!
    Extremely useful information specifically the last part :) I
    care for such information a lot. I was seeking this
    particular information for a very long time. Thank you and good luck.

评论分页
1 ... 4 5 6 13
订阅评论
4+9= (必填)