# Using a Raspberry PI

The Raspberry Pi is a low cost option for running the VSSL api. It is a stable platform with good documentation and a huge global community. We support the Raspberry PI 3.

You can purchase a good Raspberry Pi kit here: [Amazon RPi Kit](https://www.amazon.com/CanaKit-Raspberry-Complete-Starter-Kit/dp/B0778CZ97B/ref=sr_1_1_sspa)

* [Using the prebuilt VSSL image](#VSSLimage)
* [Raspberry PI from Scratch](#scratch)&#x20;
* [Flashing an SD card](#flashSd)

### Using the VSSL prepared RPi image <a href="#vsslimage" id="vsslimage"></a>

We have put together a Rasbian image with the VSSL agent that runs the REST API preloaded.

You can follow these instructions to configure your Raspberry Pi 3 with the preconfigured VSSL rpi image.

1.  Download the VSSL configured image from: [Download the image](http://tools.vssl.com/vsslagent/vsslagent_rasbian_17jan18.img.gz)

    > Currently this image is for a 32Gb SD card
2. Load this image on a microSd card using the instructions at: [Raspberry Pi Org](https://www.raspberrypi.org/documentation/installation/installing-images/)
3. Insert this microSd card in the PI and power on the PI
4.  The vsslagent will now be running on port 8000. You can test it from the terminal.

    a. List the VSSL zones that the pi can see

    ```
    curl localhost:8000/api/vssls
    ```

> Remember that you will have to use the correct ip address (the address of the pi) when calling API functions from an entity outside the PI.

You can get the ip address of the pi using `ifconfig`. You will see an entry for enx<> that contains a field `inet`.

## Configuring a Raspberry Pi 3 From Scratch <a href="#scratch" id="scratch"></a>

How to Configuring a Rapsberry Pi 3 using the latest image:

1. Download the latest 'Rasbian Stretch with desktop' image from RaspberryPi.org: [Download Image](https://www.raspberrypi.org/downloads/raspbian/)
2. Load this image on a microSd card using the instructions at RaspberryPi.org: [Instructions](https://www.raspberrypi.org/documentation/installation/installing-images/windows.md)
3. Insert this microSd card in the PI and launch it
4.  Open a terminal and perform the following:

    a. Update the image to latest tools:

    ```
    sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get clean
    ```

    b. install the ubuntu snap tool:

    ```
    sudo apt-get install snapd
    ```

    c. install the vssl agent:

    ```
    sudo snap install vsslagent
    ```
5.  The vsslagent will now be running on port 8000. You can test it from the terminal.

    a. list the VSSL zones that the pi can see

    ```
    curl localhost:8000/api/vssls
    ```

> Remember that you will have to use the correct ip address (the address of the pi) when calling API functions from an entity outside the PI.

You can get the ip address of the pi using `ifconfig`. You will see an entry for enx<> that contains a field `inet`.

### Flashing the Image <a href="#flashsd" id="flashsd"></a>

Use [Etcher.io](https://etcher.io/) to flash the image to your SD card.
