yanic/INSTALL.md

85 lines
2.4 KiB
Markdown
Raw Permalink Normal View History

2017-03-05 20:59:03 +01:00
# Howto install Yanic
## go
2017-03-05 20:59:03 +01:00
### Install
```sh
cd /usr/local/
wget https://storage.googleapis.com/golang/go1.9.1.linux-amd64.tar.gz -O go-release-linux-amd64.tar.gz
tar xvf go-release-linux-amd64.tar.gz
rm go-release-linux-amd64.tar.gz
2017-03-05 20:59:03 +01:00
```
### Configure go
Add these lines in your root shell startup file (e.g. `/root/.bashrc`):
2017-03-05 20:59:03 +01:00
```sh
export GOPATH=/opt/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
```
## Yanic
### Compile
As root:
2017-03-05 20:59:03 +01:00
```sh
go get -v -u github.com/FreifunkBremen/yanic
2017-03-05 20:59:03 +01:00
```
2019-01-19 21:59:43 +01:00
### allow to ping
only needed if config has `nodes.ping_count` > 0
```sh
sudo setcap cap_net_raw=+ep /opt/go/bin/yanic
```
#### Work with other databases
If you like to use another database solution than influxdb, Pull Requests are
welcome. Just fork this project and create another subpackage within the folder
`database/`. Take this folder as example: `database/logging/`.
### Configure Yanic
2017-03-05 20:59:03 +01:00
```sh
cp /opt/go/src/github.com/FreifunkBremen/yanic/config_example.toml /etc/yanic.conf
```
For an easy startup you only need to edit the `interfaces` in section
`[respondd]` in file `/etc/yanic.conf`.
Then create the following files and folders:
2017-03-05 20:59:03 +01:00
```sh
mkdir -p /var/lib/yanic
2017-03-05 20:59:03 +01:00
mkdir -p /var/www/html/meshviewer/data
touch /var/log/yanic.log
chown yanic /var/log/yanic.log /var/lib/yanic /var/www/html/meshviewer/data
2017-03-05 20:59:03 +01:00
```
#### Standalone
If you like to run a standalone meshviewer, just set `enable` in section
`[webserver]` to `true`.
##### Configure the [meshviewer](https://github.com/ffrgb/meshviewer):
set `dataPath` in `config.json` to `/data/` and make the `build` directory
accessible under `/var/www/html/meshviewer`.
2017-03-05 20:59:03 +01:00
#### With webserver (Apache, nginx)
The meshviewer needs the output files like `nodes_path` and `graph_path` inside
the same directory as the `dataPath`. Change the path in the section
`[[nodes.output.meshviewer]]` accordingly.
2017-03-05 20:59:03 +01:00
### Service
```sh
cp /opt/go/src/github.com/FreifunkBremen/yanic/contrib/init/linux-systemd/yanic.service /lib/systemd/system/yanic.service
2017-03-05 20:59:03 +01:00
systemctl daemon-reload
systemctl start yanic
systemctl enable yanic
```
### Update
For an update just stop yanic and then call the same `go` command again (again as root):
```sh
systemctl stop yanic
go get -v -u github.com/FreifunkBremen/yanic
```
Then update the config file, for example look at the diff with the new example:
```sh
diff /opt/go/src/github.com/FreifunkBremen/yanic/config_example.toml /etc/yanic.conf
```