Quantcast
Channel: .Net Scraps - SharePoint 2010
Viewing all articles
Browse latest Browse all 14

SharePoint 2010 - Set up your development environment for Windows 7 using Boot from VHD - 1 [semi automated way with scripts]

$
0
0

I will tell you about my hardware setup and the reason why I am posting this. I am sure I am not alone who has faced this!!! I have a laptop with 4GB RAM and I wanted to use this as my SharePoint development environment. The first question was the choice of OS – Windows 7 or Windows 2k8 R2 Server. I decided to go with Windows 7 for obvious reasons and very soon realized that if I install all the beta products (SharePoint 2010, Microsoft Office 2010, Visual Studio 2010 beta being the minimum) that I play around with on my primary machine, it would be almost impossible for me to clean everything up and start afresh with the RTM versions when they are released. This can put my data at risk as well. Hence I multi-partitioned my drive and installed Win 7 on first and Win 2k8 R2 on the 2nd one. The idea was to use Hyper-V and run everything virtual. I blogged about it here. Initially everything went fine, but pretty soon I found some issues with this approach.

    Hyper-V doesn’t allow hibernate which is something I can live with (not very happily though).
    The core OS still took around 1GB RAM, which left with only 3 GB to allocate to my virtual machines. I allocated 2.5 GB and although the performance wasn’t really great, SP 2010 used to work initially. The moment I installed VS 2010 and started to play around, the performance degraded. Since my laptop doesn’t support more RAM (oh yes, I am getting a new laptop soon!) I wanted to do something else which works.
    I use Wireless network at home, and connectivity on my guest was always an issue. I knew some workarounds for this, but somehow I wasn’t very satisfied. For me, out of the blue, the bridged connection gave issues. I had to delete the bridge and recreate it to make it work. But I never had any guarantee that this will continue to work after a reboot.
    Copy paste between my Guest/Host was a big pain in the you know what!
    I had to boot two machines. First my host, Win 2k8 Hyper-V, and then my guest for SP!!!

Very soon the time was ripe to retire this way of working. I knew that I needed something which is not purely virtual. This post is about setting up Windows 7 boot from VHD option, followed by setting up SharePoint 2010 on the machine for development purpose. This machine need not be on any domain, and everything that’s done on this machine will be done through scripts. The are a few reasons behind this approach.

    Scripting this machine for SharePoint makes it easier to replicate the settings on every developer’s machine
    Recovery from a failed SharePoint installation should be a fast and smooth. All I would need is the same activated VHD and run all the scripts to make my environment ready.
    Primary Windows 7 machine should not be affected because of a corrupt installation

So what exactly is this boot from VHD option? In simple words, you create a new VHD file and set up your OS – Windows 7 or Windows 2k8 R2 on it. This means that almost everything works, including your desktop experience, BUT everything is still stored in 1 VHD file. Instead of creating restore points, you can decide to backup this VHD file and continue playing around. If by chance anything breaks in your OS/SharePoint or any other software, instead of wasting time in fixing this up, you just restore a good VHD and you are back in business. Before you jump to do it, some caveats…

    Hibernate will still not work if you boot from VHD
    Even though it is easy, you should be REALLY careful of what you are doing, so that you don’t end up losing all your important data
    Ensure that you backup your important data anyways… and please don’t do it on the same drive under a folder called Backup Winking Be wise, use External HDD.
    The VHD will not be completely portable because the installation registers your hardware information in the same VHD. For me that’s not an issue, since I want to use every possible bit from my existing laptop.

The best part is that you don’t lose the memory that you would otherwise lose if you are using Win 2k8 – R2, Hyper-V. This is because you will be working on the OS directly, with all the tools that you need, and the beauty as I said is that, it will ALL be STILL ONE FILE.

Without further ado, let me tell you what all you need to do…

    Boot the system with a setup DVD or USB Thumb Drive
    At the setup screen do NOT choose “Install Now”. Press SHIFT + F10 and it will bring you the command window.
    In the command windows type DiskPart

image

     Create a new VHD and attach it as a Physical Disk by issuing the following commands. Note that maximum attribute below is in MB [I want 50 GB space to begin with].

Diskpart > create vdisk file=”<path_to_vhd>” type=expandable maximum=50000
Diskpart > select vdisk file=”<path_to.vhd>”
Diskpart > attach vdisk

DEMO>

image

     Switch to the setup window by click it with your mouse, or ALT + TAB and proceed with Setup after you select the correct disk <ensure that you once you refresh the list of drives during setup, you see your newly created VHD file as a Drive>. Also notice that you are installing a new instance of Windows 7 or Win 2k8 R2 server during this step IN THE NEW VHD file which is not really a true hard disk partition. The installer is smart enough to create all the entries and set up your multi-boot environment. In my case, once I rebooted I found two entries to choose from…

Windows 7
Windows 7

     Although, I could make out which was the fresh install by trial and error, I wanted something better. Enter the tool – bcdedit.exe
     Open an elevated command prompt. [Run CMD as an Administrator]
     Type bcdedit.exe /v and hit Enter. I want to change the 2nd entry in my Boot menu to Windows 7 VHD. Hence, copy the GUID and issue the following command.

bcdedit /set {GUID} Description “Windows 7 VHD″

     Notice that my Boot menu now shows Windows 7 VHD below.

image

     Once done, you can reboot into your original Windows 7 and ensure that everything is intact. Now, reboot and boot into Windows 7 VHD. This should be your fresh setup.
     At this point, you should install all the drivers for audio/video.
     Install Microsoft Office 2010 Beta/RC (x86) preferably because of compatibility issues.
     Reboot back into the real OS - Windows 7 and take a backup of this fully functional and clean VHD file.
     Let’s install IIS 7… each and every feature except FTP. The key point here is that, we’ll use a script instead of a regular GUI setup.
     Copy the following in a notepad and save the file as “iissetup.bat”. Run this batch file from an elevated command prompt.

cls
@echo off
@echo.
@echo.
@echo -------------------------
@echo Starting IIS Installation
@echo -------------------------
@echo Pkgmgr started...

start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-HttpRedirect;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ASP;IIS-CGI;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-ODBCLogging;IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;IIS-ClientCertificateMappingAuthentication;IIS-IISCertificateMappingAuthentication;IIS-URLAuthorization;IIS-RequestFiltering;IIS-WebDAV;IIS-IPSecurity;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-ManagementScriptingTools;IIS-ManagementService;IIS-IIS6ManagementCompatibility;IIS-Metabase;IIS-WMICompatibility;IIS-LegacyScripts;IIS-LegacySnapIn;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI

if errorlevel 0 @echo Success...
@echo Starting Internet Explorer with the default page.
start http://localhost

     If everything works fine, you should be able to see a page like the following…

image

     IIS is now installed. It is possible that you don’t see the page above and be prompted for a reboot instead. Do it if required and browse http://localhost to get the same page as above.

Manual Steps
==========
     You should ensure that you have installed the highlighted components.

image
     I have created a folder on C Drive. C:\SharePoint. This folder contains two folders Software and Scripts. Download the following software and save them in C:\SharePoint\Software for the scripts to work. Filenames below are defaults when I downloaded from the links mentioned. The installation batch file is based on these names. AND, I have tested it ONLY on Windows 7.
     1. Download the WCF Hotfix KB971831– Filename = Windows6.1-KB976462-v2-x64.msu
     2. Copy the OfficeServer.exe from your Media (or download it from the web).
The key is PKXTJ-DCM9D-6MM3V-G86P8-MJ8CY – Installation Notice for SharePoint 2010 Beta.
     3. Download Microsoft Filter Pack 2– Filename = FilterPackx64.exe
     4. Download SQL Server Native Client– Filename = sqlncli.msi
     5. Download Microsoft Sync Framework– Filename = Synchronization.msi
     6. Download Microsoft Geneva Framework– Filename = MicrosoftGenevaFramework.amd64.msi
     7. Download ADO.NET Data Services v1.5– Filename =ADONETDataServices_v15_CTP2_RuntimeOnly.exe
     8. Download Chart Controls– Filename = MSChart.exe
     9. Download SQL Server Analysis Services - ADOMD.Net– Filename = SQLSERVER2008_ASADOMD10.msi
     Copy the following in a batch file and execute it from an elevated command prompt to install all the pre-requisites.

C:\SharePoint\Scripts\SharePointPreReq.bat

cls
@echo off
@echo.
@echo Installing WCF Hotfix...
C:\SharePoint\Software\Windows6.1-KB976462-v2-x64.msu /quiet
@echo Extracting SharePoint files...
c:\SharePoint\Software\OfficeServer.exe /extract:c:\SharePoint\Extracted /quiet
@echo Installing Prerequisites...
@echo ----------------------------
@echo Installing Filter Pack....
c:\SharePoint\Software\FilterPackx64 /quiet
@echo Installing Native SQL Client...
msiexec.exe /qn /package "C:\SharePoint\Software\sqlncli.msi"
@echo Installing Microsoft Sync...
msiexec.exe /qn /package "C:\SharePoint\Software\Synchronization.msi"
@echo Installing Microsoft Geneva Framework...
msiexec.exe /qn /package "C:\SharePoint\Software\MicrosoftGenevaFramework.amd64.msi"
@echo Installing Microsoft ADO.NET Data Services...
C:\SharePoint\Software\ADONETDataServices_v15_CTP2_RuntimeOnly.exe /q
@echo Installing Microsoft Chart Controls...
C:\SharePoint\Software\MSChart.exe /q
@echo Installing Microsoft SQL Server Analysis Services...
msiexec.exe /qn /package "C:\SharePoint\Software\SQLSERVER2008_ASADOMD10.msi"
pause

     Open "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG\web.config" and change <compilation> tag to <compilation optimizeCompilations="true">
     Open "C:\SharePoint\Extracted\Files\Setup\config.xml" in Notepad. Make the highlighted changes. (Basically, provide Product Key, and AllowWindowsClientInstall.

<Configuration>
    <Package Id="sts">
        <Setting Id="LAUNCHEDFROMSETUPSTS" Value="Yes"/>
    </Package>

    <Package Id="spswfe">
        <Setting Id="SETUPCALLED" Value="1"/>
        <Setting Id="OFFICESERVERPREMIUM" Value="1" />
    </Package>

    <Logging Type="verbose" Path="%temp%" Template="SharePoint Server Setup(*).log"/>
    <PIDKEY Value="PKXTJ-DCM9D-6MM3V-G86P8-MJ8CY" />
    <Setting Id="SERVERROLE" Value="SINGLESERVER"/>
    <Setting Id="USINGUIINSTALLMODE" Value="1"/>
    <Setting Id="SETUPTYPE" Value="CLEAN_INSTALL"/>
    <Setting Id="SETUP_REBOOT" Value="Never"/>
    <Setting Id="AllowWindowsClientInstall" Value="True"/>
</Configuration>

     Start Setup.exe from C:\SharePoint\Extracted. This will install the binaries only.
     Select StandAlone when prompted. Once done, you will see a screen as follows.

image

     Click Close
     PSConfigUI will start. Click through.
     If you haven’t installed the following, your configuration wizard will fail, with the error message… “Failed to create sample data”.

image

Failed to create sample data.
An exception of type Microsoft.Office.Server.UserProfiles.UserProfileException was thrown.  Additional exception information: Unrecognized attribute 'allowInsecureTransport'. Note that attribute names are case-sensitive. (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebClients\Profile\client.config line 56)
Microsoft.Office.Server.UserProfiles.UserProfileException: Unrecognized attribute 'allowInsecureTransport'. Note that attribute names are case-sensitive. (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebClients\Profile\client.config line 56) ---> System.Configuration.ConfigurationErrorsException: Unrecognized attribute 'allowInsecureTransport'. Note that attribute names are case-sensitive. (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebClients\Profile\client.config line 56)

    If by any chance, you get the error above even after installing the components… check this link and re-run "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN\psconfigui.exe"
    For me everything went through successfully, and I am a happy guy now!

This has been a long post. In the next one, I will show you some more tweaks to get the most out of your installation and ensure that your development experience with SharePoint is ultra-smooth. Stay tuned!

Your feedback and comments are much appreciated!

Happy SharePointing! Wave
Rahul


Quote of the day:
I never guess. It is a capital mistake to theorize before one has data. Insensibly one begins to twist facts to suit theories, instead of theories to suit facts. - Sir Arthur Conan Doyle




Viewing all articles
Browse latest Browse all 14

Trending Articles