xen下安装虚拟机
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
使用xm命令管理虚拟机
我们安装虚拟机时,给虚拟机启的名字叫做 "domain" ,我们在真机中,使用xm命令来管理"domain".
xm命令主要选项如下图
xm需要了解和撑握的命令选项如下:
xm list 列出当前系统中所有的"domain"
在我的机器里,现在没有启用的虚拟机,只有1个 Domain-0 也就是本机,刚才已经在本机上建立了一个"domain"并安装了虚拟系统,可是在这里并没有出现。
xm create "domainname" 或 xm create /etc/xen/"domain配置文件"
我刚才建立的domainname 是“centos”所以,在这里,我输入xm create centos 这条命令也可以这样 xm create /etc/xen/centos
xm console "domainname" 连入"domain"控制台
xm console 后面可以直接跟着"domainname" 也可以使用xm list 查看domain ID 使用xm console "ID" 的方式连入虚拟机系统的控制台
上图是使用"domainname"的形式
使用 xm console "ID" 形式
xm destroy "domainname" 立即终止一个domain,在使用这条命令之后,再用xm list 就查看不到被终止的 domain 如果想要再次启用被终止的domain 就要使用
xm create "domainname"
还有一部分选项比较的简单,这里就不详细去说明了,例如: pause 暂停一个
domain reboot 重新引导一个domain save&restore save是保存domain的运行状态,restore 主用于恢复用svae保存的domain机状态 shuadown 关闭一个domain 等等,相信大家看一下帮助都能懂的
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