一半君的总结纸

听话只听一半君

unattended / silent deployment for renderfarm

中古时代,小工作室里都是每台机手动装软件的,因为没有active directory,但是就算有了,想组策略”推送”安装某个软件,还是需要一行命令使其直接安到完的吧(lz猜的,lz不是网管,不知道这种操作的”网管”做法是怎样)

逼格术语关键词:

  • unattended installation – 无人值守安装
  • deployment – 部署
  • silent install – 静默安装

下面总结下常见的几种软件的高逼格”自动”安装,适用于小工作室脑残法装软件 或者 重装系统强迫症患者(可以自己做自动重装windows盘,并集成各种cg软件的自动安装,最终效果类似于品牌电脑送你的恢复盘,不是ghost,是自动装好windows,并自动安装好集成的各种软件)

  1. Muster 8.1.3
    # 假设渲染机要装除了dispatcher以外的所有东西,用户名密码都是muster(默认是给装成service的,这就是service的账号密码)
    # 假设你想换个默认的安装路径,换到c:\tools\Muster8下
    
    # /i 后面跟.msi文件
    # /qn 表示没有ui(安装过程中没有任何提示)
    # /qb 表示basic ui (还是有窗口的) 你可以在测试的时候用b,这样可以知道哪里有错
    
    msiexec /i Muster8.1.3.x64.win.msi ADDLOCAL=ClientTools,Mrtool,Console,Client,Extras CONF_CLIENT_SERVER=dispatcherhost的名字 IS_NET_API_LOGON_USERNAME=%COMPUTERNAME%\muster IS_NET_API_LOGON_PASSWORD=muster INSTALLDIR=C:\tools\Muster8 /qn
    

    注意:如果你直接运行上面的命令,但是你又没有在系统里先添加muster用户,那你可能会看到
    muster_no_user_account
    这是因为你系统里没muster账号,但是你又告诉installer说,”用muster账号来运行service”

    IS_NET_API_LOGON_USERNAME=%COMPUTERNAME%\muster IS_NET_API_LOGON_PASSWORD=muster
    

    lz是怎么知道的呢,因为如果你选了安成service,在这一步的时候,如果你没有muster用户,直接点下一步会出现
    muster_create_service_but user not exists
    下面的New user information按钮就是给你用来在”安装过程中”添加muster用户的
    这时有两种方法:

    1. 在运行上面的命令之前,事先添加muster账号
      net user /add muster muster
      net localgroup administrators muster /add
      
    2. 强迫症发作,非要用msiexec来完成(因为安装过程中有个对话框是用来给你新建账户的,这意思也就是说,显然可以通过在msiexec命令后面加 property=xxx的设置来达到目的)

      如何知道要设的property叫什么名字呢,只要在msiexec命令后面有/l* loginstall.txt,就会把整个安装过程log存出去,所以你先别加/qb 让界面显示着手动装完一遍,再去log里搜,就知道要设什么了
      所以像下面这样

      msiexec /i Muster8.1.3.x64.win.msi ADDLOCAL=ClientTools,Mrtool,Console,Client,Extras CONF_CLIENT_SERVER=localhost IS_NET_API_LOGON_USERNAME=%COMPUTERNAME%\muster IS_NET_API_LOGON_PASSWORD=muster /qb IS_NET_API_NEW_USER_CONFIRM=muster IS_NET_API_NEW_USER_GROUP=Administrators IS_NET_API_NEW_USER_PASSWORD=muster IS_NET_API_NEW_USER_SERVER=%COMPUTERNAME% IS_NET_API_NEW_USER_NAME=muster IS_NET_API_GROUP_LIST=Administrators IS_NET_API_SERVER_NEW_USER_LIST=%COMPUTERNAME% IS_NET_API_LOGON_DOMAIN_TOKEN=%COMPUTERNAME% IS_NET_API_LOGON_USERNAME_TOKEN=muster  IS_NET_API_NET_VALID_USER=1 IS_NET_API_NO_COMBO_ITEMS_FOUND=1  IS_NET_API_LOGON_GROUP=Administrators
      

      因为lz不知道哪个是关键性的,所以就把所有的IS_NET_API开头的带NEW_USER的,还有怀疑有关的property全加进去了,经测试这样可行,但是好长,还不如方法1自己先加了来的简单

      如何删除Muster

      msiexec /x Muster8.1.3.x64.win.msi /qb
      

    其实不知从几时开始帮助里是写了的 Windows unattended installation

  2. Deadline 6.2.0.32
    deadline的安装文件不是.msi 是.exe ,但是他也有自己的”自动安装法”,
    显示可以用的参数

    DeadlineClient-6.2.0.32-windows-installer.exe --help
    
    Deadline Repository 6.2.0.32
    Usage:
    
     --help                         Display the list of valid options
    
     --version                      Display product information
    
     --unattendedmodeui <unattendedmodeui> Unattended Mode UI
                                    Default: none
                                    Allowed: none minimal minimalWithDialogs
    
     --optionfile <optionfile>      Installation option file
                                    Default: 
    
     --debuglevel <debuglevel>      Debug information level of verbosity
                                    Default: 2
                                    Allowed: 0 1 2 3 4
    
     --mode <mode>                  Installation mode
                                    Default: win32
                                    Allowed: win32 unattended
    
     --debugtrace <debugtrace>      Debug filename
                                    Default: 
    
     --installer-language <installer-language> Language selection
                                    Default: en
                                    Allowed: en
    
     --monoexec <monoexec>          If Mono is installed, but isn't in the PATH for the user running the installer (ie: root), use this to set the full path to the Mono executable (Linux only)
                                    Default: mono
    
     --prefix <prefix>              The path to install the Repository to
                                    Default: C:\Program Files (x86)\Thinkbox\DeadlineRepository6
    
     --mongodir <mongodir>          If MongoDB is being installed by this installer, this is the path it is installed to
                                    Default: C:\Program Files (x86)\Thinkbox\DeadlineDatabase6
    
     --dbhost <dbhost>              The host name or IP address of the machine that MongoDB is running on
                                    Default: 
    
     --dbname <dbname>              The name of the MongoDB database that the data is stored in
                                    Default: deadline6db
    
     --dbport <dbport>              The port that MongoDB is listening on
                                    Default: 27017
    
     --dbuser <dbuser>              The user name to connect to MongoDB with
                                    Default: 
    
     --dbpassword <dbpassword>      The password to connect to MongoDB with
                                    Default: 
    
     --dbauth <dbauth>              If enabled, Deadline will use this account to connect to MongoDB
                                    Default: false
    
    
    
    
    Deadline Client 6.2.0.32
    Usage:
    
     --help                         Display the list of valid options
    
     --version                      Display product information
    
     --unattendedmodeui <unattendedmodeui> Unattended Mode UI
                                    Default: none
                                    Allowed: none minimal minimalWithDialogs
    
     --optionfile <optionfile>      Installation option file
                                    Default: 
    
     --debuglevel <debuglevel>      Debug information level of verbosity
                                    Default: 2
                                    Allowed: 0 1 2 3 4
    
     --mode <mode>                  Installation mode
                                    Default: win32
                                    Allowed: win32 unattended
    
     --debugtrace <debugtrace>      Debug filename
                                    Default: 
    
     --installer-language <installer-language> Language selection
                                    Default: en
                                    Allowed: en
    
     --monoexec <monoexec>          If Mono is installed, but isn't in the PATH for the user running the installer (ie: root), use this to set the full path to the Mono executable (Linux only)
                                    Default: mono
    
     --prefix <prefix>              The path to install the Client software to
                                    Default: C:\Program Files (x86)\Thinkbox\Deadline6
    
     --repositorydir <repositorydir> The path to the Deadline Repository
                                    Default: 
    
     --licenseserver <licenseserver> The license server to use
                                    Default: 
    
     --configport <configport>      The port that the Client uses for Auto Configuration
                                    Default: 17001
    
     --launcherport <launcherport>  The Launcher uses this port for Remote Administration, and it should be the same on all Client machines
                                    Default: 17000
    
     --launcherstartup <launcherstartup> If enabled, the Launcher will automatically launch when the system logs in (non-service mode on Windows only)
                                    Default: true
    
     --restartstalled <restartstalled> If enabled, the Launcher will try to restart the Slave application on this machine if it stalls
                                    Default: true
    
     --slavestartup <slavestartup>  If enabled, the Slave will automatically start when the Launcher starts
                                    Default: true
    
     --serviceuser <serviceuser>    The user name for the Launcher service (Windows only)
                                    Default: 
    
     --servicepassword <servicepassword> The password for the Launcher service (Windows only)
                                    Default: 
    
     --launcherservice <launcherservice> If enabled, the Launcher will be installed as a service, and requires an account with network access (Windows only)
                                    Default: false
    
     --daemonuser <daemonuser>      The user to run the Launcher daemon as, or leave blank to run as root (Linux only)
                                    Default: 
    
     --launcherdaemon <launcherdaemon> If enabled, the Launcher will be installed as a daemon (Linux only)
                                    Default: false
    
     --autoupdateoverride <autoupdateoverride> Overrides the Auto Update setting for this client installation (leave blank to use the value specified in the Repository Options)
                                    Default:  
    
    
    

    此时发现到可以用的参数比较少,不是所有手动安装过程中可以选的选项都有,虽然有个optionfile的选项,但是没有”录制”optionfile的参数,注意到

    DeadlineRepository-6.2.0.32-windows-installer.exe --version
    

    发现IB的字样
    deadline_about
    所以猜测deadline用的installer可能是InstallBuilder 所以可以试试installBuilder公用的某些参数(也许Thinkbox公司不愿意告诉用户有哪些参数可以用)

    随即找到installBuilder官方DOC,其中有7.1.8. Option Files 部分,
    似乎还是没什么可以改的,看来就如果用官方installer就只能这样了,除非用方法4

    DeadlineRepository-6.2.0.32-windows-installer.exe --prefix c:\repo --mode unattended --unattendedmodeui minimalWithDialogs
    

    如果用上面的命令装,可能最后会看到如下提示(这主要是因为不知道如何通过命令行参数让installer安mongo db,当然你可以自己另外先装,不过依然这里不知道如何制定地址账号等)不过考虑到一般repository只需要装在一台机器上,研究这个如何自动装只是强迫症

    client倒是可以自动装

    DeadlineClient-6.2.0.32-windows-installer.exe  --prefix c:\tools\dl6cient --mode unattended --unattendedmodeui minimalWithDialogs --repositorydir C:\repo
    

    其实帮助里也是有的Command Line or Silent Installation

  3. Maya
    虽然安装界面上有create deployment(点了下一步不会设administrative image path 然后就没继续试),但由于maya也是有.msi文件的,所以同样可以用msiexec法安装

    floating license 安装(在用正版的情况下,这样肯定可以)

    msiexec.exe /i Maya2014.msi
    ADLMSERIALNUMBER=666-69696969
    ADLM_PRODKEY=657F1
    ADLMPRODUCTKEY=657F1
    ADLMLICENSETYPE=3
    ADLMSERVERNAME=YOUR_SERVER_NAME
    

    node locked license 安装
    用和谐版时,虽然我把上面的ADLMLICENSETYPE=2或者1了,但是装完了以后开的时候不出现平时用setup.exe手动装的时候出现的license页面,而是直接提示没有license.(这是因为这样装出来的似乎是trial,设置的序列号没有生效,打开license transfer utility便知)
    你可以

    1. xforce算号破解,自己去开那个注册向导(不过显然很多机器时这样好麻烦)
    2. 或者用libadlmutil通用替换大法破解,参考 Fedora 19 64 bit下安装 Maya 2014 SP2 页面底部的Fedora自动安装和谐化maya的shell script

    经测试,这条命令可行(从setup.exe装,然后在%temp%\Maya2014_x64_Install.log里靠猜的)
    这样装完以后开maya时会出现激活页面,可以按上面的方法1手动算号激活或者方法2/3

    msiexec.exe -i Maya2014.msi ACADSERIALNUMBER=69696969 ACADSERIALPREFIX=666 ADLM_PRODKEY=657F1 ADLM_DEF_PRODKEY=657F1 ACADSTANDALONENETWORKTYPE=1 ADSK_LAUNCH_MODE=STANDALONE INSTALLDIR=C:\tools\Maya2014 /qb
    

    待续…

  4. 其他一些通用方法
    有些工具是可以把任何安装程序文件”打包”成可以自动安装的,lz觉得这些工具逼格不够高,没有测试

背景常识:

什么是.msi文件:

中古时代软件安装包一般都是一个.exe文件,运行安装软件后,如果想uninstall,就去控制面板里找或者开始菜单里找,但是如果作者比较脑残,没写反安装或者他写的烂,删除之后还留下些垃圾文件.

.msi 又称 (M)iscro(s)oft (i)nstaller 可以解决这些问题,他还带来个好处是所有用.msi来安装的软件都可以”静默”安装了,当你双击一个.msi文件时,其实windows在后台用一个叫msiexec.exe的工具来打开了这个文件,这个工具有很多参数,可以用来指定安到哪,后台自动安,安装过程中的某些选项设置等等.

Windows ® Installer. V 5.0.7601.17514 

msiexec /Option <Required Parameter> [Optional Parameter]

Install Options
	</package | /i> <Product.msi>
		Installs or configures a product
	/a <Product.msi>
		Administrative install - Installs a product on the network
	/j<u|m> <Product.msi> [/t <Transform List>] [/g <Language ID>]
		Advertises a product - m to all users, u to current user
	</uninstall | /x> <Product.msi | ProductCode>
		Uninstalls the product
Display Options
	/quiet
		Quiet mode, no user interaction
	/passive
		Unattended mode - progress bar only
	/q[n|b|r|f]
		Sets user interface level
		n - No UI
		b - Basic UI
		r - Reduced UI
		f - Full UI (default)
	/help
		Help information
Restart Options
	/norestart
		Do not restart after the installation is complete
	/promptrestart
		Prompts the user for restart if necessary
	/forcerestart
		Always restart the computer after installation
Logging Options
	/l[i|w|e|a|r|u|c|m|o|p|v|x|+|!|*] <LogFile>
		i - Status messages
		w - Nonfatal warnings
		e - All error messages
		a - Start up of actions
		r - Action-specific records
		u - User requests
		c - Initial UI parameters
		m - Out-of-memory or fatal exit information
		o - Out-of-disk-space messages
		p - Terminal properties
		v - Verbose output
		x - Extra debugging information
		+ - Append to existing log file
		! - Flush each line to the log
		* - Log all information, except for v and x options
	/log <LogFile>
		Equivalent of /l* <LogFile>
Update Options
	/update <Update1.msp>[;Update2.msp]
		Applies update(s)
	/uninstall <PatchCodeGuid>[;Update2.msp] /package <Product.msi | ProductCode>
		Remove update(s) for a product
Repair Options
	/f[p|e|c|m|s|o|d|a|u|v] <Product.msi | ProductCode>
		Repairs a product
		p - only if file is missing
		o - if file is missing or an older version is installed (default)
		e - if file is missing or an equal or older version is installed
		d - if file is missing or a different version is installed
		c - if file is missing or checksum does not match the calculated value
		a - forces all files to be reinstalled
		u - all required user-specific registry entries (default)
		m - all required computer-specific registry entries (default)
		s - all existing shortcuts (default)
		v - runs from source and recaches local package
Setting Public Properties
	[PROPERTY=PropertyValue]

Consult the Windows ® Installer SDK for additional documentation on the
command line syntax.

Copyright © Microsoft Corporation. All rights reserved.
Portions of this software are based in part on the work of the Independent JPEG Group.

待续: …

参考:
如何让常见的各种installer们自动安装软件

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: