码迷,mamicode.com
首页 > 其他好文 > 详细

Creating Hyperv Agent Installer

时间:2016-03-18 10:49:05      阅读:600      评论:0      收藏:0      [点我收藏+]

标签:

 
Skip to end of metadata
 
Go to start of metadata
 

Pre-built Hyper-V Agent Installer

If you want to use pre-built Hyper-V Agent Installer then you can download from jenkins.

For master you can download from http://jenkins.buildacloud.org/job/cloudstack-master-hyperv-agent and for other releases search for appropriate job at http://jenkins.buildacloud.org/ . 

Creating Hyper-V Agent Installer

To build on windows you have to follow instructions of step 1 athttps://cwiki.apache.org/confluence/display/CLOUDSTACK/Setting+up+a+CloudStack+dev+environment+on+Windows.

In addition to packages mentioned there you have to select wget package also.

Install mono on windows. You can download mono from http://www.go-mono.com/mono-downloads/download.html.

Before building  import all certificates using below command in Cygwin

mozroots --import --ask-remove

After setting up the environment you can build the agent using Cygwin. In Cygwin you have to execute  buildagent.sh script. This script is present in (cloudstack src folder)/plugins/hypervisors/hyperv

To build on Linux you can refer to Donal‘s blog http://dlafferty.blogspot.in/2013/08/building-your-microsoft-solution-with.html.

Installing and uninstalling Service from Command line

After building you will get the output/executable in (cloudstack src folder)//plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/bin/Debug

That output folder can be zipped and can be distributed.

In that output folder there is one executable generated AgentShell.exe.

From command line that can be used to install and uninstall service as follows

To install service

  • AgentShell.exe --install -u <username> -p <password>

              where username is of form domain\username or username for example Administrator or blr\Administrator

              This user should be part of local Administrators and Hyper-V Administrators group on the host

To uninstall service

  • AgentShell.exe --uninstall

 

Note: Apart from installing service you have to manually create and add ssl certificate. For that you can follow the steps herehttps://cwiki.apache.org/confluence/display/CLOUDSTACK/Manually+Creating+and+installing+self+signed+certificate+for+CloudStack+Management+Server+communication+with+Hyper-V+agent 

 

To build clickable installer

First you have to download the source code from github https://github.com/anshul1886/CloudStackAgentSetup.

Copy the InstallerSetup folder in (cloudstack src folder)//plugins/hypervisors/hyperv/DotNet/

After building the agent run one of the following command in (cloudstack src folder)//plugins/hypervisors/hyperv/DotNet/InstallerSetup/CloudStackAgentSetup

  • msbuild CloudStackAgentSetup.wixproj

                   or

  • MSBuild.exe CloudStackAgentSetup.wixproj

Installer will be generated in bin/debug folder of CloudAgentSetup proj (cloudstack src folder)//plugins/hypervisors/hyperv/DotNet/InstallerSetup/CloudStackAgentSetup/bin/Debug

 

CloudStackAgentSetup code uses the WixCommonUiExtension.dll with Eclipse Public Licensehttps://github.com/dblock/msiext/blob/master/LICENSE

Installing msi through command line

To install msi through command line quietly one can use the following command

msiexec /i CloudStackAgentSetup.msi /quiet /qn /norestart /log install.log SERVICE_USERNAME=<username> SERVICE_PASSWORD=<password>

If you don‘t want to install certificate with installer then execute as follows

msiexec /i CloudStackAgentSetup.msi /quiet /qn /norestart /log install.log SERVICE_USERNAME=<username> SERVICE_PASSWORD=<password> INSTALL_CERTIFICATE="False"

Deploy software via Group Policy’s Scheduled Tasks


Create .bat script which does the following

  • copies CloudStackAgentSetup.msi from a networked resource (shared folder) to Hyper-V host
  • installs the CloudStackAgentSetup.msi(use one of the method mentioned in above section, Installing msi through command line)
  • set the appropriate location for logs (replace install.log with your file)
  • deletes the CloudStackAgentSetup.msi from Hyper-V host after installation
  • save the .bat file as install-cloudstack-hyperv-agent.bat .

 

Create and deploy a scheduled task via group policy

  • Open Group Policy Management
  • Navigate to the Organization Unit you wish to receive CloudStack Hyper-V Agent deployment via a schedule task
  • Right-click on your target OU and select “Create a GPO in this domain, and Link it here”
  • Name: Deploy Application via Scheduled Tasks
  • Group Policy Management Editor > Computer Configuration > Preferences > Control Panel Settings > Scheduled Tasks
  • Right-click on Scheduled Tasks > New > Scheduled Tasks
  • Tab Tasks > Action > Create
  • Tab Task > Name > Install CloudStack Hyper-V Agent
  • Tab Task > Run > \\path to bat script\install-cloudstack-hyperv-agent.bat
  • Tab Task > Enabled > checked
  • Tab Schedule > Scheduled Task > Once, 2:00:00 AM
  • Tab Schedule > Scheduled Task Once > Run On > Pick a day that is best for you
  • (optional) Tab Settings > Power Management > Wake the computer to run this task > checked

Link this Group Policy to one or more OUs and under Security Filtering, add Authenticated Users and Domain Computers.

 

For more details refer to http://www.jasonpearce.com/2010/11/17/deploy-software-via-group-policys-scheduled-tasks/

To build clickable installer using Visual studio

Add the project to visual Studio and build it Visual Studio as normal build

(cloudstack src folder)//plugins/hypervisors/hyperv/DotNet/InstallerSetup/CloudStackAgentSetup

Troubleshooting

If any command is not working make sure that it is environment path

To get msbuild on path add the following path to Path environment variable

C:\Windows\Microsoft.NET\Framework\v4.0.30319

.

  • No labels

Creating Hyperv Agent Installer

标签:

原文地址:http://www.cnblogs.com/liangwang/p/5291044.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!