使用xen-tools快速创建虚拟机

简介:

1. Install xen-tools


aptitude install xen-tools

工具包中包含以下工具:

   /usr/bin/xen-create-image

   /usr/bin/xen-create-nfs

   /usr/bin/xen-delete-image

   /usr/bin/xen-list-images

   /usr/bin/xen-update-image

  在自动化管理xen虚拟机时都会用到以上几个命令,在创建虚拟机时主要使用xen-create-image命令,它主要调用以下几个命令:

   /usr/bin/xt-customize-image    创建镜像安装虚拟机

   /usr/bin/xt-install-image    手机hook脚本,对虚拟机进行配置

   /usr/bin/xt-create-xen-config    创建配置文件

   xen-tools主要使用到的的目录如下:

   /etc/xen-tools  包含主配置文件,分区配置文件,规则配置文件等。

   /var/log/xen-tools  包含每个vm创建过程中的日志。

   /usr/lib/xen-tools   包含一些hook脚本,在vm安装过程中对vm进行定制。

  /etc/xen-tools/xen-tools.conf 这是一个用脚本生成虚拟机实例的全局配置文件,包含在xen-tools包中,在该配置文件中定义的任何值都可以用外部命令重复定义

2. Usage:

We can now create a guest operating system with this tool. It effectively automates the process of setting up a PV guest from scratch right to the point of creating config files and starting the guest. The process can be summarized as follows:
(1)Create logical volume for rootfs
(2)Create logical volume for swap
(3)Create filesystem for rootfs
(4)Mount rootfs
(5)Install operating system using debootstrap (or rinse etc, only debootstrap covered here)
(6)Run a series of scripts to generate guest config files like fstab/inittab/menu.lst
(7)Create a Xen config file for the guest
(8)Generate a root password for the guest system
(9)Unmount the guest filesystem

These 9 steps can be carried out manually but the manual process is outside the scope of this guide. We instead will execute the below command:

 xen-create-image --hostname=testvm -memory=512mb --vcpus=2 --lvm=xenvg --dhcp --pygrub --dist=lenny

xm create -c /etc/xen/tutorial-pv-guest.cfg


3. 其他的示例使用方法

xen-create-image --hostname=my-lenny --dist=lenny --mirror=http://mirrors.163.com/debian --role=udev --force --verbose

xen-create-image --hostname=my-ubuntu-vm --dist=lucid --mirror=http://mirrors.163.com/ubuntu --role=udev --pygrub --force --verbose

xen-create-image --hostname=my-xen-vm --dist=squeeze --install-method=tar --install-source=/path/to/system_tared.tar.gz --pygrub --force --verbose

sudo xen-create-image --hostname=gutsy32.dev.stripe.com --lvm=percvg0 --size=20Gb --swap=1gb --ip=172.16.104.244 --netmask=255.255.255.0 --gateway=172.16.104.1 --force --memory=512Mb --arch=amd64 --kernel=/boot/vmlinuz-2.6.22-14-xen --initrd=/boot/initrd.img-2.6.22-14-xen --debootstrap --dist=dapper --mirror=http://mirror.internode.on.net/pub/ubuntu/ubuntu/ --passwd

sudo xen-create-image --hostname=enrico.railscamp.net --lvm=percvg0 --size=5G --swap=1gb --ip=172.16.104.201 --netmask=255.255.255.0 --gateway=172.16.104.1 --memory=256mb --arch=amd64 --kernel=/boot/vmlinuz-2.6.24-18-xen --initrd=/boot/initrd.img-2.6.24-18-xen --dist=hardy --mirror=http://172.16.104.251/ubuntu/main --passwd

sudo xen-create-image --hostname=railscamp.lstoll.net --dir=/xen-store --size=20Gb --swap=1gb --ip=172.16.2.3 --netmask=255.255.255.0 --gateway=172.16.2.1 --memory=512mb --arch=i386 --kernel=/boot/vmlinuz-2.6.24-19-xen --initrd=/boot/initrd.img-2.6.24-19-xen --dist=hardy --mirror=http://172.16.2.2:9999/ubuntu --passwd

本文转自feisky博客园博客,原文链接:http://www.cnblogs.com/feisky/archive/2013/02/04/2891963.html,如需转载请自行联系原作者

相关文章
|
4月前
|
Unix Linux 虚拟化
虚拟机VMware知识积累
虚拟机VMware知识积累
|
22天前
|
存储 SQL 数据挖掘
虚拟化数据恢复—VMware虚拟机vmdk文件被误删除的数据恢复案例
虚拟化数据恢复环境: 某品牌服务器(部署VMware EXSI虚拟机)+同品牌存储(存放虚拟机文件)。 虚拟化故障: 意外断电导致服务器上某台虚拟机无法正常启动。查看虚拟机配置文件发现这台故障虚拟机除了磁盘文件以外其他配置文件全部丢失,xxx-flat.vmdk磁盘文件和xxx-000001-delta.vmdk快照文件还在。管理员联系VMware工程师寻求帮助。VMware工程师尝试新建一个虚拟机来解决故障,但发现ESXi存储空间不足。于是将故障虚拟机下的xxx-flat.vmdk磁盘文件删除,然后重建一个虚拟机并且分配固定大小的虚拟磁盘。
|
2月前
|
测试技术 Linux 虚拟化
iOS自动化测试方案(五):保姆级VMware虚拟机安装MacOS
详细的VMware虚拟机安装macOS Big Sur的保姆级教程,包括下载VMware和macOS镜像、图解安装步骤和遇到问题时的解决方案,旨在帮助读者顺利搭建macOS虚拟机环境。
59 3
iOS自动化测试方案(五):保姆级VMware虚拟机安装MacOS
|
2月前
|
编解码 Linux 虚拟化
超详细VMware虚拟机安装Win10操作系统过程图解
这篇文章提供了一个详细的VMware虚拟机安装Windows 10操作系统的图解教程,包括了从创建虚拟机到安装操作系统的全过程,以及安装后的一些基本设置,如屏幕分辨率调整等。作者还提到了后续会分享关于磁盘分区的创建过程。
超详细VMware虚拟机安装Win10操作系统过程图解
|
2月前
|
虚拟化
vmware虚拟机使用主机代理访问谷歌
vmware虚拟机使用主机代理访问谷歌
|
3月前
|
存储 Linux 虚拟化
入职必会-开发环境搭建32-VMware虚拟机下载和安装
VMware虚拟机是一种基于VMware虚拟化技术的软件解决方案,它可以在一台物理计算机上创建多个独立的虚拟计算机环境。这些虚拟机可以运行不同的操作系统,如Windows、Linux等,使用户能够在单台计算机上同时运行多个操作系统。
107 0
入职必会-开发环境搭建32-VMware虚拟机下载和安装
|
3月前
|
存储 SQL 运维
服务器数据恢复—Isilon存储误删除vmware虚拟机的数据恢复案例
Isilon存储使用的是分布式文件系统OneFS。在Isilon存储集群里面每个节点均为单一的OneFS文件系统,所以Isilon存储在进行横向扩展的同时不会影响数据的正常使用。Isilon存储集群所有节点提供相同的功能,节点与节点之间没有主备之分。当用户向Isilon存储集群中存储文件时,OneFS文件系统层面将文件划分为128K的片段分别存放到不同的节点中,而节点层面将128K的片段分成8K的小片段分别存放到节点的不同硬盘中。用户文件的Indoe信息、目录项及数据MAP则会分别存储在所有节点中,这样可以确保用户不管从哪个节点都可以访问到所有数据。Isilon存储在初始化时会让用户选择相应的
62 12
|
2月前
|
虚拟化
VMware NAT 模式 虚拟机网络电缆被拔出,连不上网
VMware NAT 模式 虚拟机网络电缆被拔出,连不上网
65 0
|
3月前
|
运维 安全 虚拟化
|
3月前
|
安全 Linux 数据安全/隐私保护
入职必会-开发环境搭建33-VMWare虚拟机安装Linux系统
CentOS(Community ENTerprise Operating System)是一个基于Linux的开源操作系统,它是由社区志愿者团队从Red Hat Enterprise Linux(RHEL)源代码重新编译而成。CentOS致力于提供一个稳定、可靠且免费的企业级Linux发行版,适用于服务器和工作站环境。
下一篇
无影云桌面