Share via


Quick start: Deploy single server in an isolated Hyper-V environment (SharePoint Foundation 2010)

 

Applies to: SharePoint Foundation 2010

You can use an isolated and secure Hyper-V virtual machine to test the features and behavior of SharePoint Foundation 2010. This approach uses minimal hardware resources and enables you to isolate the SharePoint Foundation 2010 test system from a production environment. This isolation is recommended in order to eliminate potential security threats to a corporate network and server environment.

By using the manual steps or the Windows PowerShell 2.0 commands that are provided in this article, you can quickly deploy SharePoint Foundation 2010 on a single server that uses one of the following databases:

  • The built-in SQL Server 2008 Express database that is provided with SharePoint Foundation

  • Microsoft SQL Server 2005 with Service Pack 3 (SP3) and Cumulative Update 3 installed

  • Microsoft SQL Server 2008 with Service Pack 1 (SP1) and Cumulative Update 2

Important

The single-server SharePoint Foundation deployment described in this article is only intended to be used for evaluation and testing purposes, and should not be used in a production environment.

In this article:

  • Requirements and recommendations

  • Required permissions

  • Pre-deployment tasks

  • Deploy SharePoint Foundation 2010 manually

  • Deploy SharePoint Foundation 2010 by using Windows PowerShell scripts

Requirements and recommendations

The following requirements and recommendations for the Hyper-V virtualization server, virtual machine, and the deployment environment only apply to the single-server deployment scenario described in this article.

Virtualization server and virtual machine configuration

The following table provides the minimum and recommended configurations for the virtualization server and the virtual machines. These configurations will support the database options that are available for a single server deployment.

Resource Minimum Recommended

CPU

Dual processor, 2 gigahertz (GHz)

Dual processor, 2 GHz

Memory

4 gigabytes (GB)

8 GB

Hard drive

Fixed-size virtual hard disk that has a capacity of 40 GB

Tip

To speed up the creation of a fixed-size virtual hard disk, initially configure the hard disk as dynamically expanding. After you install all the required software (including SharePoint Foundation), convert the virtual hard disk to a fixed-size hard disk.

Fixed-size virtual hard disk that has a capacity of 80 GB

Network adapter type

Synthetic

Synthetic

Network type

Internal to ensure virtual machine isolation and enable virtualization server-virtual machine communications

Tip

For ease of access to—and installation of—required and recommended software, use an External network. When you are ready to install SharePoint Foundation, configure the virtual machines to use an Internal network.

Internal to ensure virtual machine isolation and enable virtualization server-virtual machine communications

The following configuration guidance is provided for the virtualization server:

  • The logical-to-virtual processor (core) ratio should be as low as possible, with 1:1 being optimal.

  • Using the 1:1 logical-to-virtual processor ratio, you should configure the virtualization server so the total number of processors on the virtual machines is less than the total number of physical cores. For example, if you are using a four-core virtualization server, the best practice is to create three virtual machines that use a single processor, or one virtual machine that has two processors and one virtual machine that uses one processor. Either of these configurations would leave one core free for virtualization server processes.

In addition to the preceding requirements for the virtual environment, review the Hardware and software requirements (SharePoint Foundation 2010) article before you start deploying SharePoint Foundation 2010 on the virtual machine.

Deployment environment

A domain is required to deploy SharePoint Foundation 2010.

If you do not have an isolated virtual domain available to deploy SharePoint Foundation 2010, you must create a virtual domain on a Hyper-V that is configured to use the following:

  • A domain controller with Active Directory Domain Services (AD DS)

  • A domain controller with a DNS server

You can deploy SharePoint Foundation on a domain controller. However, some configuration is required. Start Windows PowerShell with the Run as administrator option and run the following commands to enable deployment on a domain controller:

$acl = Get-Acl HKLM:\System\CurrentControlSet\Control\ComputerName 
$person = [System.Security.Principal.NTAccount]"Users" 
$access = [System.Security.AccessControl.RegistryRights]::FullControl 
$inheritance = [System.Security.AccessControl.InheritanceFlags]"ContainerInherit, ObjectInherit" 
$propagation = [System.Security.AccessControl.PropagationFlags]::None 
$type = [System.Security.AccessControl.AccessControlType]::Allow 
$rule = New-Object System.Security.AccessControl.RegistryAccessRule($person, $access, $inheritance, $propagation, $type) 
$acl.AddAccessRule($rule) 
Set-Acl HKLM:\System\CurrentControlSet\Control\ComputerName $acl

Required permissions

In order to install SharePoint Foundation 2010, the logon account that you are using on the virtual machine must be a member of:

  • The local Administrators group on the virtual machine

  • The SQL Server dbcreator fixed server role

  • The SQL Server securityadmin server role

For more information, see Initial deployment administrative and service accounts (SharePoint Foundation 2010).

Pre-deployment tasks

Complete the following tasks before you deploy SharePoint Foundation 2010:

  • On the virtualization server, create an installation point that contains the SharePoint Foundation software or provide media, such as an ISO image, that can be accessed from the virtual machine.

  • Create a virtual machine that meets the minimum requirements described in the “Requirements and recommendations” section earlier in this article.

  • On the virtual machine:

Deploy SharePoint Foundation 2010 manually

For information about how to manually deploy SharePoint Foundation 2010 on a single server, see Deploy a single server with a built-in database (SharePoint Foundation 2010) or Deploy a single server with SQL Server (SharePoint Foundation 2010).

Deploy SharePoint Foundation 2010 by using Windows PowerShell scripts

You can use Windows PowerShell scripts to deploy SharePoint Foundation 2010 on a single server.

securitySecurity Note
As a best practice, you should not run unsigned scripts.
For more information about signing Windows PowerShell scripts, see Windows PowerShell: Sign Here Please (https://go.microsoft.com/fwlink/p/?linkid=160357) in TechNet Magazine. For more information about code signing in general, see Introduction to Code Signing (https://go.microsoft.com/fwlink/p/?linkid=59273) on MSDN. For more information about setting up your own certification authority (CA), see Active Directory Certificate Services (https://go.microsoft.com/fwlink/p/?linkid=136444) in the TechNet Library.

Create and use one of the following Windows PowerShell script files to deploy SharePoint Foundation on a single server.

  • simplesingleserver.ps1: Installs SharePoint Foundation 2010 using the built-in database to store configuration information and documents.

  • simplefarm.ps1: Installs SharePoint Foundation 2010 using either SQL Server 2005 or SQL Server 2008 to store configuration information and documents.

simplesingleserver.ps1

This script deploys SharePoint Foundation 2010 on a single server that uses the built-in database.

Copy the following code to a text editor and save it as simplesingleserver.ps1 in the directory of your choice:



$SetupPath         = Read-Host -Prompt "Please specify the path to the install media (D:)"
        
## Here is the script to install SharePoint Foundation 2010 with SQL Express and create Central Admin ##
& $SetupPath\PrerequisiteInstaller.exe /unattended | Write-Host
if( $lastexitcode -eq 0 ) {
    & $SetupPath\setup.exe /config $SetupPath\Files\SetupSilent\config.xml | Write-Host
    if( $lastexitcode -eq 0 ) {
        Write-Host "Install successful..."
    } else { Write-Error "ERROR: $lastexitcode" }
} else { Write-Error "ERROR: $lastexitcode" }

To run simplesingleserver.ps1

  1. Start Windows PowerShell 2.0 using the Run as administrator option.

  2. Navigate to the directory where you saved simplesingleserver.ps1.

  3. Run .\simplesingleserver.ps1 from the Windows PowerShell command prompt.

simplefarm.ps1

This script deploys SharePoint Foundation 2010 on a single server that uses a SQL Server database. Copy the following code to a text editor and save it as simplefarm.ps1 in the directory of your choice:


## Settings you may want to change ##
$err = $null
$SetupPath         = Read-Host -Prompt "Please specify the path to the install media (D:)"
Write-Host "Please specify the Farm Administrator credentials"
$FarmCredential    = Get-Credential "DOMAIN\<Farm Admin>"
$DBServer          = Read-Host -Prompt "Please enter the name of your database server"
$Passphrase        = Read-Host -Prompt "Please enter the farm passphrase (optional)" -AsSecureString
$FarmName          = Read-Host -Prompt "Please enter a farm name (optional)"
$CAPort            = Read-Host -Prompt "Please enter the Central Administration port number (optional)"

if ([String]::IsNullOrEmpty($SetupPath))
{
    Write-Error "You must enter the install media path"
    return
}
if ([String]::IsNullOrEmpty($FarmCredential))
{
    Write-Error "You must enter a Farm Administrator's user name and password"
    return
}
if ([String]::IsNullOrEmpty($DBServer))
{
    Write-Error "You must enter a database server"
    return
}
if ($Passphrase.Length -eq 0)
{
    Write-Warning "You didn't enter a farm passphrase, using the Farm Administrator's password instead"
    $Passphrase = $FarmCredential.Password
}
if ([String]::IsNullOrEmpty($FarmName))
{
    Write-Warning "You didn't enter a farm name, using the machine name instead"
    $FarmName = $env:COMPUTERNAME
}
if ([String]::IsNullOrEmpty($CAPort))
{
    Write-Warning "You didn't enter a Central Administration port number, using 5000 instead"
    $CAPort = 5000
}

## Here is the script to install SharePoint Foundation 2010 and create Central Admin ##
Write-Host "[1/15] Running prerequisite installer..." 
& $SetupPath\PrerequisiteInstaller.exe /unattended | Write-Host
if( $lastexitcode -eq 0 ) {
    Write-Host "[2/15] Running silent farm binary installation... (this will take some time)" 
    & $SetupPath\setup.exe /config $SetupPath\Files\SetupFarmSilent\config.xml | Write-Host
    Write-Host "[3/15] Completed silent farm binary installation." 
    if( $lastexitcode -eq 0 ) {
        Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
        Write-Host "[4/15] Creating new configuration database..." 
        New-SPConfigurationDatabase -DatabaseName ("{0}_SharePoint_Configuration_DB" -f $FarmName) -DatabaseServer $DBServer -AdministrationContentDatabaseName ("{0}_AdminContent_DB" -f $FarmName) -FarmCredentials $FarmCredential -Passphrase $Passphrase -ErrorVariable err
        Write-Host "[5/15] Verifying farm creation..." 
        $spfarm = get-spfarm
            if ($spfarm -ne $null) {
            Write-Host "[6/15] ACLing SharePoint Resources..." 
            Initialize-SPResourceSecurity -ErrorVariable err
            if ([String]::IsNullOrEmpty($err) -eq $true) {
                Write-Host "[7/15] Installing Services..." 
                Install-SPService -ErrorVariable err
                    if ([String]::IsNullOrEmpty($err) -eq $true) {
                    Write-Host "[8/15] Installing Features..." 
                    Install-SPFeature -AllExistingFeatures -ErrorVariable err
                    if ([String]::IsNullOrEmpty($err) -eq $true) {
                        Write-Host "[9/15] Provisioning Central Administration..." 
                        New-SPCentralAdministration -Port $CAPort -WindowsAuthProvider "NTLM" -ErrorVariable err
                        if ([String]::IsNullOrEmpty($err) -eq $true) {
                            Write-Host "[10/15] Installing Help..." 
                            Install-SPHelpCollection -All -ErrorVariable err
                            if ([String]::IsNullOrEmpty($err) -eq $true) {
                                Write-Host "[11/15] Installing Application Content..." 
                                Install-SPApplicationContent -ErrorVariable err
                                if ([String]::IsNullOrEmpty($err) -eq $true) {
                                    Write-Host "[12/15] Basic configuration completed." 
                                    $SPManagedAccount = Get-SPManagedAccount $FarmCredential.UserName
                                    Write-Host "[13/15] Creating Web Application and Application Pool..." 
                                    $webApp = New-SPWebApplication -Name "SharePoint - 80" -ApplicationPool "SharePoint - 80" -ApplicationPoolAccount $SPManagedAccount -DatabaseServer $DBServer -DatabaseName ("{0}_Content_DB" -f $FarmName) -Url "https://localhost" -ErrorVariable err
                                    if ([String]::IsNullOrEmpty($err) -eq $true) {
                                        Write-Host "[14/15] Creating site collection..." 
                                        $SPSite = New-SPSite -url "https://localhost" -OwnerAlias $FarmCredential.UserName -ErrorVariable err
                                        if ([String]::IsNullOrEmpty($err) -eq $true) {
                                            Write-Host "[15/15] Port 80 Web application and site collect created.  Browse to https://localhost to pick a template for the Web..."
                                        } else { Write-Error "ERROR: $err" }
                                    } else { Write-Error "ERROR: $err" }
                                } else { Write-Error "ERROR: $err" }
                            } else { Write-Error "ERROR: $err" }
                        } else { Write-Error "ERROR: $err" }
                    } else { Write-Error "ERROR: $err" }
                } else { Write-Error "ERROR: $err" }
            } else { Write-Error "ERROR: $err" }
        } else { Write-Error "ERROR: $err" }
    } else { Write-Error "ERROR: $lastexitcode" }
} else { Write-Error "ERROR: $lastexitcode" }
 
$exitprompt = Read-Host -Prompt "Press Enter to exit..."

To run simplefarm.ps1

  1. Start Windows PowerShell 2.0 using the Run as administrator option.

  2. Navigate to the directory where you saved simplefarm.ps1.

  3. Run .\simplefarm.ps1 from the Windows PowerShell command prompt.

See Also

Other Resources

Resource Center: Installation and Deployment for SharePoint Foundation 2010
Resource Center: Virtualization for SharePoint Foundation 2010