Changes between Version 1 and Version 2 of Csle2022/Agenda/virtualization


Ignore:
Timestamp:
Oct 20, 2022, 12:19:14 PM (2 years ago)
Author:
admin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Csle2022/Agenda/virtualization

    v1 v2  
    55Here we look at how to install KVM on Ubuntu 20.04 LTS.
    66
    7 First update the Ubuntu package repository.
     7First we have do the network configuration. If we need the VMs to receive the same IP range as in the Host server, then we need to create a network bridge interface. Network bridge 'virbr0' is already created with NAT enabled. Now need to configure it in bridge mode. Change the configuration as in the below,
     8
     9{{{
     10network:
     11  ethernets:
     12    eno1:
     13      dhcp4: no
     14    eno2:
     15      dhcp4: true
     16    eno3:
     17      dhcp4: true
     18    eno4:
     19      dhcp4: true
     20  version: 2
     21
     22  bridges:
     23    virbr0:
     24      interfaces: [eno1]
     25      addresses:
     26        - 192.168.0.10/24
     27      gateway4: 192.168.0.254
     28      nameservers:
     29        addresses: [192.248.1.161,1.1.1.1]
     30}}}
     31
     32Once done execute below to test the connection and if OK Enter to accept the changes,
     33
     34{{{
     35sudo netplan try
     36}}}
     37
     38and then check the connectivity.
     39
     40Once we are done with the network configuration we will go to installation of the KVM.
    841
    942Before installing KVM on Ubuntu, we are first going to verify if the hardware supports KVM. A minimum requirement for installing KVM is the availability of CPU virtualization extensions such as AMD-V and Intel-VT.
     
    4174}}}
    4275
    43 [[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web1.png)]]
    44 
    4576To view available Guest os variants,
    4677
     
    5283= Creating a Virtual Machine =
    5384
     85The virt-install command-line tool is used for creating virtual machines on the terminal. A number of parameters are required when creating a virtual machine.
     86
     87{{{
    5488sudo virt-install --name perfsonar --os-variant centos7.0 --vcpus 4 --ram 16384 --cdrom /home/lg/downloads/pS-Toolkit-4.4.4-CentOS7-FullInstall-x86_64-2022Apr04.iso --network bridge=virbr0,model=virtio --graphics vnc,listen=0.0.0.0 --noautoconsole --disk size=100
     89}}}
     90
     91To list the created VM,
     92{{{
     93virsh list --all
     94}}}
     95
     96[[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/kvm1.png)]]
     97
     98Now the VM is created with a installation image mounted and ready for the installation. To continue the installation we will use a VNC client to connect to the graphical console of the VM.
     99To connect with the VM we need to get the TCP port number the VM is listening on. To get the port number we will execute this first.
     100
     101{{{
     102virsh vncdisplay perfsonar
     103}}}
     104
     105[[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/kvm2.png)]]
     106
     107The given is the VNC port number which is not exactly same as TCP port number. But we can derive the TCP port number using VNC port number because they have correlation. If the VNC port is :0 then TCP port will be 5900 and if the VNC port is :1 TCP port will be 5901 and so on. Using this relationship we can get the TCP port number and connect the graphical console of the VM. Then we can continue the installation as we normally do in a computer with monitor.
     108
     109
     110