Virtualization and cloud computing is future of the IT. There are a lot of tools and architectures to make virtual the systems. Every big vendor have their original or clone virtualization technology or ecosystem. Linux provides KVM, Qemu for opensource, fast virtualization. Open source cloud ecosystem Openstack is mainly positioned on KVM,Libvirt and Qemu. In this tutorial we will look how to use virt-install
tool to create new virtual machines.
虚拟化和云计算是IT的未来。 有很多工具和体系结构可以使系统虚拟化。 每个大供应商都有其原始的或克隆的虚拟化技术或生态系统。 Linux为开源,快速虚拟化提供了KVM,Qemu。 开源云生态系统Openstack主要定位在KVM,Libvirt和Qemu上。 在本教程中,我们将研究如何使用virt-install
工具来创建新的虚拟机。
安装 (Installation)
virt-install
is a tool provided by tools set. We will install it like below.
virt-install
是工具集提供的工具。 我们将如下安装它。
Ubuntu,Debian,Mint,Kali: (Ubuntu, Debian, Mint, Kali:)
$ sudo apt install virtinst
Fedora,CentOS,RedHat: (Fedora, CentOS, RedHat:)
$ yum install virt-install
帮帮我 (Help)
Virt-install supports a lot of different option. These options can be listed like below.
Virt-install支持许多不同的选项。 这些选项可以如下列出。
$ virt-install -h
句法(Syntax)
We will use following syntax for virt-install
command.
我们将在virt-install
命令中使用以下语法。
virt-install --name NAME --ram RAM STORAGE INSTALL [options]
指定名称 (Specify Name)
Every guest instance have a name to specify themselves. We can set the name of the guest instance with the -n
or --name
options. In the example we set vm name as test1
.
每个来宾实例都有一个名称来指定自己。 我们可以使用-n
或--name
选项设置来宾实例的名称。 在示例中,我们将虚拟机名称设置为test1
。
In order to run virt-install there are 3 mandatory options name
, ram
and disk image
为了运行virt-install,有3个必填选项name
, ram
和disk image
$ sudo virt-install --name test1 --ram 300 --disk ./debian8.qcow2
指定磁盘文件 (Specify Disk File)
Disk image is specified with --disk
parameter. Disk image can be different types like qcow2
, vmdk
, vdi
etc.
磁盘映像是使用--disk
参数指定的。 磁盘映像可以是不同的类型,例如qcow2
, vmdk
, vdi
等。
http://www.poftut.com/linux-qemu-img-command-tutorial-examples-create-change-shrink-disk-images/
http://www.poftut.com/linux-qemu-img-command-tutorial-examples-create-change-shrink-disk-images/
$ virt-install --name test1 --ram 300 --disk ./debian8.qcow2