# Stage the Packages

Displayed here is a high-level outline of the processes of staging packages, including deploying them to a Spotfire Server package repository and, optionally, to a Spotfire Statistics Services package repository.

To stage and deploy a package in the Spotfire Server cluster and optionally the Spotfire Statistics Services cluster, follow the pictured workflow. These steps describe the numbers in the image.

1. From your local TERR console, produce or download the R language packages to deploy and use. (Open the console from the Spotfire Analyst installation, from the Tools > TERR Tools menu.)
2. Using your local TERR engine, test the package.
3. From your local TERR engine, load the SpotfireSPK package, and then call the function to build the SPK (passing in the path to the Debian Control File (.dcf), the SPK package name, the SPK and any additional parameters you require).
   - To distribute packages to other Spotfire Analyst clients, call `buildSPK`.
   - To install packages on the Spotfire Server for TERR Service to use, call `buildServerSPK`.
   For more information, see the section Creating the Spotfire SPK.
4. Hand off both the SPK and the R package to your Spotfire Server administrator. (Optionally, if you have the permissions, you can upload the R package to an in-house repository using the drat package.)
   1. The administrator places the SPK on the Spotfire Server for either distribution to other Spotfire Analyst clients, or to a node running the TERR Service. If required, using the TERR console, the administrator can copy the package to the in-house repository.
   2. If you have Spotfire Statistics Services in your Spotfire Server deployment, then the administrator logs in to Spotfire Statistics Services and, using the TERR console, installs the R package from the in-house repository to Spotfire Statistics Services.