In this 4th part of our [KVM series][1], we are discussing KVM environment management using CLI. We use ‘virt-install’ CL tool to create and configure virtual machines, virsh CL tool to create and configure storage pools and qemu-img CL tool to create and manage disk images.
![KVM Management in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/KVM-Management-in-Linux.jpg)
KVM Management in Linux
There is nothing new concepts in this article, we just do the previous tasks using command line tools. There is no new prerequisite, just the same procedure, we have discussed in previous parts.
### Step 1: Configure Storage Pool ###
Virsh CLI tool is a management user interface for managing virsh guest domains. The virsh program can be used either to run one command by giving the command and its arguments on the shell command line.
In this section, we will use it to create storage pool for our KVM environment. For more information about the tool, use the following command.
# man virsh
**1. Using the command pool-define-as with virsh to define new storage pool, you need also to specify name, type and type’s arguments.**
In our case, name will be Spool1, type will be dir. By default you could provide five arguments for the type:
- source-host
- source-path
- source-dev
- source-name
- target
For (Dir) type, we need the last argumet “target” to specify the path of storage pool, for the other arguments we could use “-” to unspecific them.
# virsh pool-define-as Spool1 dir - - - - "/mnt/personal-data/SPool1/"
![Create New Storage Pool](http://www.tecmint.com/wp-content/uploads/2015/02/Create-New-Storage-Pool.png)
Create New Storage Pool
**2. To check the all storage pools you have in the environment, use the following command.**
# virsh pool-list --all
![List All Storage Pools](http://www.tecmint.com/wp-content/uploads/2015/02/List-All-Storage-Pools.png)
List All Storage Pools
**3. Now it’s time to build the storage pool, which we have defined above with the following command.**
**Warning**: Never use qemu-img to modify images in use by a running virtual machine or any other process; this may destroy the image.
Now its time to create virtual machines in the next step.
### Step 3: Create Virtual Machines ###
10. Now with the last and latest part, we will create virtual machines using virt-istall. The virt-install is a command line tool for creating new KVM virtual machines using the “libvirt” hypervisor management library. For more details about it, use:
# man virt-install
To create new KVM virtual machine, you need to use the following command with all the details like shown in the below.
- Name: Virtual Machine’s name.
- Disk Location: Location of disk image.
- Graphics : How to connect to VM “Usually be SPICE”.
- vcpu : Number of virtual CPU’s.
- ram : Amount of allocated memory in megabytes.
- Location : Specify the installation source path.
- Network : Specify the virtual network “Usually be vibr00 bridge”.
![Installation of Virtual Machine](http://www.tecmint.com/wp-content/uploads/2015/02/Installation-of-Virtual-Machine.jpeg)
Installation of Virtual Machine
### Conclusion ###
This is the latest part of our KVM tutorial, we haven’t covered everything of course. It a shot to scratch the KVM environment so its your turn to search and keep hands dirty using this nice resources.
- [KVM Getting Started Guide][2]
- [KVM Virtualization Deployment and Administration Guide][3]