To simplify Plesk 11 provisioning on Cloud for infrastructure providers (including service providers offering dedicated servers, VPS, or IaaS), Odin introduces instructions on how to deploy Plesk on a Microsoft Hyper-V system.
Creating VM image
Due to a Microsoft Windows Server licensing restriction, we cannot provide the Plesk Hyper-V image. It can be prepared by these simple steps:
- Go to Hyper-V Manager > choose a Hyper-V server > New Virtual Machine Wizard .
- Create a virtual machine with the following parameters, for example: - Name: Plesk 11 Image - Memory: 2 GB - Connection: Local Area Connection - Virtual Network - Virtual Hard Disk: 127 GB
- Install Microsoft Server 2008 R2 there.
- Install Plesk 11 with any component you want using Autoinstaller .
- Shut down and export the image VM to a location, for example, to C:\ drive.
The Plesk VM image is ready. It can be copied and used on a Windows Server 2008 R2 machine. NOTE: It is better not to switch to Remote Desktop (RDP) access on the image due to security reasons. The cloning script will do it during VM preparation after changing the Administrator password.
Steps to Deploy
Use PowerShell scripts from the attached PPPCloningScript.zip as an example of batch VM cloning. The cloning script is written on Windows PowerShell. Please be sure that Windows PowerShell Integrate Scripting Environment (ISE) and .NET Framework 3.5.1 server features are installed on a Hyper-V server node. To check and install it, go to Server Manager > Features :
PowerShell Management Library for Hyper-V is also used to manage Hyper-V WMI API: http://pshyperv.codeplex.com/ The main idea of the provided cloning script is to use the DHCP server to resolve the IP address of the new VM. MAC address script option can be used to provide a fixed IP for each VM from the DHCP server.WARNING: Please check the cloning script before using it. Probablyanother cloning scenario will be needed.
Cloning script usage
Unzip PPPCloningScript.zip to
C:\\PPPCloningScript, for example.
Open CloneVM.ps1, for example, in Notepad.exe, and update the Administrator password that you set during VM image creation. This password is stored in the variable $VMDefaultPassword.
Run “CloneVM.ps1” with these parameters:
.\\CloneVM.ps1 <Importing image path> <Root path for cloned VMs> <New VM Hyper-V name> <New VM Host name> <New VM Administrator password> [New VM MAC (optinal)]
.\\CloneVM.ps1 "C:\\PPP 11.0 Image" "C:\\PPP 11.0 Clones" "PLESK VM 001" "HVPLESK001” "1qazxsW" "00155DECF690"
Cloning script description, step-by-step
- Create a new virtual machine by importing the VM image from the "Importing image path" location. The same operation can be done with "Hyper-V Manager" using the "Import Virtual Machine" wizard (though the script sets the “New VM Hyper-V name” also):
2. Recreate a network connection. NOTE: the NIC recreation step is added to the script because of the Hyper-V API error when resolving the IP address:
.Get-WmiObject : Generic failure
At C:\\PPPCloningScript\\HyperV\\vm.ps1:525 char:37
+ Get-WmiObject <<<< -Namespace "root/cimV2" -query ("Select * from Win32_PingStatus where Address='" + $query) |
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
You can check whether you need this step in your environment.
3. Change the virtual machine MAC address if it is provided in
New VM MAC parameter. 4. Start the new virtual machine. 5. Get the new virtual machine IP address. 6. Initialize the new virtual machine. Initialize the Plesk environment, enable Remote Desktop (RDP), change the Administrator password and Host name, and install Plesk Micro-Updates. This step executes the “prepare\_vm.cmd” command file on the new VM using the “PsExec” tool: http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx . You can change “prepare\_vm.cmd” how you like, but, please, do not remove the “cloning.exe” step. This step is needed to regenerate all Plesk passwords and GUIDs for the new cloned installation. 7. Restart the new virtual machine. This step is needed to complete “cloning.exe” and “change host name" operations.
Approximately 15 to 30 minutes are needed to clone the new virtual machine with Plesk, depending on Hyper-V node performance.