四、建立虚拟机
准备工作
这里我们安装虚拟机采用NFS的方式,如果你对你的网络比较自信,也可以采用网络安装的方式,视具体情况而定。
创建一个NFS Server并将光盘根目录下的文件copy 进去,同时分享出来并允许Xen宿主机访问,这个不是重点,就不写过程了
下面进入真正的虚拟机安装阶段
- # virt-install -n CentOS -r 512 --vcpus=1 \
- > --nographic -f /opt/vm/centos.img -s 20 -p \
- > -l nfs:192.168.1.249:/home/netinstall
解释一下各参数的意义:
- -n 代表虚拟机的名字
- -r 分配给虚拟机的内存
- --vcpus 分配给虚拟机的CPU
- --nographic 不适用图形界面
- -f 虚拟机磁盘映像的所在地
- -s 虚拟机磁盘映像的大小,单位记得是GB
- -p 半虚拟化的方式
- -l 安装映像的路径
PS:上面是采用NFS的方式,如果internet比较快,就换成internet上的源,门户网站sohu,163均有开源的镜像站点,另外中国科技大学的镜像站点也不错
- # 开源镜像站点
- 163 http://mirrors.163.com
- sohu http://mirrors.sohu.com
- 科大 http://mirrors.ustc.edu.cn
运行上面的安装虚拟机命令后,会提示以下的信息
- Starting install...
- Retrieving file vmlinuz... | 2.1 MB 00:00
- Retrieving file initrd.img... 85% [=========================== ] 5.6 MB/s | 6.7 MB 00:00 ETA
- Message from syslogd@ at Fri Jun 10 15:07:07 2011 ...
- Xen kernel: Disabling IRQ #16
- Retrieving file initrd.img... | 7.9 MB 00:00
- Creating storage file... | 20 GB 00:00
- Creating domain... | 0 B 00:00
- Connected to domain centos
- Escape character is ^]
- Bootdata ok (command line is method=nfs:192.168.1.249:/home/netinstall)
- Linux version 2.6.18-238.el5xen (mockbuild@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Thu Jan 13 16:41:45 EST 2011
- BIOS-provided physical RAM map:
- Xen: 0000000000000000 - 0000000020800000 (usable)
- No mptable found.
- Built 1 zonelists. Total pages: 133120
- Kernel command line: method=nfs:192.168.1.249:/home/netinstall
- Initializing CPU#0
- PID hash table entries: 4096 (order: 12, 32768 bytes)
- Xen reported: 2812.790 MHz processor.
- Console: colour dummy device 80x25
- Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes)
- Inode-cache hash table entries: 65536 (order: 7, 524288 bytes)
- Software IO TLB disabled
- Memory: 496384k/532480k available (2529k kernel code, 27260k reserved, 1736k data, 196k init)
- Calibrating delay using timer specific routine.. 7050.28 BogoMIPS (lpj=14100572)
- Security Framework v1.0.0 initialized
- SELinux: Initializing.
- selinux_register_security: Registering secondary module capability
- Capability LSM initialized as secondary
- Mount-cache hash table entries: 256
- CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
- CPU: L2 Cache: 1024K (64 bytes/line)
- CPU: Physical Processor ID: 0
- CPU: Processor Core ID: 1
- (SMP-)alternatives turned off
- Brought up 1 CPUs
- checking if image is initramfs... it is
- Grant table initialized
- NET: Registered protocol family 16
- Brought up 1 CPUs
- PCI: setting up Xen PCI frontend stub
- ACPI: Interpreter disabled.
- Linux Plug and Play Support v0.97 (c) Adam Belay
- pnp: PnP ACPI: disabled
- xen_mem: Initialising balloon driver.
- usbcore: registered new driver usbfs
- usbcore: registered new driver hub
- PCI: System does not support PCI
- PCI: System does not support PCI
- NetLabel: Initializing
- NetLabel: domain hash size = 128
- NetLabel: protocols = UNLABELED CIPSOv4
- NetLabel: unlabeled traffic allowed by default
- NET: Registered protocol family 2
- IP route cache hash table entries: 32768 (order: 6, 262144 bytes)
- TCP established hash table entries: 131072 (order: 9, 2097152 bytes)
- TCP bind hash table entries: 65536 (order: 8, 1048576 bytes)
- TCP: Hash tables configured (established 131072 bind 65536)
- TCP reno registered
- audit: initializing netlink socket (disabled)
- type=2000 audit(1307689628.858:1): initialized
- VFS: Disk quotas dquot_6.5.1
- Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
- Initializing Cryptographic API
- alg: No test for crc32c (crc32c-generic)
- ksign: Installing public key data
- Loading keyring
- - Added public key C099FB4D84A418B6
- - User ID: CentOS (Kernel Module GPG key)
- io scheduler noop registered
- io scheduler anticipatory registered
- io scheduler deadline registered
- io scheduler cfq registered (default)
- pci_hotplug: PCI Hot Plug PCI Core version: 0.5
- rtc: IRQ 8 is not free.
- Non-volatile memory driver v1.2
- Linux agpgart interface v0.101 (c) Dave Jones
- brd: module loaded
- Xen virtual console successfully installed as xvc0
- Bootdata ok (command line is method=nfs:192.168.1.249:/home/netinstall)
- Linux version 2.6.18-238.el5xen (mockbuild@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Thu Jan 13 16:41:45 EST 2011
- BIOS-provided physical RAM map:
- Xen: 0000000000000000 - 0000000020800000 (usable)
- No mptable found.
- Built 1 zonelists. Total pages: 133120
- Kernel command line: method=nfs:192.168.1.249:/home/netinstall
- Initializing CPU#0
- PID hash table entries: 4096 (order: 12, 32768 bytes)
- Xen reported: 2812.790 MHz processor.
- Console: colour dummy device 80x25
- Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes)
- Inode-cache hash table entries: 65536 (order: 7, 524288 bytes)
- Software IO TLB disabled
- Memory: 496384k/532480k available (2529k kernel code, 27260k reserved, 1736k data, 196k init)
- Calibrating delay using timer specific routine.. 7050.28 BogoMIPS (lpj=14100572)
- Security Framework v1.0.0 initialized
- SELinux: Initializing.
- selinux_register_security: Registering secondary module capability
- Capability LSM initialized as secondary
- Mount-cache hash table entries: 256
- CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
- CPU: L2 Cache: 1024K (64 bytes/line)
- CPU: Physical Processor ID: 0
- CPU: Processor Core ID: 1
- (SMP-)alternatives turned off
- Brought up 1 CPUs
- checking if image is initramfs... it is
- Grant table initialized
- NET: Registered protocol family 16
- Brought up 1 CPUs
- PCI: setting up Xen PCI frontend stub
- ACPI: Interpreter disabled.
- Linux Plug and Play Support v0.97 (c) Adam Belay
- pnp: PnP ACPI: disabled
- xen_mem: Initialising balloon driver.
- usbcore: registered new driver usbfs
- usbcore: registered new driver hub
- PCI: System does not support PCI
- PCI: System does not support PCI
- NetLabel: Initializing
- NetLabel: domain hash size = 128
- NetLabel: protocols = UNLABELED CIPSOv4
- NetLabel: unlabeled traffic allowed by default
- NET: Registered protocol family 2
- IP route cache hash table entries: 32768 (order: 6, 262144 bytes)
- TCP established hash table entries: 131072 (order: 9, 2097152 bytes)
- TCP bind hash table entries: 65536 (order: 8, 1048576 bytes)
- TCP: Hash tables configured (established 131072 bind 65536)
- TCP reno registered
- audit: initializing netlink socket (disabled)
- type=2000 audit(1307689628.858:1): initialized
- VFS: Disk quotas dquot_6.5.1
- Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
- Initializing Cryptographic API
- alg: No test for crc32c (crc32c-generic)
- ksign: Installing public key data
- Loading keyring
- - Added public key C099FB4D84A418B6
- - User ID: CentOS (Kernel Module GPG key)
- io scheduler noop registered
- io scheduler anticipatory registered
- io scheduler deadline registered
- io scheduler cfq registered (default)
- pci_hotplug: PCI Hot Plug PCI Core version: 0.5
- rtc: IRQ 8 is not free.
- Non-volatile memory driver v1.2
- Linux agpgart interface v0.101 (c) Dave Jones
- brd: module loaded
- Xen virtual console successfully installed as xvc0
- Event-channel device installed.
- Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
- ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
- ide-floppy driver 0.99.newide
- usbcore: registered new driver hiddev
- usbcore: registered new driver usbhid
- drivers/usb/input/hid-core.c: v2.6:USB HID core driver
- PNP: No PS/2 controller found. Probing ports directly.
- i8042.c: No controller found.
- mice: PS/2 mouse device common for all mice
- md: md driver 0.90.3 MAX_MD_DEVS=256, MD_SB_DISKS=27
- md: bitmap version 4.39
- TCP bic registered
- Initializing IPsec netlink socket
- NET: Registered protocol family 1
- NET: Registered protocol family 17
- XENBUS: Device with no driver: device/vbd/51712
- XENBUS: Device with no driver: device/vif/0
- Initalizing network drop monitor service
- Write protecting the kernel read-only data: 498k
- Greetings.
- anaconda installer init version 11.1.2.224 starting
- mounting /proc filesystem... done
- creating /dev filesystem... done
- mounting /dev/pts (unix98 pty) filesystem... done
- mounting /sys filesystem... done
- anaconda installer init version 11.1.2.224 using /dev/xvc0 as console
- trying to remount root filesystem read write... done
- mounting /tmp as ramfs... done
- running install...
- running /sbin/loader
