# Intalling Swirlds on Raspbian

To make Swirlds work on Raspbian, the appropriate version of Java needs to be installed and the hardware random number generator needs to be confgured for TLS to work

## Intalling Java

Frist verify if the Java installed is the appropriate one, we need Oracle Java version 8. To verify, type the following in the terminal:

    java -version

The version should be 1.8 and it should be by Oracle(HotSpot). Here is an example of what it should look like:

    java version "1.8.0_65"
    Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
    Java HotSpot(TM) Client VM (build 25.65-b01, mixed mode)

If you do not have the appropriate Java, follow these steps to install it:
Visit http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html.
Click the download button of Java Platform (JDK) 8.
Click to Accept License Agreement.
Download jdk-8-linux-arm-vfp-hflt.tar.gz for Linux ARM v6/v7 Hard Float ABI.
Log-in Raspberry Pi, enter the command to extract jdk-8-linux-arm-vfp-hflt.tar.gz to /opt directory:

    sudo tar zxvf jdk-8-linux-arm-vfp-hflt.tar.gz -C /opt

Set default java and javac to the new installed jdk8:

    sudo update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0/bin/javac 1
    sudo update-alternatives --install /usr/bin/java java /opt/jdk1.8.0/bin/java 1
    sudo update-alternatives --config javac
    sudo update-alternatives --config java

Now verify the Java again:

    java -version

## Setting up the hardware random number generator

Raspberry Pi has a hardware random number generator that needs to be set up in order for Java to use it for TLS.
Depending on your version of the hardware and software, you might need to enable the module(it is enabled by default on newer systems):

    sudo modprobe bcm2708-rng

After it is enabled, you need to install rng-tools for it to feed the random data to /dev/random:

    sudo apt-get install rng-tools

To check whether it works, run the following command in the terminal:

    sudo dd if=/dev/random of=random bs=128 count=1024

It shouldn't take more than a few seconds, and the output should look something like:

    0+1024 records in
    0+1024 records out
    41306 bytes (41 kB) copied, 0.716273 s, 57.7 kB/s

Back