Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu guide update #44

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ We tested this procedure on an Arduino YUN with LininoOS and LininoIO installed.

### Generic machine

* [Installation guide for Ubuntu 16.04](https://github.com/MDSLab/s4t-lightning-rod/blob/master/docs/ubuntu1604.md)
* [Installation guide for Ubuntu 14.04](https://github.com/MDSLab/s4t-lightning-rod/blob/master/docs/ubuntu1404.md)
* [Installation guide for Ubuntu 20.04](https://github.com/MDSLab/s4t-lightning-rod/blob/master/docs/ubuntu20.04.md)

<!--
### LXD
If you want to install Lightning-rod within an LXD container, you can follow the first part of the IoTronic installation guide you can find [here](https://github.com/MDSLab/s4t-iotronic-standalone/blob/master/docs/installation_lxd.md).
-->
-->
139 changes: 139 additions & 0 deletions docs/ubuntu20.04.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# IoTronic Lightning-rod installation guide for Ubuntu 16.04

We tested this procedure on a Ubuntu 20.04. Everything needs to be run as root.

## Install requirements

##### Install dependencies via apt-get
```
apt update
apt -y install unzip socat dsniff fuse libfuse-dev pkg-config python-is-python2 git ntpdate build-essential lsof gdb

```

##### Install latest NodeJS 8.x release
Execute the following procedures only if are not already installed:

- NodeJS installation:
```
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
apt-get install -y nodejs
node -v
```
- NPM installation:
```
npm install -g npm
npm config set python `which python2.7`
npm -v
```
- Check if the NODE_PATH variable is set:
```
echo $NODE_PATH
```

otherwise:
```
echo "NODE_PATH="`npm -g root` | tee -a /etc/environment
. /etc/environment > /dev/null
echo $NODE_PATH

reboot
```

## Install from source-code

##### Install required NodeJS modules via npm:
```
npm install -g --unsafe gyp [email protected] [email protected] nconf @mdslab/wstun requestify is-running connection-tester [email protected] q fs-access jsonfile md5 python-shell net lsof fuse-bindings mknod
npm install -g --unsafe https://github.com/PlayNetwork/node-statvfs/tarball/v3.0.0
```

##### Install the Lightning-rod
```
mkdir -p /etc/iotronic/
mkdir -p /var/lib/iotronic/plugins
mkdir -p /var/lib/iotronic/drivers/mountpoints/
mkdir -p $NODE_PATH/@mdslab/

git clone --depth=1 git://github.com/MDSLab/s4t-lightning-rod.git $NODE_PATH/@mdslab/iotronic-lightning-rod

cp $NODE_PATH/@mdslab/iotronic-lightning-rod/etc/systemd/system/s4t-lightning-rod.service /etc/systemd/system/lightning-rod.service
sed -i "s|Environment=\"LIGHTNINGROD_HOME=\"|Environment=\"LIGHTNINGROD_HOME=$NODE_PATH/@mdslab/iotronic-lightning-rod\"|g" /etc/systemd/system/lightning-rod.service

chmod +x /etc/systemd/system/lightning-rod.service
systemctl daemon-reload

mkdir -p /var/log/iotronic/
mkdir -p /var/log/wstun/
cp $NODE_PATH/@mdslab/iotronic-lightning-rod/etc/logrotate.d/lightning-rod.log /etc/logrotate.d/lightning-rod.log

echo "IOTRONIC_HOME=/var/lib/iotronic" | tee -a /etc/environment
echo "LIGHTNINGROD_HOME=$NODE_PATH/@mdslab/iotronic-lightning-rod" | tee -a /etc/environment
echo "NODE_TLS_REJECT_UNAUTHORIZED=0" | tee -a /etc/environment
source /etc/environment > /dev/null

cp $NODE_PATH/@mdslab/iotronic-lightning-rod/utils/templates/authentication.example.json /etc/iotronic/authentication.json
cp $NODE_PATH/@mdslab/iotronic-lightning-rod/utils/templates/settings.example.json /var/lib/iotronic/settings.json
cp $NODE_PATH/@mdslab/iotronic-lightning-rod/modules/plugins-manager/plugins.example.json /var/lib/iotronic/plugins/plugins.json
cp $NODE_PATH/@mdslab/iotronic-lightning-rod/modules/drivers-manager/drivers.example.json /var/lib/iotronic/drivers/drivers.json

reboot
```


## Configure Lightning-rod
Now we have to choose which Lightning-rod modules enable. In the /var/lib/iotronic/settings.json configuration file there is the "modules" section:
```
"modules": {

"plugins_manager": {
"enabled": true,
"boot": true,
"alive_timer": 60
},
"services_manager": {
"enabled": true,
"boot": false
},

etc

}
```

In each module section (e.g. "plugins_manager", "services_manager", etc) to enable that module you have to set at "true" the "enabled" field.


At the end of the installation process we have to execute the LR configuration script:
```
$NODE_PATH/@mdslab/iotronic-lightning-rod/scripts/lr_configure
```
You can execute this script in interactive mode:
```
$ ./lr_configure -i
```

or in shell-mode passing the following parameters:
```
$ ./lr_configure <DEVICE_LAYOUT> <IOTRONIC_BOARD_ID> <IOTRONIC_BOARD_PASSWORD> <WAMP_URL> <WSTUN_URL>

* <DEVICE_LAYOUT>: 1 -> 'server', 2 -> 'arduino_yun', 3 -> 'raspberry_pi', 4 -> 'kitra'

* <IOTRONIC_BOARD_ID>: ID released by the registration process managed by IoTronic.

* <IOTRONIC_BOARD_PASSWORD>: password to log in to Iotronic

* <WAMP_URL>: Crossbar server URL

* <WSTUN_URL>: WSTUN server URL
```


## Start Lightning-rod
```
systemctl enable lightning-rod.service

systemctl start lightning-rod.service

tail -f /var/log/iotronic/lightning-rod.log
```