Installing and removing solutions from SharePoint

Guest post from Trevor Eddolls, CEO iTech-Ed Ltd (www.itech-ed.com), specialists for IT consultancy, analysis, technical education and training, web design, writing, and editing solutions. Read more from Trevor on his mainframe blog and follow him on Twitter.

I said a couple of weeks ago that I have been working with iTech-Ed Associate Darren Pritchard at a site that was fairly new to SharePoint 2007. Darren has written some beginner's guides for them and we thought other sites new to SharePoint might benefit from the information.

Here are Darren's instructions for installing a new SharePoint solution.

First locate the .wsp file that you want to install into SharePoint 2007 (SP2007), then place it (the .wsp file) into the c:\temp folder on the SP2007 server.

You'll need to create a batch (Install Solution.bat) file the first time, and then afterwards you can just edit it. The batch file looks like: 

SET STSADM="c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\bin\STSADM.EXE"

%STSADM% -o addsolution -filename <WEBPART NAME>.wsp

Pause

Replace the tag '<WEBPART NAME>' with the name of your solution and save to c:\temp on the SP2007 server. Then, on the SP2007 server, run the Install Solution.bat file from within the c:\temp folder. You should then see that the solution has successfully been installed.

Next you need to deploy the solution to your Web applications. To do this, open SharePoint Central Admin and click 'Operations' and 'Solution Management'. From there you'll see your new solution, click on the solution name to enter the properties.

Click 'Deploy Solution'. Then change 'Deploy To?' to your Web application and set the 'Deploy When?' to when you wish to deploy the solution. Finally, click 'OK'. This will deploy the solution to your Web application.

Don't forget that you have to activate the solution in your Web application. To do this, click Site Actions/Site Settings/Modify All Site Settings. Then under 'Site Collection Administration' click 'Site Collection Features'. Locate your new solution and click 'Activate'.

You can now use this solution within your Web application.

In terms of house-keeping, backup the .wsp and .bat file from c:\temp and the job's done.

If you need to remove (or retract) the solution then use the following instructions.

From SharePoint Central Admin click 'Operations' then 'Solution Management'. Click on the name of the solution that you want to remove to enter the solution properties.

Click Retract solution. Make sure that 'Retract From?' is set to 'All content Web Applications'. Set the 'Retract When?' setting and click 'OK'. This will remove the solution from all the Web applications. 

Create the following batch file (Remove Solution.bat):

cd c:\program files\common files\microsoft shared\web server extensions\12\bin

stsadm -o deletesolution -name <SOLUTIONNAME>.wsp

pause

Replace the tag '<SOLUTIONNAME >' with the name of your solution and save to c:\temp on the SharePoint2007 (SP2007) server. Then run the Remove Solution.bat file from within the c:\temp folder. This will remove the solution from your SP2007 farm.

Delete the .bat file that you just saved in c:\temp on the SP2007 server.

The solution is now removed.

There'll be more of Darren's SharePoint hints and tips in future blogs.