![]() |
In this tutorial, we are going to see how we can create a virtual machine in Linux using a Kernel-based Virtual Machine. Virtual machines are based on computer architectures and provide the functionality of a physical computer but first, we need to understand what is a kernel-based virtual machine. The Information Technology field is complex it needs proper scalability and reliability to operate, virtualization is one way to increase efficiency and reduce downtime. So basically virtualization is obtaining a virtual version of features such as hardware, software and that virtual version will be independent of the normal working of the device. Virtual machines are examples of Virtualization. Kernel-Based Virtual MachineThe purpose of Kernel-Based Virtual Machine (KVM) is to provide the ability of virtualization to Linux. It is an open-source technology which provides which allows Linux machines (host) to run different environments called virtual machines. Each virtual machine represents a different Linux process. Each Virtual Machine has its own copy of hardware such as memory, processor, and also software this allows to use of resources to a greater extent causing more reliability. Steps for creating Virtual Machine in Linux using KVMNote: We are going to use ubuntu os throughout this tutorial,
Virtualization InabilityTo create a virtual machine first we need to ensure that virtualization is enabled on our system. It is mandatory to create virtual machines. There are multiple ways to check if virtualization is enabled,
The above command /proc/cpuinfo gives information about the processor. The output of the command will be a number. The output number 1 or more than that represents that virtualization is enabled, output 0 says you need to enable virtualization on your system. ![]() Virtualization Inability
This command is used to check which type of virtualization your processor supports. If the system contains a CPU with Intel VT support, the above command will provide the following output ![]() Virtualization Type Installing KVM on UbuntuNow we know our system is capable of creating and running virtual machines, it’s time to install tools which will create our virtual machines. To install KVM and other KVM dependencies such as virt-manager, bridge-utils enter command:
All dependencies are installed now run command its time to check if KVM ins installed successfully:
![]() Check if KVM is Installed properly Also, we need to confirm if the virtualization daemon – libvritd-daemon – is running, to do so enter the command.
If the output is not active: running you need to start daemon thread If the daemon thread is not running enter the following command to start the thread,
Adding a user to KVMIn this part, we are going to create a user for KVM. To prevent root user from using KVM and root user is only available when root user is a part of libvirt/libvirtd group. To add a new user to KVM, use the following command,
[username] enter the username of your choice if the output is ![]() Adding User to KVM Then your KVM is already a member of the non-root user and serves the same purpose as libvirtd group then you don’t need to add yourself to the group. Creating Virtual MachineThere are two ways to create a virtual machine
virt-install is a command which is used to create virtual machines in Linux, following is the command which creates a VM.
The above command creates a Ubuntu virtual machine with version 20.04 and the name ubuntu-guest.
Create a Virtual machine using a graphical interface If you are not much familiar with the command line don’t worry there’s another way to create a virtual machine using a tool called virt-manager you can easily create virtual machines. Steps to create VM using virt-manager, Step 1: Launch virt-manager Step 2: Choose installation media it can be an iso file of OS, you can install from the network or can be a disk copy Step 3: Enter the path/URL of your file click next Step 4: Enter memory and CPU requirements Step 5: Enter required disk space Step 6: Enter the name of VM and check specifications and hit the finish Now the installations should be completed and the virtual machine should start running. |
Reffered: https://www.geeksforgeeks.org
Geeks Premier League |
Related |
---|
![]() |
![]() |
![]() |
![]() |
![]() |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 10 |