百度空间 | 百度首页 
 
查看文章
 
xen virt-install命令
2009年06月17日 星期三 下午 04:15
virt-install其实就是我们常使用的virt-manager的命令行。

看一下它的用法:
[root@maxcm ~]# virt-install --help
usage: virt-install --name NAME --ram RAM STORAGE INSTALL [options]

options:
-h, --help            show this help message and exit
--connect=CONNECT     Connect to hypervisor with URI

General Options:
    -n NAME, --name=NAME
                        Name of the guest instance
    -r MEMORY, --ram=MEMORY
                        Memory to allocate for guest instance in megabytes
    --arch=ARCH         The CPU architecture to simulate
    -u UUID, --uuid=UUID
                        UUID for the guest.
    --vcpus=VCPUS       Number of vcpus to configure for your guest
    --check-cpu         Check that vcpus do not exceed physical CPUs and warn
                        if they do.
    --cpuset=CPUSET     Set which physical CPUs Domain can use.
    --os-type=DISTRO_TYPE
                        The OS type for fully virtualized guests, e.g.
                        'linux', 'unix', 'windows'
    --os-variant=DISTRO_VARIANT
                        The OS variant for fully virtualized guests, e.g.
                        'fedora6', 'rhel5', 'solaris10', 'win2k'
    --host-device=HOSTDEVS
                        Physical host device to attach to the domain.

Full Virtualization specific options:
    --sound             Use sound device emulation
    --noapic            Disables APIC for fully virtualized guest (overrides
                        value in os-type/os-variant db)
    --noacpi            Disables ACPI for fully virtualized guest (overrides
                        value in os-type/os-variant db)

Virtualization Type Options:
    -v, --hvm           This guest should be a fully virtualized guest
    -p, --paravirt      This guest should be a paravirtualized guest
    --accelerate        Use kernel acceleration capabilities (kvm, kqemu, ...)

Installation Method Options:
    -c CDROM, --cdrom=CDROM
                        CD-ROM installation media
    -l LOCATION, --location=LOCATION
                        Installation source (eg, nfs:host:/path,
                        http://host/path, ftp://host/path)
    --pxe               Boot from the network using the PXE protocol
    --import            Build guest around an existing disk image
    --livecd            Treat the CD-ROM media as a Live CD
    -x EXTRA, --extra-args=EXTRA
                        Additional arguments to pass to the kernel booted from
                        --location

Storage Configuration:
    --disk=DISKOPTS     Specify storage to use as a disk with various options.
    -f FILE_PATH, --file=FILE_PATH
                        File to use as the disk image
    -s DISKSIZE, --file-size=DISKSIZE
                        Size of the disk image (if it doesn't exist) in
                        gigabytes
    --nonsparse         Don't use sparse files for disks. Note that this will
                        be significantly slower for guest creation
    --nodisks           Don't set up any disks for the guest.

Networking Configuration:
    -b BRIDGE, --bridge=BRIDGE
                        Bridge to connect guest NIC to; if none given, will
                        try to determine the default
    -w NETWORK, --network=NETWORK
                        Connect the guest to a virtual network, forwarding to
                        the physical network with NAT
    -m MAC, --mac=MAC   Fixed MAC address for the guest; if none or RANDOM is
                        given a random address will be used
    --nonetworks        Don't create network interfaces for the guest.

Graphics Configuration:
    --vnc               Use VNC for graphics support
    --vncport=VNCPORT   Port to use for VNC
    --sdl               Use SDL for graphics support
    --nographics        Don't set up a graphical console for the guest.
    --noautoconsole     Don't automatically try to connect to the guest
                        console
    -k KEYMAP, --keymap=KEYMAP
                        set up keymap for a graphical console

Miscellaneous Options:
    -d, --debug         Print debugging information
    --noreboot          Disables the automatic rebooting when the installation
                        is complete.
    --wait=WAIT         Time to wait (in minutes)
    --force             Forces 'yes' for any applicable prompts, terminates
                        for all others
    --prompt            Request user input for ambiguous situations or
                        required options.







现在我们就用命令行来创建一个虚拟机:

[root@maxcm ~]# virt-install -n system1 -r 2048 -f /var/lib/xen/images/rhel4pv.dsk -s 3 --vnc -p -l ftp://10.0.0.2/ftp/dist/redhat/alphas/rhel5.4a1/Server/ia64/
解释一下:
-n system1        命名
-r 2048         分配的内存大小
-f /var/lib/xen/images/rhel4pv.dsk      虚拟机的文件路径
-s 3            虚拟机的文件大小
--vnc           使用vnc
-p              半虚拟
-l ftp://10.0.0.2/ftp/dist/redhat/alphas/rhel5.4a1/Server/ia64/    安装树路径或者是系统ISO


查看一下,已经有了。
[root@maxcm ~]# xm list
Name                                      ID Mem(MiB) VCPUs State   Time(s)
Domain-0                                   0    30624     8 r-----    367.0
system1                                    1     2048     1 -b----      5.9


再来一个nfs的:
[root@maxcm ~]# virt-install -n system -r 10240 -f /var/lib/xen/images/rhel5pv.dsk -s 10 --vcpus=4 --vnc -p -l nfs:10.0.0.2:/pbfd/dist/redhat/alphas/rhel5.4a1/Server/ia64


 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码: 请点击后输入四位验证码,字母不区分大小写
      

     

©2009 Baidu