How to get llama 2 up and running , in a VM, with no GPU, and limited memory on Ubuntu

Image
OK I decided to write this up after unsuccessfully being able to find all the required info I needed in one place. In this setup we will be using Ubuntu Server 22.04.2 LTS as the OS. I have this running on a home lab ESXi server 8, on a HP Compaq Pro 6300 SFF CPU = Intel Core i7-3770 Installed Memory 16 GB I have some 10K SAS drives installed for the VM's If you have not already, navigate to  Get Ubuntu Server | Download | Ubuntu and download the 22.04.2 LTS ISO Next Lets create our VM that we are going to run this in. *Note Im using ESXi however you can probably do this in Workstation, Fusion, VirtualBox etc The main things to note on the VM creation. Set Ubuntu 64 bit as the guest OS Set your CPU relevant to the physicals CPU, I will be starting with 4 VCPU Set your Memory to as much as you can tolerate, I will be using 12 Disk Space - we are creating a 100G swap file, and the rest of the file can take up some room , so more is better if you can afford it Dont forget to add the U

PowerCLI Script creating Instant Clone Pools in Horizon 8 Walk through

 One task I run into quite often is deploying Instant Clone pools to test one thing or another.

I dont always leave my lab running, so all the pools get deleted , and then recreated when needed.

If you have ever created an instant you know you have to click about 20 settings, while not a monumental task, it is a bit reparative.


So we are going to go through the process of creating our own script , so we only need to click once to deploy our instant clone pool.


You are going to need a couple of things:

Internet access

PowerCLI installed

PowerCLI Example Scripts

(Optional) A dedicated workstation to store your password on.



Ok lets start with installing PowerCLI.

Open power shell as an administrator



And run the following command to install PowerCLI

Install-Module VMware.PowerCLI



Type A and hit Enter


Wait for the progress bar to complete  the install of the modules


Once Complete run the following to verify it was installed and get the Version number if you need it at some point

Get-Module -Name VMware.PowerCLI -ListAvailable



PowerCLI is now installed, that's it!

Next We need the example scripts zip file. The zip file includes a specific module for horizon that is not built into the module we just installed. 

Open your browser to https://github.com/vmware/PowerCLI-Example-Scripts , click code, and download as Zip



Once this is downloaded, open the Zip, and we are going to extract the VMware.Hv.Helper folder from 
the Modules directory.
You can extract this any where you like, however for our example we will Extract it to C:\Scripts for ease of use




At this point we are ready to write our script!


If you have your own powershell IDE then you can just use that, for this post we are going to use ISE.

Click start and search for powershell ISE:



You should now have a blank space to start




Right off the bat we are going to import our modules, PowerCLI , vmware.vimautomation.horizonview (part of PowerCLI), and the VMware.HV.Helper that we downloaded Earlier.

We will also tell PowerCLI to ignore Invalid certificates in case we are using Self Signed certs, we dont want it to sto for that


Import-Module VMware.PowerCLI

Import-Module vmware.vimautomation.horizonview

Import-Module -Name "C:\scripts\VMware.Hv.Helper"

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false



Next we are going to setup our variables, this will make it easier if the say the Parent VM, or Snapshot change in the future.


#The Name of the Instant Clone Pool

$HZPool = "W11-IC"

#The display name of the Instant Clone Pool

$HZDisplay = "W11-IC"

#The description of the pool displayed in the horizon Admin

$HZDescription =  "Windows 11 Insider Preview Instant Clone Pool"

#How are the users assigned to the desktops for this pool

$HZAssign = "FLOATING"

#What is the name of the parent VM 

$HZParent = "W11-Insider-Instant-Clone-Parent"

#The Snapshot we need to use

$HZSnap = "UEM-2103 Installed"

#The folder you want to place the VMs in, I Always put my in the root and let it create the sub folder , so I use HomeDatacenter as its the default

$HZFolder = "HomeDatacenter"

#The name of your vSphere cluster you are deploying to

$HZCluster = "AMD"

#If you have resource pools specify this here, else use the name of your cluster

$HZResourcePool = "VDI"

#How are you naming your VMs?

$HZNamingMethod = "PATTERN"

#The naming pattern of your Instant Clones

$HZPattern = "W11-IC-{n}"

#The Datstore you will deploy the VMs to

$HZDatastore = "SYNFS2"

#Your instant clone admin domain you use to join the domain

$HZDomain = "HOME"

#you instant clone admin username

$HZICAdmin = "hzncomposer"



(Optional) Next we are going to use a feature in power CLI that allows us to store our password so we don't have to have it in plain text in our script.

From the command prompt run the following replacing the -Host with your host, -User with your Horizon Admin user and -Password with your password


New-VICredentialStoreItem -Host hacs1.home.lab -User ViewAutoBot -Password "SuperSecretP@$$w0rd"


I put the password in " as powershell uses $ so its the only way to pass these


This will complete any your password is now saved.

You can validate this by running the following and your password should be returned in plain text:

get-VICredentialStoreItem -Host hacs1.home.lab -User ViewAutoBot | Select-Object Password | foreach {$_.password}


So now our next line is to set a variable for our password:

$HZPass = get-VICredentialStoreItem -Host hacs1.home.lab -User ViewAutoBot | Select-Object Password | foreach {$_.password}



And our line to connect to the connection server utilizing the password 
*Note if you did not setup the VICredentialStore, the replace the $HZPass variable with your password in plane text

Connect-HVServer -Server hacs1.home.lab -User ViewAutoBot@home.lab -Password $HZPass



Now lets take all of this data we just setup and get the command setup to use it (I formatted it this way for readability).

New-HVPool -InstantClone -PoolName $HZPool `
-PoolDisplayName $HZDisplay `
-Description $HZDescription `
-UserAssignment $HZAssign `
-ParentVM $HZParent `
-SnapshotVM $HZSnap `
-VmFolder $HZFolder `
-HostOrCluster $HZCluster `
-ResourcePool $HZResourcePool `
-NamingMethod $HZNamingMethod `
-NamingPatter $HZPattern `
-Datastores $HZDatastore `
-NetBiosName $HZDomain `
-DomainAdmin $HZICAdmin



2 more lines, the last thing that is done when deploying a pool is assigning users, because this script runs really fast, I have put a 60 sec sleep statement and then Assign the "Domain Users" to the pool.


Start-Sleep -s 60
New-HVEntitlement -Type Group -User "HOME\Domain Users" -ResourceName $HZPool -Confirm:$false 





Thats All, now lest run it !












Now you can make a short cut on your desktop with the following to run it at the click of a button:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -ExecutionPolicy Bypass -File "C:\Scripts\W10IC.ps1"




Here is the full script:



Import-Module VMware.PowerCLI
Import-Module vmware.vimautomation.horizonview
Import-Module -Name "C:\scripts\VMware.Hv.Helper"
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false


#The Name of the Instant Clone Pool
$HZPool = "W11-IC"
#The display name of the Instant Clone Pool
$HZDisplay = "W11-IC"
#The description of the pool displayed in the horizon Admin
$HZDescription =  "Windows 11 Insider Preview Instant Clone Pool"
#How are the users assigned to the desktops for this pool
$HZAssign = "FLOATING"
#What is the name of the parent VM 
$HZParent = "W11-Insider-Instant-Clone-Parent"
#The Snapshot we need to use
$HZSnap = "UEM-2103 Installed"
#The folder you want to place the VMs in, I Always put my in the root and let it create the sub folder , so I use HomeDatacenter as its the default
$HZFolder = "HomeDatacenter"
#The name of your vSphere cluster you are deploying to
$HZCluster = "AMD"
#If you have resource pools specify this here, else use the name of your cluster
$HZResourcePool = "VDI"
#How are you naming your VMs?
$HZNamingMethod = "PATTERN"
#The naming pattern of your Instant Clones
$HZPattern = "W11-IC-{n}"
#The Datstore you will deploy the VMs to
$HZDatastore = "SYNFS2"
#Your instant clone admin domain you use to join the domain
$HZDomain = "HOME"
#you instant clone admin username
$HZICAdmin = "hzncomposer"


$HZPass = get-VICredentialStoreItem -Host hacs1.home.lab -User ViewAutoBot | Select-Object Password | foreach {$_.password}
Connect-HVServer -Server hacs1.home.lab -User ViewAutoBot@home.lab -Password $HZPass





New-HVPool -InstantClone -PoolName $HZPool `
-PoolDisplayName $HZDisplay `
-Description $HZDescription `
-UserAssignment $HZAssign `
-ParentVM $HZParent `
-SnapshotVM $HZSnap `
-VmFolder $HZFolder `
-HostOrCluster $HZCluster `
-ResourcePool $HZResourcePool `
-NamingMethod $HZNamingMethod `
-NamingPatter $HZPattern `
-Datastores $HZDatastore `
-NetBiosName $HZDomain `
-DomainAdmin $HZICAdmin




Start-Sleep -s 60
New-HVEntitlement -Type Group -User "HOME\Domain Users" -ResourceName $HZPool -Confirm:$false 

Comments

Popular posts from this blog

vSphere 7 - Specify a vmkernel adapter to use for NFS datastores Step By Step \ Walkthrough on a DVS

Horizon View 2-factor Authentication for Free! with Google Authenticator or others

How to get llama 2 up and running , in a VM, with no GPU, and limited memory on Ubuntu