How to create VM manually through command line

Step1: Create raw file (There are two partitioning types LVM and Raw)

# qemu-IMG create -f raw v1008. raw 30G

Step2: Convert the image file to raw format

# qemu-img convert -f raw -O raw /var/virtualizor/kvm/centos-7.1-x86_64. img /home/v1008.raw

Step3: Assign a password for the VM

# virt-sysprep -a /home/v1008.raw –root-password password:india123

Step4: Go to qemu XML location

 #cd /etc/libvirt/qemu/

Step5: Copy the Old XML file with a new one

# cp v1001.xml v1008.xml

Step6: Edit the XML file

# vi v1008.xml


Step7: Login virtual shell

NOTE: (virsh for KVM server / vzctl for Openvz server/pct for Proxmox server)

# virsh

Step8: Start the VM

# Create /etc/libvirt/qemu/v1008.xml

Step9: Now take VNC access via VNC viewer and assign an IP address

Take the server IP, port, and password from a qemu XML file as shown in the Image. (Require for VNC Viewer)


Step10: Now You can take ssh of the newly created VM

Step11: For listing all created VMs

# virsh (Go to virsh)
# list (For listing)
# shutdown vid or #destroy vid (To turn off the VM)


Still confused how to create VM manually through command line? Contact Ideastack now!

Frequently Asked Questions

Q1. What is a VM called?

A virtual machine (VM) is essentially a digital replica of a physical computer. It is equipped with software that enables it to execute programs and operating systems, store data, connect to networks, and perform other computing tasks. However, like any computer system, a virtual machine requires regular maintenance such as updates and system monitoring to ensure optimal performance.

Q2. What are two main components of a VM?

A virtual machine (VM) comprises two main components: the host VM and the guest VM. The host VM is hosted on a remote cloud server and operates in a similar way to the guest VM. However, it is accessed differently from the guest VM.

Q3. What is a VM language?

Virtual machines are software programs that utilize a sophisticated two-step compilation process to translate an intermediate language into machine code. By doing so, VMs eliminate the need for hardware-specific compilers for individual programming languages, enabling multiple languages to be compiled into machine code.