# KVM Stream deployment

### KVM Stream Deployment

Requirements

* Ensure that `libvirt` (including `libvirt-client` ) and `virt-install` are installed locally on the KVM host server.
* You must either be a root user or ensure that the user that will later launch the deployment script is in the `libvrt` group on the KVM host server.
* Ensure that the desired KVM network (that will be used for the management interface is present, persistent, active, and autostarted using `virsh net-list –all` .)
  * The default driver supported for the network interface is `virtio-pci` .

Basic Interaction with KVM Virtual Machines

The easiest way to interact with KVM VMs via the command line is by using the `virsh` series of commands. Vectra’s deployment script will automatically start and configure the guest you, however these basic commands could prove helpful when diagnosing setup issues:

* View the list of configured virtual machines:
  * `virsh list --all`
* Start - In order to start a given virtual machine for which a configuration already exists:
  * `virsh start <name of vm>`
* Stop and save state:
  * `virsh shutdown <name of vm>`
* Stop quickly and don't save state (used only when you know you are going to purge the vm):
  * `virsh destroy <name of vm>`
* Purge the vm after stopping (needs to be used in tandem with destroy):
  * `virsh undefine <name of vm>`
* View the IP address(es) and MAC address(es) of a given virtual machine and its interfaces:
  * `virsh qemu-agent-command <name of vm> '{"execute":"guest-network-get-interfaces"}' | jq`

Installation

* Once downloaded, the machine image can be placed in the directory of your choice and uncompressed. It is a `.tar.xz` file.
  * On an Ubunto machine the `tar -xf` command will uncompress the file fully. Using other tools may require 2 steps:

![](https://4227135129-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHJ1ltuWFvsArFWtevnRn%2Fuploads%2Fgit-blob-2f2a893a4f58e3222ee0bc34017951a1335c49ea%2Fkvm-stream-deployment-1.png?alt=media)

* The script to start the deployment is `vectra-stream.sh` which has help that can be displayed as such:

```
vadmin@kvm1:~/vectra-stream-6.11-81-1632220207-cs-brain_vectracloudlab_com$ ./vectra-stream.sh -h
6.13.0-0-7017
Vectra Networks
KVM deployment script for Vectra virtual appliances.
 
USAGE: ./vectra-stream.sh [NAME] [DISK] [DEST_PATH] [MGT_NETWORK] [CAPTURE_NETWORK] [CONFIG_ID]
 
All arguments may be optionally provided as environment variables.
 
ARGS:
NAME              The name of the VM to be created.
                      default: vectra-stream
DISK              The path to the qcow2 disk image to either attach directly or clone.
                      default: /home/vadmin/vectra-stream-6.11-81-1632220207-cs-brain_vectracloudlab_com/vectra-stream.qcow2
DEST_PATH         The storage path for the new VM. If this is not the same directory as the disk image,
                    then the image will be copied to the path before attachment.
                      default: /home/vadmin/vectra-stream-6.11-81-1632220207-cs-brain_vectracloudlab_com/
MGT_NETWORK       The KVM network name to be used for management.
                      default: User selection
CAPTURE_NETWORK   The KVM network name to be used for traffic capture.
                  Not applicable for brain and stream modes.
                      default: User selection
CONFIG_ID         The index of the VM config to use. Run without args to view the options
                      default: User selection
 
CONFIGURATIONS:
ID       Flavor   CPUs     Memory   Disk
0        2core    2        8192     100G
1        4core    4        8192     150G
2        8core    8        16384    150G
3        16core   16       65536    500G
 
NETWORKS:
ID   Name
0    capture
1    default
```

* Execute the script to begin the deployment:

```
vadmin@kvm1:~/vectra-stream-6.12-26-1632394985-cs-brain_vectracloudlab_com$ ./vectra-stream.sh tbilen-stream
[Fri Sep 24 17:50:09 UTC 2021] - Setting VM configuration
ID       Flavor   CPUs     Memory   Disk
0        2core    2        8192     100G
1        4core    4        8192     150G
2        8core    8        16384    150G
3        16core   16       65536    500G
Select a configuration [0]: 0
 
[Fri Sep 24 17:50:12 UTC 2021] - Setting management NIC
ID   Name
0    capture
1    default
Select a management network [0]: 1
 
[Fri Sep 24 17:50:14 UTC 2021] - Resizing disk
[Fri Sep 24 17:50:14 UTC 2021] - Creating VM: tbilen-stream
[Fri Sep 24 17:50:15 UTC 2021] - Attaching brain data ISO
[Fri Sep 24 17:50:15 UTC 2021] - Starting VM: tbilen-stream
```

* As you can see in the above output, you will need to select a configuration (see the [Stream Sizing](#_Stream_Sizing) section earlier in this document) and a network interface to use for the management port of Stream.
* Stream will start automatically once the deployment script has finished.
