3 Power on the virtual machine and install the Linux distribution.
4 Create a user with root privileges, for example, ViewUser. This user is used to install and uninstall View
Agent only.
5 Edit /etc/sudoers and add the line ViewUser ALL=(ALL) NOPASSWD:ALL.
With this line in /etc/sudoers, no password is required to run sudo as ViewUser. When you run the
sample script to install View Agent that is provided in this chapter, you specify ViewUser as an input.
6 If the Linux distribution is RHEL, CentOS, or NeoKylin, edit /etc/sudoers and comment out the lines
Defaults requiretty and Defaults !visiblepw.
7 Install VMware Tools.
8 Install a supported version of JRE.
9 Shut down the virtual machine and create a snapshot.
Input File for the Sample PowerCLI Scripts to Deploy Linux Desktops
The sample PowerCLI scripts to deploy Linux desktops read one input le that contains information about
the desktop machines.
The input le is of type csv and contains the following information:
n
Desktop virtual machine name
n
Parent virtual machine name
n
Guest customization specication
n
Datastore where the cloned desktop machine resides
n
ESXi server that hosts the desktop machine
n
Parent virtual machine's snapshot that is used for cloning
n
Flag that indicates whether to delete the desktop virtual machine if it exists
The following example shows what the input le may contain.
VMName,Parentvm,CustomSpec,Datastore,Host,FromSnapshot,DeleteIfPresent
linux-001,Ubuntu1204x64,linuxagent,datastore1,10.117.44.172,snapshot1,TRUE
linux-002,Ubuntu1204x64,linuxagent,datastore1,10.117.44.172,snapshot1,TRUE
linux-003,Ubuntu1204x64,linuxagent,datastore1,10.117.44.172,snapshot1,TRUE
linux-004,Ubuntu1204x64,linuxagent,datastore1,10.117.44.172,snapshot1,TRUE
linux-005,Ubuntu1204x64,linuxagent,datastore1,10.117.44.172,snapshot1,TRUE
The sample scripts assume that the name of this input le is CloneVMs.csv and that the le is located in the
same folder as the scripts.
Sample PowerCLI Script to Clone Linux Desktop Machines
You can customize and use the following sample script to clone any number of virtual machines.
To copy and paste the script content without page breaks, use the HTML version of this topic, available from
the Horizon 6 documentation page at hps://www.vmware.com/support/pubs/view_pubs.html.
Script Input
This script reads one input le, which is described in “Input File for the Sample PowerCLI Scripts to Deploy
Linux Desktops,” on page 25. This script also interactively asks for the following information:
n
IP address of the vCenter Server
Chapter 3 Bulk Deployment of Horizon 6 for Linux Desktops
VMware, Inc. 25