• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to Create and deploy Virtual Machines in Linux - KVM

781

Steps to Create and deploy Virtual Machines in Linux Using KVM

KVM (Kernel-based Virtual Machine)

KVM / Kernel-based Virtual Machine is a complete virtual solution for Linux on Intel 64 and also AMD 64 hardware, which is included in the mainline Linux kernel. This article explains the KVM installation and deployment of virtual machines under RedHat based-distributions.

Features

&lowast Virtual CPU hot add capability : Increases processing power as needed on running machines.
&lowast Improved scalability : virtual machines can connect to one or more storage devices
&lowast Automatic NUMA balancing : Enhances the performance of applications running on NUMA systems.
&lowast Thin provisioning : It optimizes the available space for every guest machine and allows the allocation of flexible storage.
&lowast Over-committing : It means allocating more memory or virtualized CPUs than the available resources.
&lowast Disk I/O throttling : Sets a limit on disk I/O requests sent from virtual to the host machine.

On Intel based Hosts

Use the following command to check the availability of CPU virtualization extensions [vmx].

[root@linuxhelp ~]# grep -e ' vmx'  /proc/cpuinfo
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt aes xsave avx hypervisor lahf_lm ida arat epb pln pts dtherm tpr_shadow vnmi ept vpid xsaveopt


When there is no output, check whether the virtualization extensions is enabled in BIOS and also make sure that KVM modules are loaded in the kernel.

[root@linuxhelp ~]# lsmod | grep kvm
kvm_intel             167936  0
kvm                   499712  1 kvm_intel


The output must have kvm_intel for kvm_amd for amd-based hosts or intel-based hosts.

To Install and Deploy KVM

Run the following command to install qemu-kvm and qemu-img package.


[root@linuxhelp ~]# yum install qemu-kvm qemu-img
Yum command has been deprecated, redirecting to ' /usr/bin/dnf install qemu-kvm qemu-img' .
See ' man dnf'  and ' man yum2dnf'  for more information.
To transfer transaction metadata from yum to DNF, run:
' dnf install python-dnf-plugins-extras-migrate & &  dnf-2 migrate' 

Last metadata expiration check performed 0:05:51 ago on Fri May  6 09:37:05 2016.
Dependencies resolved.
=============================================================================================
 Package                      Arch       Version                           Repository   Size
=============================================================================================
Installing:
 SDL2                         x86_64     2.0.4-4.fc23                      updates     376 k
 boost-thread                 x86_64     1.58.0-8.fc23                     fedora       89 k
 glusterfs                    x86_64     3.7.11-1.fc23                     updates     453 k
.
.
.
  spice-server.x86_64 0.12.6-1.fc23                                                          
  vte3.x86_64 0.36.5-1.fc23                                                                  
  xen-libs.x86_64 4.5.3-2.fc23                                                               
  xen-licenses.x86_64 4.5.3-2.fc23                                                           
Complete!


Now you are provided with minimum requirement for deploying virtual platform, but still there are tools to manage the platform, such as

&lowast virt-install supplies the command ' virt-install' for creating virtual machines from CLI.
&lowast libvirt-client supplies a CL tool to manage virtual environment this tool is known as virsh.
&lowast virt-manager supplies a GUI tool to manage virtual machines.
&lowast libvirt supplies the server and also host side libraries for interacting with host systems and hypervisors.

Run the following command to install the additional tools required.

[root@linuxhelp ~]# yum install virt-manager libvirt libvirt-python libvirt-client
Yum command has been deprecated, redirecting to ' /usr/bin/dnf install virt-manager libvirt libvirt-python libvirt-client' .
See ' man dnf'  and ' man yum2dnf'  for more information.
To transfer transaction metadata from yum to DNF, run:
' dnf install python-dnf-plugins-extras-migrate & &  dnf-2 migrate' 

Last metadata expiration check performed 0:10:57 ago on Fri May  6 09:37:05 2016.
Dependencies resolved.
=============================================================================================
 Package                            Arch      Version                       Repository  Size
=============================================================================================
Installing:
 autogen-libopts                    x86_64    5.18.6-1.fc23                 fedora      71 k
 corosync                           x86_64    2.3.5-1.fc23                  fedora     201 k
 corosynclib                        x86_64    2.3.5-1.fc23                  fedora     118 k
 cyrus-sasl                         x86_64    2.1.26-25.2.fc23              fedora      92 k
 dmidecode                          x86_64    1:3.0-1.fc23                  updates     89 k
.
.
.
  python-xpyb.x86_64 1.3.1-5.fc23                                                            
  radvd.x86_64 2.11-3.fc23                                                                   
  sheepdog.x86_64 0.3.0-10.fc23                                                              
  unbound-libs.x86_64 1.5.8-2.fc23                                                           
  virt-manager.noarch 1.3.2-2.fc23                                                           
  virt-manager-common.noarch 1.3.2-2.fc23                                                    

Complete!

Now start and enable ' libvirtd' by using the following command.


[root@linuxhelp ~]# systemctl start libvirtd
[root@linuxhelp ~]# systemctl enable libvirtd


Verify the status by running following command.

[root@linuxhelp ~]# systemctl status libvirtd
? libvirtd.service - Virtualization daemon
   Loaded: loaded (/usr/lib/systemd/system/libvirtd.service  enabled  vendor preset: enabled)
   Active: active (running) since Fri 2016-05-06 10:00:45 IST  11min ago
     Docs: man:libvirtd(8)
           http://libvirt.org
 Main PID: 1232 (libvirtd)
   CGroup: /system.slice/libvirtd.service
           ??1232 /usr/sbin/libvirtd
           ??1466 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasef...
           ??1467 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasef...

May 06 10:01:07 linuxhelp dnsmasq-dhcp[1466]: read /var/lib/libvirt/dnsmasq/default.hostsfile
May 06 10:08:10 linuxhelp systemd[1]: Started Virtualization daemon.
May 06 10:11:36 linuxhelp systemd[1]: Started Virtualization daemon.
Hint: Some lines were ellipsized, use -l to show in full.

To Create VMs using KVM

Launch/start virt-manager from either terminal or from GUI.

[root@server ~]# virt-manager


virtual machine manager


Create the Volume Disk for virtual machine, after returning to your localhost. Right click on localhost and choose ' Details' and then click ' Storage' tab.
Volume Disk creation
storage

Now click ' Create New Volume' button and enter the name of the new virtual disk and then type the size in the ' Max Capacity' section.

storage volume creation

Important: Thin provision is an essential technology in storage administration field which is used to allocate the used storage size.

Now a label of the new Volume Disk will be displayed in the list.
new Volume Disk
You can also see the path of the new disk image, which will be under /var/lib/libvirt/images, you can verify it by executing the following command.

[root@server Downloads]# ls -l /var/lib/libvirt/images
-rw-------. 1 root root 10737418240 May  6 10:21 virtDisk1.img
-rw-------. 1 root root 10737418240 May  6 10:27 virtDisk2.img

Now create the virtual machine by simply clicking ' VM' icon or ‘ File&rarr New Virtual Machine‘ in the main window.
new virtual machine creation
Specify the Local install media to be used, by selecting the available options
&rarr From ISO image.
&rarr From physical [CDROM/DVD]
new virtual machine


Use the disk to install virtual machine.
install virtual machine
Type the RAM size and select CPU of the virtual machine that you have created.
RAM size
Next enable and specify that virtual storage path.
virtual storage path
Now click ‘ finish’ .
finish
Now the virtual machine ready to use.
start fedora live

Tags:
cameron
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

How to check the availability of CPU virtualization extensions[vmx] in Linux?

A

Use the following command to check the availability of CPU virtualization extensions [vmx].

grep -e ' vmx' /proc/cpuinfo

Q

How to Install and Deploy KVM?

A

Use the following command to install Deploy KVM:
yum install qemu-kvm qemu-img

Q

How to check whether the virtualization extensions are enabled in BIOS and also make sure that KVM modules are loaded in the kernel?

A

we can using this command helps whether enable or not:
lsmod | grep kvm

Q

How to install the additional tools to manage virtual machines?

A

Run the following command to install the additional tools
yum install virt-manager libvirt libvirt-python libvirt-client

Q

How to start and enable 'libvirtd'?

A

Now start and enable ' libvirtd' by using the following command.
systemctl start libvirtd
systemctl enable libvirtd

Related Tutorials in How to Create and deploy Virtual Machines in Linux - KVM

Related Tutorials in How to Create and deploy Virtual Machines in Linux - KVM

How to add and remove local storage repository in xenserver
How to add and remove local storage repository in xenserver
Jul 1, 2016
How to Create and Manage KVM Virtual Machine through Command Line in Linux
How to Create and Manage KVM Virtual Machine through Command Line in Linux
Jul 4, 2016
How to create virtual machine in Xenserver using XenCenter tool
How to create virtual machine in Xenserver using XenCenter tool
Jul 2, 2016
How to Migrate Virtual Machines using RHEV clusters
How to Migrate Virtual Machines using RHEV clusters
Jul 15, 2016
How to Setup RedHat Enterprise Virtualization Hypervisor in Linux
How to Setup RedHat Enterprise Virtualization Hypervisor in Linux
Jul 2, 2016
How to add image files to Datastore and create Virtual machine in ESXi server
How to add image files to Datastore and create Virtual machine in ESXi server
Apr 5, 2017
How to install Xenserver update patch file using xencenter tool - Part 3
How to install Xenserver update patch file using xencenter tool - Part 3
Jun 24, 2016
How to Open Multiple Virtual Machine in KVM
How to Open Multiple Virtual Machine in KVM
Jul 1, 2016

Related Forums in How to Create and deploy Virtual Machines in Linux - KVM

Related Forums in How to Create and deploy Virtual Machines in Linux - KVM

Virtual memory statistics
william class=
Failed to connect socket to /var/run/libvirt/libvirt-sock: No such file or directory
May 9, 2017
KVM
cameron class=
is it possible to suspend VMs in KVM
May 9, 2017
KVM
brayden class=
how to shutdown the virtual machine from command-line in KVM
May 8, 2017
Virtual appliance
elijah class=
How to import Virtual Box VM using VMWare
Nov 20, 2019
Virtualbox
isaiah class=
deleting a virtual machine using virsh command in Redhat
May 8, 2017
Virtual-machine
andrew class=
commandline virtual machine start
May 8, 2017
CentOS
david class=
steps to create virtual machine in CentOS
May 8, 2017
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help keel johnston ?
Unhide the folders on windows Explorer

Give any solutions to unhide folder using command prompt?

forum3

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.