安装虚拟机

Xen, OpenVZ折腾了几天还是没搞清楚,还是先试试只支持安装ubuntu的vmbuilder吧,KVM

 

$sudo apt-get install ubuntu-vm-builder

 

选一个安装目,进入

 

$sudo vmbuilder kvm ubuntu -a amd64 --suite karmic --hostname vm01 --iso /home/zjay/vm/ubuntu-9.10-server-amd64.iso --libvirt qemu:///system

 

看下面的时间进度就知道要等多久了

2010-08-19 21:09:57,485 INFO    : Creating disk image: /tmp/vmbuilderC5TXh6/disk0.img

2010-08-19 21:09:57,499 INFO    : Adding partition table to disk image: /tmp/vmbuilderC5TXh6/disk0.img

2010-08-19 21:09:57,547 INFO    : Adding type 1 partition to disk image: /tmp/vmbuilderC5TXh6/disk0.img

2010-08-19 21:09:57,557 INFO    : Adding type 3 partition to disk image: /tmp/vmbuilderC5TXh6/disk0.img

2010-08-19 21:09:57,562 INFO    : [0] ../../libparted/filesys.c:147 (ped_file_system_type_get): File system alias linux-swap(new) is deprecated

2010-08-19 21:09:57,575 INFO    : Creating loop devices corresponding to the created partitions

2010-08-19 21:09:57,596 INFO    : Creating file systems

2010-08-19 21:09:57,615 INFO    : mke2fs 1.41.9 (22-Aug-2009)

2010-08-19 21:09:58,177 INFO    : mkswap: /dev/mapper/loop0p2: warning: don't erase bootbits sectors

2010-08-19 21:09:58,178 INFO    :         on whole disk. Use -f to force.

2010-08-19 21:09:58,183 INFO    : Mounting target filesystems

2010-08-19 21:09:58,190 INFO    : Installing guest operating system. This might take some time...

2010-08-19 21:13:51,349 INFO    : W: GPG error: http://archive.ubuntu.com karmic Release: The following signatures were invalid: BADSIG 40976EAF437D05B5 Ubuntu Archive Automatic Signing Key <[email protected]>

2010-08-19 21:14:02,635 INFO    : Searching for GRUB installation directory ... found: /boot/grub

2010-08-19 21:14:02,686 INFO    : Searching for default file ... Generating /boot/grub/default file and setting the default boot entry to 0

2010-08-19 21:14:02,687 INFO    : Searching for GRUB installation directory ... found: /boot/grub

2010-08-19 21:14:02,692 INFO    : Testing for an existing GRUB menu.lst file ...

2010-08-19 21:14:02,693 INFO    : 

2010-08-19 21:14:02,693 INFO    : Could not find /boot/grub/menu.lst file.

2010-08-19 21:14:02,693 INFO    : Generating /boot/grub/menu.lst

2010-08-19 21:14:02,757 INFO    : Searching for splash image ... none found, skipping ...

2010-08-19 21:14:02,898 INFO    : grep: /boot/config*: No such file or directory

2010-08-19 21:14:02,973 INFO    : Updating /boot/grub/menu.lst ... done

2010-08-19 21:14:02,973 INFO    : 

2010-08-19 21:14:03,148 INFO    : Searching for GRUB installation directory ... found: /boot/grub

2010-08-19 21:14:03,202 INFO    : Searching for default file ... found: /boot/grub/default

2010-08-19 21:14:03,203 INFO    : Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst

2010-08-19 21:14:03,311 INFO    : Searching for splash image ... none found, skipping ...

2010-08-19 21:14:03,341 INFO    : grep: /boot/config*: No such file or directory

2010-08-19 21:14:03,420 INFO    : Updating /boot/grub/menu.lst ... done

2010-08-19 21:14:03,420 INFO    : 

2010-08-19 21:14:03,446 INFO    : Searching for GRUB installation directory ... found: /boot/grub

2010-08-19 21:15:05,852 INFO    : Done.

2010-08-19 21:15:06,555 INFO    : Running depmod.

2010-08-19 21:15:06,625 INFO    : update-initramfs: Generating /boot/initrd.img-2.6.31-22-server

2010-08-19 21:15:08,710 INFO    : Running postinst hook script /usr/sbin/update-grub.

2010-08-19 21:15:08,800 INFO    : Searching for GRUB installation directory ... found: /boot/grub

2010-08-19 21:15:08,836 INFO    : Searching for default file ... found: /boot/grub/default

2010-08-19 21:15:08,836 INFO    : Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst

2010-08-19 21:15:08,909 INFO    : Searching for splash image ... none found, skipping ...

2010-08-19 21:15:08,938 INFO    : Found kernel: /boot/vmlinuz-2.6.31-22-server

2010-08-19 21:15:09,004 INFO    : Replacing config file /var/run/grub/menu.lst with new version

2010-08-19 21:15:09,020 INFO    : Updating /boot/grub/menu.lst ... done

2010-08-19 21:15:09,020 INFO    : 

2010-08-19 21:15:10,269 INFO    : 

2010-08-19 21:15:10,269 INFO    : Current default time zone: 'Etc/UTC'

2010-08-19 21:15:10,272 INFO    : Local time is now:      Thu Aug 19 13:15:10 UTC 2010.

2010-08-19 21:15:10,273 INFO    : Universal Time is now:  Thu Aug 19 13:15:10 UTC 2010.

2010-08-19 21:15:10,273 INFO    : 

2010-08-19 21:15:13,593 INFO    : update-initramfs: Generating /boot/initrd.img-2.6.31-22-server

Extracting templates from packages: 100%

2010-08-19 21:25:14,080 INFO    : install-info: warning: maintainer scripts should not call install-info anymore,

2010-08-19 21:25:14,081 INFO    : install-info: warning: this is handled now by a dpkg trigger provided by the

2010-08-19 21:25:14,082 INFO    : install-info: warning: install-info package; package gzip should be updated.

2010-08-19 21:25:19,860 INFO    : 

2010-08-19 21:25:19,860 INFO    : Current default time zone: 'Etc/UTC'

2010-08-19 21:25:19,860 INFO    : Local time is now:      Thu Aug 19 13:25:15 UTC 2010.

2010-08-19 21:25:19,861 INFO    : Universal Time is now:  Thu Aug 19 13:25:15 UTC 2010.

2010-08-19 21:25:19,861 INFO    : Run 'dpkg-reconfigure tzdata' if you wish to change it.

2010-08-19 21:25:19,861 INFO    : 

2010-08-19 21:25:30,022 INFO    : Copying to disk images

2010-08-19 21:25:34,463 INFO    : Installing bootloader

2010-08-19 21:25:39,196 INFO    : Unmounting target filesystem

2010-08-19 21:25:42,395 INFO    : Converting /tmp/vmbuilderC5TXh6/disk0.img to qcow2, format ubuntu-kvm/disk0.qcow2

2010-08-19 21:25:46,677 INFO    : Cleaning up

 

完成后

$sudo virsh

Domain vm01 started

#list --all

 Id Name                 State

----------------------------------

  1 vm01                 shut off

 

#start vm01

Domain vm01 started

 

在一个ubuntu desktop上安装vir viewer

$sudo apt-get install virt-viewer

$virt-viewer -c qemu+ssh://[email protected]/system vm01

[email protected]'s password:******

[email protected] 是虚机所在的宿主机的ssh入口,输入相应的ssh密码

 

新建的ubuntu虚机的帐号密码俱为ubuntu

 


你可能感兴趣的:(虚拟机,image,File,ubuntu,2010,filesystems)