One of the tasks that inevitably fall upon a
SharePoint Administrator is the process of installing features and
solutions. Features are solutions typically written by developers. They
perform a business function such as workflow or a web part.
With the advent of the SharePoint 2010 Sandbox, Site
Collection Administrators can upload and maintain features. However,
there are many situations in which a Farm Administrator needs to install
a farm-wide feature.
Deploying a feature can be done through Visual
Studio, but when implementing on production servers, this is not the way
to install a feature. A feature in production should be installed by an
administrator and this implies the use of PowerShell.
This recipe shows how to install a farm-wide feature and activate it.
Getting ready
You must have farm-level administrative permissions to the Central Administration site.
Feature must be deployed to the 14\template\features folder.
How to do it...
Click on the Start button on the web front-end.
Under All Programs, navigate to the folder named Microsoft SharePoint 2010 Products.
Right-click on SharePoint 2010 Management Shell and click select Run as Administrator. The PowerShell console will appear.
Install the feature by typing the following into the console window:
Install-SPFeature -path "helloworld"
Press the Enter key.
Activate the feature by typing in the following command:
Enable-SPFeature -identity "helloworld" -URL http://sharepoint2010
Press the Enter key.
How it works...
The feature is installed on a web front-end server in the \14\template\features\<features path> folder. If the file is not there when doing the install, an error message will be displayed.
Features are best wrapped in a solution file.
Solution files can be installed across a farm, which is efficient when
dealing with a multi-server topology. It also can be installed to the
Sandbox. In the recipe that was just presented, the feature was already
deployed.
The following is how to install and deploy a solution file called helloworld.wsp:
Install the solution by typing the following command in the console window:
Add-SPSolution c:\temp\helloworld.wsp
Press Enter.
Deploy the solution by typing in:
Install-SPSolution -Identity helloworld.wsp -WebApplication http://sharepoint2010 -GACDeployment
Press the Enter key.
Features that can be scoped at the following levels are seen in the next screenshot:
A solution file, .wsp, is a cab file that contains the following components:
Manifest.xml: This file defines the features (there can be more than one), site definitions, resource files, web part files, and assemblies.
Feature.xml: This file defines the location of the assemblies and defines the scope of the feature(s), and any dependencies.
Elements.xml: This file contains information about the components being installed.
The Assembly (DLL) being installed.
There's more...&;&;
To see all the installed features on your organizations' farm, use the PowerShell command, Get-SPFeature, with no scope.