INT-362
Section K22DT
KVM install & Host
Creation
3 main settings we will do 1stly
Set up nested virtualization in VMWare Workstation
1.Navigate to the VM Settings - Hardware page for the
VM you would like to edit.
2.Click Edit in the Guest OS settings section.
3.Click the checkbox for Enable nested virtualization.
Set up nested virtualization in VMWare Workstation
How to disable Hyper-V in Windows 11 using Control Panel
The simplest way to turn off Hyper-V on your PC involves navigating through Windows Features in the Control Panel.
1. Type "Control panel" into the Search Bar and click on the Control Panel suggestion.
2. Click on Programs
Select Turn Windows features on or off
INT-362
Adding hosts
Set up VirtualBox nested virtualization
The system settings are divided into a series of tabs. Select the Processor tab, then the Enable Nested VT-x/AMD-V
checkbox and click OK. Now the VM is ready for nested virtualization
open the settings of (powered off) virtual
machine and go to System -> Processor, the
option "Enable Nested VT-x/AMD-V" is
greyed out and if it cannot be enabled.
open a new PowerShell in your VB installation
folder and type:
./VBoxManage modifyvm "Virtual Machine Name" --nested-hw-virt on
Set up nested virtualization in VMWare Fusion in MAC
It can be enabled by ticking the Enable hypervisor applications in this virtual machine option. This is found in the advanced options of the Processors
& Memory screen for the virtual machine you want to run nested virtualization on.
Note:
Perform the following steps:
KVM install
1. Go to: settings® windows security® Device Security® core isolation® memory integrity off
Step1: window security device security
Note:
KVM install
Perform the following steps:
1. Go to: settings® windows security® Device Security® core isolation® memory integrity off
Note:
KVM install
Perform the following steps:
1. Go to: settings® windows security® Device Security® core isolation® memory integrity off
Step 3
INT-362
Preparation for KVM install
In your Virtualbox or VMWare workstation
• Turn on nested virtualization —processor enable vtx
• Ensure windows allows nested virtualization
• Ensure core isolation is turned OFF
• Add a new adapter for host-only networks
• check using sudo kvm-ok
• egrep -c '(vmx|svm)' /proc/cpuinfo
INT-362
Preparation for KVM install
After ensuring cloudstack
sudo systemctl status cloudstack-management
is up and running you will need to install a few new packages
on your terminal run the following (sudo su)
apt install -y openssh-server
apt install -y cpu-checker
apt install -y cloudstack-agent
INT-362
Next for KVM install is:
Setup domain name because you have to install kvm and
management server to same machine
hostname --fqdn
this command tells you your complete name, for ex it is
server.cloud.c1, then do
sudo nano /etc/idmapd.conf
• here uncomment domain and write the domain name from your
hostname
• now my domain name will be cloud.c1
Edit permission INT-362
You should run these in root mode by entering
su root and your password(
https://www.cyberciti.biz/faq/change-root-password-ubuntu-linux/ )->
sed -i -e 's/\#vnc_listen.*$/vnc_listen = "0.0.0.0"/g' /etc/libvirt/qemu.conf
Restart
systemctl mask libvirtd.socket libvirtd-ro.socket libvirtd-admin.socket libvirtd-tls.socket libvirtd-tcp.socket
systemctl restart libvirtd
apt-get install uuid
UUID=$(uuid)
echo host_uuid = \"$UUID\" >> /etc/libvirt/libvirtd.conf
INT-362
Edit permission
Again run these in root mode by entering
su root and your password
echo host_uuid = \"$UUID\" >> /etc/libvirt/libvirtd.conf
sudo nano /etc/libvirt/libvirtd.conf
libvirt focuses on managing single hosts and provides APIs to
enumerate, monitor and use the resources available on the
managed node, including CPUs, memory, storage, networking
Libvirtd: d means daemon
a daemon is a computer program that runs as a
background process,
INT362
Edit permission- Called libvirtd INT-362
file
You should make these settings in sudo nano /etc/libvirt/libvirtd.conf
uncomment the lines (very imp)
• listen_tls=0
• listen_tcp=0
• tcp_port = "16509"
• tls_port = "16514"
• listen_addr = "192.168.139.2“ # set as your gateway-------------
• mdns_adv = 0 # this line needs to be added separately
• auth_tcp = "none"
• Save and exit Ctrl+X enter y enter->
systemctl restart libvirtd
INT-362
Edit permission
You should make these settings in sudo nano/etc/cloudstack/agent/agent.properties,
change these lines
• host=[give your management server ip here]@static
This should look like host=192.168.139.133@static
Uncomment the lines
• private.network.device=cloudbr0
• public.network.device=cloudbr0
• guest.network.device=cloudbr0
Make sure all use cloubr0
After making these changes, restart libvirt, restart cloudstack-agent
INT-362
Edit permission
You should run these in root mode by entering
su root and your password
ln -s /etc/apparmor.d/usr.sbin.libvirtd /etc/apparmor.d/disable/
ln -s /etc/apparmor.d/usr.lib.libvirt.virt-aa-helper /etc/apparmor.d/disable/
apparmor_parser -R /etc/apparmor.d/usr.sbin.libvirtd
apparmor_parser -R /etc/apparmor.d/usr.lib.libvirt.virt-aa-helper
INT-362
Configure Networks
Bridging will be needed between management server and KVM
• Go to sudo nano /etc/netplan/01-network-manager-all.yaml
• Visit tinyurl.com/int362cp to find contents of this file
• you should know by now what needs to be replaced in this, close and
exit
sudo netplan apply or netplan --debbug apply
sudo systemctl restart NetworkManager
INT-362
Configure Firewall
Your firewall needs information on working ports so run these
$ ufw allow proto tcp from any to any port 22
did you get permission denied.... who will give sudo in front?
$ ufw allow proto tcp from any to any port 1798
$ ufw allow proto tcp from any to any port 16514
$ ufw allow proto tcp from any to any port 5900:6100
$ ufw allow proto tcp from any to any port 49152:49216
or you could get rid of it using
sudo ufw disable
INT-362
Configure additional settings
Now check status of a few services if they are functional
• In an extreme case you might need to pick up host_uuid without quotes
from
sudo nano /etc/libvirt/libvirtd.conf
• find the host-uuid in end of file, copy the uuid
• then open sudo nano /etc/cloudstack/agent/agent.properties
• paste in from of guid=
INT-362
Try adding host
Unable to add host?
Troubleshoot!!! Check logs
sudo systemctl status libvirtd
sudo systemctl status cloudstack-agent
sudo journalctl -xeu cloudstack-agent
INT-362
Everything seems fine ?
Go to management server in browser and add
host
setup the ip addresses properly
Now Setup Graphically
1. Setting up a Zone
2. Setting up a Pod
3. Setting up a Cluster
4. Setting up a Host
Zones
A CloudStack Zone (often called Availability Zone) is the largest organisational unit
within a CloudStack deployment. Typically, a datacentre (DC) implementation will
contain a single Zone, but there are no hard and fast rules, and a DC can contain
multiple Zones. By structuring CloudStack into geographical Zones, virtual instances
and data storage can be placed in specific locations to comply with an organisation’s
data storage policies etc.
A Zone consists of at least one Pod, and Secondary Storage which is shared by all
Pods in the Zone.
Zones are visible to end users, who can then choose which Zone they wish to create
their virtual Instances in.
Pods
Typically, a Pod relates to a discrete rack in a datacentre so that from CloudStack a
whole rack/pod of hosts can be taken offline for maintenance as a group. Pods
contain one or more Clusters, and a Layer 2 switch architecture which is shared by
all Clusters in that Pod. End users are not aware of and have no visibility of Pods.
INT362
Clusters
A Cluster is a group of identical Hosts running a common Hypervisor. For example, a
Cluster could be a XenServer Pool, a group of KVM Servers or a VMware cluster pre-
configured in vCenter. Each Cluster has a dedicated Primary Storage array which is where
the virtual machine instances are hosted.
Primary Storage
Primary Storage is usually unique to each Cluster (although it could also be used Zone-
wide) and is used to host Instances. CloudStack is designed to work with all standards-
compliant iSCSI and NFS Servers supported by the underlying Hypervisor. Special storage
solutions are also supported (such as CEPH, ScaleIO, SolidFire, etc). Primary Storage is a
critical component and should be built on high-performance hardware with multiple high-
speed disks.
Secondary Storage
Secondary Storage is used to store Instance Templates, ISO images and Volume
Snapshots. The storage is available to all PODs in a Zone. Secondary Storage uses the
Network File System (NFS) as this ensures it can be accessed by any Host in the Zone.
Instances
An Instance is a virtual machine that can be created by the end-user of CloudStack.
Instances are based on Instance Templates and Service Offerings which specify the size
(vCPU & RAM).
INT362
Configuration: UI ACCESS
1.To get access to CloudStack’s web interface, point your browser to the IP address of your machine e.g.
http://192.168.11.159:8080/client
2.The default username is ‘admin’, and the default password is ‘password’. ——->>> Login
INT362
Setting up a Zone:
1.Go to Infrastructure ® Zone and click on “add
zone” button.
2.Select “Core”, click on ‘Next’
3.Select “Advanced zone” and provide the following
configuration (leaving all other defaults):
INT362
INT362
Name : Zone1
IPV4 : 8.8.8.8
Internal DNS 1 : 192.168.11.2
Hypervisor : KVM
INT362
Setting up a Network:
1.On the next screen (Physical
network details), use the
defaults – we will use the
VLAN isolation method on a
single physical NIC (on the
host) that will carry all traffic
types (management, public,
guest) and
2.click “Next”.
INT362
Public traffic configuration:
Gateway - 192.168.11.2
(your VM gateway)
Netmask - 255.255.255.0
VLAN/VNI - leave blank
Start IP - 192.168.11.134
End IP - 192.168.11.164
Click on the “Add” button,
click on “Next”
INT362
Pod Configuration:
Name – e.g. Pod1
Reserved system gateway -
192.168.11.2
Reserved system netmask -
255.255.255.0
Start reserved system IP -
192.168.11.165
Start reserved system IP -
192.168.11.195
Click on “Next”
INT362
Guest traffic:
VLAN/VNI range:
700-900
Click on “Next”
INT362
Create a cluster with the following:
Name – e.g. Cluster1
Click on “Next”
INT362
Add your default/first host:
Hostname - 192.168.11.132
( IP for virtual machine)
Username - root
Password - <password for root
user>
Click on “Next”
INT362
Add primary storage:
Name – e.g. Primary1
Scope - Zone / Cluster
Protocol - NFS
Server - 192.168.11.2
(or whatever IP you have
set up for this machine)
Path - /export/primary
Click on “Next”
INT362
Add secondary storage:
Provider - NFS
Name – e.g. Secondary1
Server - 192.168.11.2 (your IP)
(or whatever IP you have set
up for this machine)
Path - /export/secondary
Click on “Next”
INT362
INT362
INT362
Completed- Now
move towards next
file of adding instance
on Host INT362