github.com/askholme/packer@v0.7.2-0.20140924152349-70d9566a6852/website/source/docs/builders/parallels-iso.html.markdown (about) 1 --- 2 layout: "docs" 3 page_title: "Parallels Builder (from an ISO)" 4 --- 5 6 # Parallels Builder (from an ISO) 7 8 Type: `parallels-iso` 9 10 The Parallels builder is able to create 11 [Parallels Desktop for Mac](http://www.parallels.com/products/desktop/) virtual 12 machines and export them in the PVM format, starting from an 13 ISO image. 14 15 The builder builds a virtual machine by creating a new virtual machine 16 from scratch, booting it, installing an OS, provisioning software within 17 the OS, then shutting it down. The result of the Parallels builder is a directory 18 containing all the files necessary to run the virtual machine portably. 19 20 ## Basic Example 21 22 Here is a basic example. This example is not functional. It will start the 23 OS installer but then fail because we don't provide the preseed file for 24 Ubuntu to self-install. Still, the example serves to show the basic configuration: 25 26 <pre class="prettyprint"> 27 { 28 "type": "parallels-iso", 29 "guest_os_type": "ubuntu", 30 "iso_url": "http://releases.ubuntu.com/12.04/ubuntu-12.04.3-server-amd64.iso", 31 "iso_checksum": "2cbe868812a871242cdcdd8f2fd6feb9", 32 "iso_checksum_type": "md5", 33 "parallels_tools_flavor": "lin" 34 "ssh_username": "packer", 35 "ssh_password": "packer", 36 "ssh_wait_timeout": "30s", 37 "shutdown_command": "echo 'packer' | sudo -S shutdown -P now" 38 } 39 </pre> 40 41 It is important to add a `shutdown_command`. By default Packer halts the 42 virtual machine and the file system may not be sync'd. Thus, changes made in a 43 provisioner might not be saved. 44 45 ## Configuration Reference 46 47 There are many configuration options available for the Parallels builder. 48 They are organized below into two categories: required and optional. Within 49 each category, the available options are alphabetized and described. 50 51 ### Required: 52 53 * `iso_checksum` (string) - The checksum for the OS ISO file. Because ISO 54 files are so large, this is required and Packer will verify it prior 55 to booting a virtual machine with the ISO attached. The type of the 56 checksum is specified with `iso_checksum_type`, documented below. 57 58 * `iso_checksum_type` (string) - The type of the checksum specified in 59 `iso_checksum`. Valid values are "none", "md5", "sha1", "sha256", or 60 "sha512" currently. While "none" will skip checksumming, this is not 61 recommended since ISO files are generally large and corruption does happen 62 from time to time. 63 64 * `iso_url` (string) - A URL to the ISO containing the installation image. 65 This URL can be either an HTTP URL or a file URL (or path to a file). 66 If this is an HTTP URL, Packer will download it and cache it between 67 runs. 68 69 * `ssh_username` (string) - The username to use to SSH into the machine 70 once the OS is installed. 71 72 * `parallels_tools_flavor` (string) - The flavor of the Parallels Tools ISO to 73 install into the VM. Valid values are "win", "lin", "mac", "os2" and "other". 74 This can be ommited only if `parallels_tools_mode` is "disable". 75 76 ### Optional: 77 78 * `boot_command` (array of strings) - This is an array of commands to type 79 when the virtual machine is first booted. The goal of these commands should 80 be to type just enough to initialize the operating system installer. Special 81 keys can be typed as well, and are covered in the section below on the boot 82 command. If this is not specified, it is assumed the installer will start 83 itself. 84 85 * `boot_wait` (string) - The time to wait after booting the initial virtual 86 machine before typing the `boot_command`. The value of this should be 87 a duration. Examples are "5s" and "1m30s" which will cause Packer to wait 88 five seconds and one minute 30 seconds, respectively. If this isn't specified, 89 the default is 10 seconds. 90 91 * `disk_size` (integer) - The size, in megabytes, of the hard disk to create 92 for the VM. By default, this is 40000 (about 40 GB). 93 94 * `floppy_files` (array of strings) - A list of files to place onto a floppy 95 disk that is attached when the VM is booted. This is most useful 96 for unattended Windows installs, which look for an `Autounattend.xml` file 97 on removable media. By default, no floppy will be attached. All files 98 listed in this setting get placed into the root directory of the floppy 99 and the floppy is attached as the first floppy device. Currently, no 100 support exists for creating sub-directories on the floppy. Wildcard 101 characters (*, ?, and []) are allowed. Directory names are also allowed, 102 which will add all the files found in the directory to the floppy. 103 104 * `guest_os_type` (string) - The guest OS type being installed. By default 105 this is "other", but you can get _dramatic_ performance improvements by 106 setting this to the proper value. To view all available values for this 107 run `prlctl create x --distribution list`. Setting the correct value hints to 108 Parallels Desktop how to optimize the virtual hardware to work best with 109 that operating system. 110 111 * `hard_drive_interface` (string) - The type of controller that the 112 hard drives are attached to, defaults to "sata". Valid options are 113 "sata", "ide", and "scsi". 114 115 * `host_interfaces` (array of strings) - A list of which interfaces on the 116 host should be searched for a IP address. The first IP address found on 117 one of these will be used as `{{ .HTTPIP }}` in the `boot_command`. 118 Defaults to ["en0", "en1", "en2", "en3", "en4", "en5", "en6", "en7", "en8", 119 "en9", "ppp0", "ppp1", "ppp2"]. 120 121 * `http_directory` (string) - Path to a directory to serve using an HTTP 122 server. The files in this directory will be available over HTTP that will 123 be requestable from the virtual machine. This is useful for hosting 124 kickstart files and so on. By default this is "", which means no HTTP 125 server will be started. The address and port of the HTTP server will be 126 available as variables in `boot_command`. This is covered in more detail 127 below. 128 129 * `http_port_min` and `http_port_max` (integer) - These are the minimum and 130 maximum port to use for the HTTP server started to serve the `http_directory`. 131 Because Packer often runs in parallel, Packer will choose a randomly available 132 port in this range to run the HTTP server. If you want to force the HTTP 133 server to be on one port, make this minimum and maximum port the same. 134 By default the values are 8000 and 9000, respectively. 135 136 * `iso_urls` (array of strings) - Multiple URLs for the ISO to download. 137 Packer will try these in order. If anything goes wrong attempting to download 138 or while downloading a single URL, it will move on to the next. All URLs 139 must point to the same file (same checksum). By default this is empty 140 and `iso_url` is used. Only one of `iso_url` or `iso_urls` can be specified. 141 142 * `output_directory` (string) - This is the path to the directory where the 143 resulting virtual machine will be created. This may be relative or absolute. 144 If relative, the path is relative to the working directory when `packer` 145 is executed. This directory must not exist or be empty prior to running the builder. 146 By default this is "output-BUILDNAME" where "BUILDNAME" is the name 147 of the build. 148 149 * `parallels_tools_guest_path` (string) - The path in the VM to upload Parallels 150 Tools. This only takes effect if `parallels_tools_mode` is not "disable". 151 This is a [configuration template](/docs/templates/configuration-templates.html) 152 that has a single valid variable: `Flavor`, which will be the value of 153 `parallels_tools_flavor`. By default the upload path is set to 154 `prl-tools-{{.Flavor}}.iso`. 155 156 * `parallels_tools_mode` (string) - The method by which Parallels Tools are 157 made available to the guest for installation. Valid options are "upload", 158 "attach", or "disable". The functions of each of these should be 159 self-explanatory. The default value is "upload". 160 161 * `prlctl` (array of array of strings) - Custom `prlctl` commands to execute in 162 order to further customize the virtual machine being created. The value of 163 this is an array of commands to execute. The commands are executed in the order 164 defined in the template. For each command, the command is defined itself as an 165 array of strings, where each string represents a single argument on the 166 command-line to `prlctl` (but excluding `prlctl` itself). Each arg is treated 167 as a [configuration template](/docs/templates/configuration-templates.html), 168 where the `Name` variable is replaced with the VM name. More details on how 169 to use `prlctl` are below. 170 171 * `prlctl_version_file` (string) - The path within the virtual machine to upload 172 a file that contains the `prlctl` version that was used to create the machine. 173 This information can be useful for provisioning. By default this is 174 ".prlctl_version", which will generally upload it into the home directory. 175 176 * `shutdown_command` (string) - The command to use to gracefully shut down 177 the machine once all the provisioning is done. By default this is an empty 178 string, which tells Packer to just forcefully shut down the machine. 179 180 * `shutdown_timeout` (string) - The amount of time to wait after executing 181 the `shutdown_command` for the virtual machine to actually shut down. 182 If it doesn't shut down in this time, it is an error. By default, the timeout 183 is "5m", or five minutes. 184 185 * `ssh_key_path` (string) - Path to a private key to use for authenticating 186 with SSH. By default this is not set (key-based auth won't be used). 187 The associated public key is expected to already be configured on the 188 VM being prepared by some other process (kickstart, etc.). 189 190 * `ssh_password` (string) - The password for `ssh_username` to use to 191 authenticate with SSH. By default this is the empty string. 192 193 * `ssh_port` (integer) - The port that SSH will be listening on in the guest 194 virtual machine. By default this is 22. 195 196 * `ssh_wait_timeout` (string) - The duration to wait for SSH to become 197 available. By default this is "20m", or 20 minutes. Note that this should 198 be quite long since the timer begins as soon as the virtual machine is booted. 199 200 * `vm_name` (string) - This is the name of the PVM directory for the new 201 virtual machine, without the file extension. By default this is 202 "packer-BUILDNAME", where "BUILDNAME" is the name of the build. 203 204 ## Boot Command 205 206 The `boot_command` configuration is very important: it specifies the keys 207 to type when the virtual machine is first booted in order to start the 208 OS installer. This command is typed after `boot_wait`, which gives the 209 virtual machine some time to actually load the ISO. 210 211 As documented above, the `boot_command` is an array of strings. The 212 strings are all typed in sequence. It is an array only to improve readability 213 within the template. 214 215 The boot command is "typed" character for character using the `prltype` (part 216 of prl-utils, see [Parallels Builder](/docs/builders/parallels.html)) 217 command connected to the machine, simulating a human actually typing the 218 keyboard. There are a set of special keys available. If these are in your 219 boot command, they will be replaced by the proper key: 220 221 * `<enter>` and `<return>` - Simulates an actual "enter" or "return" keypress. 222 223 * `<esc>` - Simulates pressing the escape key. 224 225 * `<tab>` - Simulates pressing the tab key. 226 227 * `<wait>` `<wait5>` `<wait10>` - Adds a 1, 5 or 10 second pause before sending 228 any additional keys. This is useful if you have to generally wait for the UI 229 to update before typing more. 230 231 In addition to the special keys, each command to type is treated as a 232 [configuration template](/docs/templates/configuration-templates.html). 233 The available variables are: 234 235 * `HTTPIP` and `HTTPPort` - The IP and port, respectively of an HTTP server 236 that is started serving the directory specified by the `http_directory` 237 configuration parameter. If `http_directory` isn't specified, these will 238 be blank! 239 240 Example boot command. This is actually a working boot command used to start 241 an Ubuntu 12.04 installer: 242 243 <pre class="prettyprint"> 244 [ 245 "<esc><esc><enter><wait>", 246 "/install/vmlinuz noapic ", 247 "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ", 248 "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ", 249 "hostname={{ .Name }} ", 250 "fb=false debconf/frontend=noninteractive ", 251 "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ", 252 "keyboard-configuration/variant=USA console-setup/ask_detect=false ", 253 "initrd=/install/initrd.gz -- <enter>" 254 ] 255 </pre> 256 257 ## prlctl Commands 258 In order to perform extra customization of the virtual machine, a template can 259 define extra calls to `prlctl` to perform. 260 [prlctl](http://download.parallels.com/desktop/v9/ga/docs/en_US/Parallels%20Command%20Line%20Reference%20Guide.pdf) 261 is the command-line interface to Parallels Desktop. It can be used to configure 262 the virtual machine, such as set RAM, CPUs, etc. 263 264 Extra `prlctl` commands are defined in the template in the `prlctl` section. 265 An example is shown below that sets the memory and number of CPUs within the 266 virtual machine: 267 268 <pre class="prettyprint"> 269 { 270 "prlctl": [ 271 ["set", "{{.Name}}", "--memsize", "1024"], 272 ["set", "{{.Name}}", "--cpus", "2"] 273 ] 274 } 275 </pre> 276 277 The value of `prlctl` is an array of commands to execute. These commands are 278 executed in the order defined. So in the above example, the memory will be set 279 followed by the CPUs. 280 281 Each command itself is an array of strings, where each string is an argument to 282 `prlctl`. Each argument is treated as a 283 [configuration template](/docs/templates/configuration-templates.html). The only 284 available variable is `Name` which is replaced with the unique name of the VM, 285 which is required for many `prlctl` calls.