Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

network={
 ssid="SSID of you network"
 psk="Password of your network"
}


When everything has been modified, reboot the raspberry to apply changes:

pi$ sudo reboot


Find the private ip of your raspberry pi to connect via ssh to it.

pi$ ifconfig
computer$ ssh pi@"ip of your raspberry"


Finally to change the root password we just use the following command:

pi$ sudo passwd root


Update apt-get

Before starting to set up everything we'll make sure we have the last version of apt-get installed by:

pi$ sudo apt-get update
pi$ sudo apt-get upgrade

Install npm and nodejs

We'll also need to install the javascript npm package manager and installer:

pi$ sudo apt-get install nodejs npm

Install git

In order to be able to clone git repositories we must install the git toolkit, to do so:

pi$ sudo apt-get install git


Install geth

To run a local node connected to the Costaflores private network an Ethereum client is necessary. In this case we'll use geth to set it up, other clients such as Parity can be used too. To install it we need to know the type of cpu we are using:

pi$ cat /proc/cpuinfo
...
model name : ARMv7 Processor rev 4 (v7l)
...

Select the geth instance you want to install from https://geth.ethereum.org/downloads/ and retrieve the package from the raspberry:

pi$ wget https://gethstore.blob.core.windows.net/builds/geth-linux-arm7-1.8.20-24d727b6.tar.gz
pi$ tar zxvf geth-linux-arm7-1.8.20-24d727b6.tar.gz

Copy the Geth application to the /usr/local/bin folder:

pi$ sudo cp geth-linux-arm7-1.8.20-24d727b6/geth /usr/local/bin
pi$ rm -rf g*


Check it was installed correctly:

pi$ geth version


Install node-red

To implement the front-end of the temperature dashboard we will use nodered and its dht22 contributions, to do so, firstly we must install nodered by:

pi$ sudo apt-get install build-essential
pi$ sudo apt-get install nodered


Now that we have installed nodred we will use npm to install the dht22 contributions:

pi$ wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.58.tar.gz 
pi$ tar zxvf bcm2835-1.58.tar.gz
pi$ cd bcm2835-1.58
pi$ ./configure
pi$ make
pi$ sudo make check
pi$ sudo make install
pi$ sudo npm install --unsafe-perm -g node-dht-sensor
pi$ sudo npm install --unsafe-perm -g node-red-contrib-dht-sensor
pi$ sudo npm install node-red-node-mysql


Finally we test it works by using:

pi$ node-red-start


Once we've checked everything is working correclty we can enable it to run on boot:

pi$ sudo systemctl enable nodered.service


Install MariaDB

In order to have a working database in the raspberry pi we've selected the mariadb sql one. To install it we must:

pi$ sudo apt-get install mariadb-server


Once installed we have to initialise following the instructions displayed when using:

pi$ sudo mysql_secure_installation


Finally we can test it by using:

pi$ sudo mysql -u root


Install python3 package manager and packages

Python comes already installed in the raspbian image so we can use it directly. To work with its packages we'll install the pip3 package manager. To install it:

pi$ sudo apt-get install python3-pip
pi$ sudo python3 -m pip install --upgrade pip setuptools wheel


Once we have python3 and pip3 installed we have to download the following packages:

pi$ sudo pip3 install adafruit-circuitpython-dht
pi$ sudo pip3 install adafruit-circuitpython-charlcd
pi$ sudo pip3 install --upgrade adafruit_blinka
pi$ sudo pip3 install mysql-connector-python
pi$ sudo pip3 install web3


Install and connect to OpenVPN

In order to be able to assure secure communications between nodes, just nodes inside the VPN can connect via HTTP, to do so, we'll install openvpn:

pi$ sudo apt-get install openvpn

Once we have installed openvpn, we must get the vpn config files from the admin. Once received we just have to:

pi$ mkdir vpn
computer$ scp openvino-openvpn.tar pi@192.168.1.58:/home/pi/vpn
pi$ cd vpn
pi$ tar -xvf openvino_openvpn.tar
pi$ sudo cp * /etc/openvpn/
pi$ sudo openvpn --config /etc/openvpn/mdv-clofw01-TCP4-1195-mbarrow.conf
pi$ sudo systemctl enable openvpn@mdv-clofw01-TCP4-1195-mbarrow


Finally we reboot the system to enable everything we have installed.

pi$ sudo reboot