Linux Debian 11 – VMware PowerCLI Installation and Configuration

Overview

Installing and Configuring VMware PowerCLI to build a custom image using ImageBuilder on a Debian 11 workstation.

With PowerCLI version 13.1 and greater there is no long a requirement to install Python 3.7.9. The new requirement is Python 3.7.1 or greater. Debian 11 latest is Python 3.9.2.

Below are the five required steps, with links.

The required configuration steps.

  1. Install Required Python Modules

  2. Install PowerShell for Debian 11

  3. Install VMware PowerCLI

  4. Set the Python path for VMware PowerCLI

Install Required Python Modules

Build ESXi images using VMware ImageBuilder you need to install six psutil lxml pyopenssl python 3.7 modules.

Install Python3 pip

sudo apt install python3-pip

Upgrade pip3, this is good practice before installing new Python modules.

python3 -m pip install pip --upgrade

If you get this warning.

WARNING: The scripts pip, pip3, pip3.9 are installed in '/home/username/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

Update the PATH to include ‘/home/username/.local/bin’.

source $HOME/.profile

Install required Python modules.

python3 -m pip install six psutil lxml pyopenssl --upgrade

List the newly installed required Python modules and their version.

python3 -m pip list | grep -Ei  "six|psutil|lxml|pyopenssl"
lxml                          4.9.2
psutil                        5.9.5
pyOpenSSL                     23.1.1
six                           1.16.0

Install PowerShell for Debian 11

Download, install and run PowerShell version 7.3.4 Debian package from Microsoft.

# Change to the $HOME/Downloads directory and download PowerShell.
cd $HOME/Downloads/ && wget https://github.com/PowerShell/PowerShell/releases/download/v7.3.4/powershell_7.3.4-1.deb_amd64.deb

# Install the package.
sudo dpkg --install powershell_7.3.4-1.deb_amd64.deb

# Start PowerShell
pwsh

Install VMware PowerCLI

Start PowerShell.

pwsh

Install VMware PowerCLI modules.

Install-Module VMware.PowerCLI -Scope CurrentUser

List the installed versions for PowerCLI and Imagebuilder

Get-Module -ListAvailable -name VMware.PowerCLI,VMware.ImageBuilder | select name,path,version | Format-List
Name    : VMware.ImageBuilder
Path    : /home/username/.local/share/powershell/Modules/VMware.ImageBuilder/8.0.0.21610262/VMware.ImageBuilder.psd1
Version : 8.0.0.21610262

Name    : VMware.PowerCLI
Path    : /home/username/.local/share/powershell/Modules/VMware.PowerCLI/13.1.0.21624340/VMware.PowerCLI.psd1
Version : 13.1.0.21624340

Set the Python path for VMware PowerCLI

Get Python3 executable path.

Exit out of PowerShell, if activated.

Use the BASH “which” command to find Pyhon3 path.

which python3
/usr/bin/python3

Start PowerShell.

pwsh

Set the Python executable path.

Set-PowerCLIConfiguration -PythonPath /usr/bin/python3

Get the PowerCLI Python3 path.

Get-PowerCLIConfiguration -scope Session | select PythonPath
PythonPath
----------
/usr/bin/python3

Workstation is now set up to build custom ESXi images.