Chinaunix首页 | 论坛 | 博客
  • 博客访问: 102723
  • 博文数量: 41
  • 博客积分: 2520
  • 博客等级: 少校
  • 技术积分: 440
  • 用 户 组: 普通用户
  • 注册时间: 2010-01-22 16:25
文章分类

全部博文(41)

文章存档

2010年(41)

我的朋友

分类: LINUX

2010-03-31 10:41:21

安装CentOS,选择Virtualization,完成后grub如下,无需修改:

# grub.conf generated by anaconda

#

# Note that you do not have to rerun grub after making changes to this file

# NOTICE:  You have a /boot partition.  This means that

#          all kernel and initrd paths are relative to /boot/, eg.

#          root (hd0,0)

#          kernel /vmlinuz-version ro root=/dev/sda2

#          initrd /initrd-version.img

#boot=/dev/sda

default=0

timeout=5

splashimage=(hd0,0)/grub/splash.xpm.gz

hiddenmenu

title CentOS (2.6.18-164.el5xen)

        root (hd0,0)

        kernel /xen.gz-2.6.18-164.el5

        module /vmlinuz-2.6.18-164.el5xen ro root=LABEL=/ rhgb quiet

        module /initrd-2.6.18-164.el5xen.img

title CentOS-base (2.6.18-164.el5)

        root (hd0,0)

        kernel /vmlinuz-2.6.18-164.el5 ro root=LABEL=/ rhgb quiet

        initrd /initrd-2.6.18-164.el5.img
PV DomU

1.         mount /dev/sda5 /mymnt

2.         dd if=/dev/zero of=/mymnt/pvguest1.img bs=1 count=1 seek=15G

3.         virt-install --paravirt --nographics --name=pvguest1 --ram=512 --vcpus=1 --file=/mymnt/pvguest1.img --location=/tmp/unzip

4.         install & reboot & setup

5.          

# cat /etc/xen/pvguest1

name = "pvguest1"

uuid = "d1a49252-58a2-93d8-c5e7-c1304accc71e"

maxmem = 512

memory = 512

vcpus = 1

bootloader = "/usr/bin/pygrub"

on_poweroff = "destroy"

on_reboot = "restart"

on_crash = "restart"

disk = [ "tap:aio:/mymnt/pvguest1.img,xvda,w" ]

vif = [ "mac=00:16:36:29:10:f4,bridge=xenbr0,script=vif-bridge" ]

[root@centos5 ~]# xm create /etc/xen/pvguest1

Using config file "/etc/xen/pvguest1".

No handlers could be found for logger "xend"

Error: Disk isn't accessible                                                      // mount

6.          

# mount /dev/sda5 /mymnt

# xm create /etc/xen/pvguest1

# xm list

7.         enter & info

 

1)   # df

Filesystem           1K-blocks      Used Available Use% Mounted on

/dev/xvda3            13608552   4934424   7971688  39% /    //显示为xvda*

/dev/xvda1              101086     18152     77715  19% /boot

tmpfs                   262232         0    262232   0% /dev/shm

 

2)   # cat /boot/grub/grub.conf

# grub.conf generated by anaconda

#

# Note that you do not have to rerun grub after making changes to this file

# NOTICE:  You have a /boot partition.  This means that

#          all kernel and initrd paths are relative to /boot/, eg.

#          root (hd0,0)

#          kernel /vmlinuz-version ro root=/dev/xvda3

#          initrd /initrd-version.img

#boot=/dev/xvda

default=0

timeout=5

splashimage=(hd0,0)/grub/splash.xpm.gz

hiddenmenu

title CentOS (2.6.18-164.el5xen)

        root (hd0,0)

        kernel /vmlinuz-2.6.18-164.el5xen ro root=LABEL=/ console=xvc0 rhgb quiet

        initrd /initrd-2.6.18-164.el5xen.img

title CentOS-base (2.6.18-164.el5)                    // 估计这个条目只要机器支持HVM

        root (hd0,0)                                                                 // 默认就会被加上的

        kernel /vmlinuz-2.6.18-164.el5 ro root=LABEL=/ console=xvc0 rhgb quiet

        initrd /initrd-2.6.18-164.el5.img

 

3)   # ifconfig

eth0      Link encap:Ethernet  HWaddr 00:16:36:29:10:F4

          inet addr:10.167.141.104  Bcast:10.167.141.255  Mask:255.255.255.0

          inet6 addr: fe80::216:36ff:fe29:10f4/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:5646 errors:0 dropped:0 overruns:0 frame:0

          TX packets:396 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:721396 (704.4 KiB)  TX bytes:51846 (50.6 KiB)

 

lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:8 errors:0 dropped:0 overruns:0 frame:0

          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:560 (560.0 b)  TX bytes:560 (560.0 b)

 

virbr0    Link encap:Ethernet  HWaddr 00:00:00:00:00:00

          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0

          inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:41 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:0 (0.0 b)  TX bytes:9771 (9.5 KiB)


HVM DomU

1.         mount /dev/sda6 /mymnt2

2.         dd if=/dev/zero of=/mymnt2/hvmguest1.img bs=1 count=1 seek=15G

3.         virt-install --hvm --nographics --name=hvmguest1 --ram=512 --vcpus=1 --file=/mymnt2/hvmguest1.img --location=/tmp/unzip (当带--nographics时,无法继续安装步骤,所以去掉)

4.         install & reboot & setup

5.          

# cat /etc/xen/hvmguest1

name = "hvmguest1"

uuid = "c1bd6037-5c26-8cc4-f202-49160e27a7a5"

maxmem = 512

memory = 512

vcpus = 1

builder = "hvm"

kernel = "/usr/lib/xen/boot/hvmloader"

boot = "c"

pae = 1

acpi = 1

apic = 1

localtime = 0

on_poweroff = "destroy"

on_reboot = "restart"

on_crash = "restart"

device_model = "/usr/lib/xen/bin/qemu-dm"

sdl = 0

vnc = 1

vncunused = 1

keymap = "en-us"

disk = [ "file:/mymnt2/hvmguest1.img,hda,w", ",hdc:cdrom,r" ]

vif = [ "mac=00:16:36:38:45:70,bridge=virbr0,script=vif-bridge" ]

parallel = "none"

serial = "pty"

6.          

# mount /dev/sda6 /mymnt2

# xm create /etc/xen/hvmguest1

# xm list

7.         enter & info

1)   # df

Filesystem           1K-blocks      Used Available Use% Mounted on

/dev/hda3             14472512   4661104   9064388  34% /     //显示为hda*

/dev/hda1               256666     16034    227380   7% /boot

tmpfs                   257692         0    257692   0% /dev/shm

 

2)   # cat /boot/grub/grub.conf

# grub.conf generated by anaconda

#

# Note that you do not have to rerun grub after making changes to this file

# NOTICE:  You have a /boot partition.  This means that

#          all kernel and initrd paths are relative to /boot/, eg.

#          root (hd0,0)

#          kernel /vmlinuz-version ro root=/dev/hda3

#          initrd /initrd-version.img

#boot=/dev/hda

default=0

timeout=5

splashimage=(hd0,0)/grub/splash.xpm.gz

hiddenmenu

title CentOS (2.6.18-164.el5xen)     // 如果安装的时候选择了Virtualization

        root (hd0,0)                                               // 是可以继续作为Dom0

        kernel /xen.gz-2.6.18-164.el5

        module /vmlinuz-2.6.18-164.el5xen ro root=LABEL=/ rhgb quiet

        module /initrd-2.6.18-164.el5xen.img

title CentOS-base (2.6.18-164.el5)

        root (hd0,0)

        kernel /vmlinuz-2.6.18-164.el5 ro root=LABEL=/ rhgb quiet

        initrd /initrd-2.6.18-164.el5.img

 

如果安装时不选择Virtualizationgrub.conf

# grub.conf generated by anaconda

#

# Note that you do not have to rerun grub after making changes to this file

# NOTICE:  You have a /boot partition.  This means that

#          all kernel and initrd paths are relative to /boot/, eg.

#          root (hd0,0)

#          kernel /vmlinuz-version ro root=/dev/hda3

#          initrd /initrd-version.img

#boot=/dev/hda

default=0

timeout=5

splashimage=(hd0,0)/grub/splash.xpm.gz

hiddenmenu

title CentOS (2.6.18-164.el5)                                                 // 只有这个

        root (hd0,0)

        kernel /vmlinuz-2.6.18-164.el5 ro root=LABEL=/ rhgb quiet

        initrd /initrd-2.6.18-164.el5.img

 

3)   # ifconfig

eth0      Link encap:Ethernet  HWaddr 00:16:36:49:EE:E7

          inet addr:10.167.141.103  Bcast:10.167.141.255  Mask:255.255.255.0

          inet6 addr: fe80::216:36ff:fe49:eee7/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:121862 errors:0 dropped:0 overruns:0 frame:0

          TX packets:1270 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:11349414 (10.8 MiB)  TX bytes:219751 (214.6 KiB)

          Interrupt:185 Base address:0xa000

 

lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:32 errors:0 dropped:0 overruns:0 frame:0

          TX packets:32 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:3857 (3.7 KiB)  TX bytes:3857 (3.7 KiB)

阅读(1262) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~