As mentioned in a previous post, we have a few staging environments for SharePoint that come and go with the various projects. To make the process of installing these environments a lot easier (and so I can spend more time cutting code), I wrote a batch file that, well, installs SharePoint and configured it for me!
I did some hunting and found Joel Oleson's Blog about silent installs, added that information with the MSDN article on the config.xml and away I went! But, that was only half of the battle, the next part came curtsy of Keith Richie and his post on Psconfig.exe, explaining how to use the Psconfig.exe command-line tool to perform the configuration of SharePoint. There is also a great amount of information on MSDN about Psconfig. Finally, using some of the STSADM functions the base site was created.
First off, I think some background is needed now about the environment this is all going on. I am using Windows Server 2008 and I have installed IIS already.
Installing SharePoint
Alright, first part of this process. I have the install binaries in a network shared folder with service pack 1 extracted to the updates folder (see Martin Kearn's blog about how to create a ‘Slipstream’ installation for MOSS with SP1, the same process will work for WSS 3.0 OR you can get all ready done, have a look at this blog on the WSS and MOSS with SP1 release).
Next I created my config.xml following Joel's post. Below is the contents of that file:
1: <Configuration>
2: <Package Id="sts">
3: <Setting Id="LAUNCHEDFROMSETUPSTS" Value="Yes" />
4: <Setting Id="REBOOT" Value="ReallySuppress" />
5: <Setting Id="SETUPTYPE" Value="CLEAN_INSTALL" />
6: </Package>
7: <Package Id="spswfe">
8: <Setting Id="SETUPCALLED" Value="1" />
9: <Setting Id="REBOOT" Value="ReallySuppress" />
10: <Setting Id="OFFICESERVERPREMIUM" Value="1" />
11: </Package>
12: <INSTALLLOCATION Value="%CommonProgramFiles%\Microsoft Shared\Web Server Extensions\12\Data" />
13: <Logging Type="verbose" Path="%temp%" Template="Office Server Setup(*).log" />
14: <Display Level="basic" CompletionNotice="no" SuppressModal="No" NoCancel="Yes" AcceptEula="Yes" />
15: <PIDKEY Value="xxxxxxxxxxxxxxxxxxxxxxxx" />
16: <Setting Id="SETUPTYPE" Value="CLEAN_INSTALL" />
17: <Setting Id="SERVERROLE" Value="SINGLESERVER" />
18: <Setting Id="USINGUIINSTALLMODE" Value="1" />
19: <Setting Id="SETUP_REBOOT" Value="Never" />
20: </Configuration>
The above config.xml file is called along with setup.exe to install SharePoint without interaction!
Command that is called:
\\server\Sharepoint\MOSS2007wSP1\x64\setup.exe /config file://server/Sharepoint/MOSS2007wSP1/config.xml
Configuring SharePoint/Creating Site Collection
Next we need to run the Psconfig and STSADM commands. I followed the instructions on Keith's blog and added my own STSADM command to create the default site and came up with this:
cd %COMMONPROGRAMFILES%\Microsoft Shared\web server extensions\12\bin
psconfig -cmd configdb -create -database SP_Config -admincontentdatabase SPT_Content -cmd adminvs -provision -port 30000 -windowsauthprovider onlyusentlm -cmd quiet
stsadm -o extendvs -url http://YourSite -ownerlogin Domain\User -owneremail you@yourcompany.com -sitetemplate STS#0 -description "Site Description"
Then, all you need to do is put it all together and pop it in a .bat file, here is what I came up with:
1: ::Install SharePoint
2: REM --Connecting to SharePoint Install Files and Starting the SharePoint Install--
3: \\server\Sharepoint\MOSS2007wSP1\x64\setup.exe /config \\server\Sharepoint\MOSS2007wSP1\config.xml
4: REM --Configuring SharePoint--
5: cd %COMMONPROGRAMFILES%\Microsoft Shared\web server extensions\12\bin
6: psconfig -cmd configdb -create -database SP_Config -admincontentdatabase SPT_Content -cmd adminvs -provision -port 30000 -windowsauthprovider onlyusentlm -cmd quiet
7: REM --Create a site with a default site template--
8: stsadm -o extendvs -url http://YourSite -ownerlogin Domain\User -owneremail you@yourcompany.com -sitetemplate STS#0 -description "Site Description"
Running the above batch file will install and configure SharePoint, giving you a default instance to start you off with!