forked from Freifunk-Nord/nord-yanic-cfg
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.sh
executable file
·59 lines (51 loc) · 1.47 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# GO API download
cd /usr/local/
wget https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz
tar xvf go1.8.linux-amd64.tar.gz
rm go1.8.linux-amd64.tar.gz
export GOPATH=/opt/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
cat <<-EOF>> /root/.bashrc
export GOPATH=/opt/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
EOF
## Yanic Installation
go get -v -u github.com/FreifunkBremen/yanic
### Yanic cfg setzen
cd /etc
wget https://github.com/Freifunk-Nord/nord-iz-yanic-cfg/raw/master/etc/yanic.conf
###Log Files
mkdir -p /var/lib/yanic
mkdir /var/log/yanic
touch /var/log/yanic/yanic.log
touch /etc/logrotate.d/yanic
cat <<-EOF>> /etc/logrotate.d/yanic
/var/log/yanic/*.log
{
rotate 1
daily
missingok
sharedscripts
compress
postrotate
invoke-rc.d rsyslog rotate > /dev/null
endscript
}
EOF
useradd yanic
### Ausgabe Verzeichnise erstellen
mkdir -p /var/www/html/meshviewer/data/
chown yanic /var/log/yanic.log /var/lib/yanic /var/www/html/meshviewer /var/www/html/meshviewer/data
cp /opt/go/src/github.com/FreifunkBremen/yanic/contrib/init/linux-systemd/yanic.service /lib/systemd/system/
### systemd Dienst aktivieren
systemctl daemon-reload
systemctl enable yanic
systemctl start yanic
### iptables Regeln setzen
touch /etc/iptables.d/500-Allow-respondd
cat <<-EOF>> /etc/iptables.d/500-Allow-respondd
# Allow Service respondd
ip46tables -A wan-input -p udp -m udp --dport 45123 -j ACCEPT
ip46tables -A mesh-input -p udp -m udp --dport 45123 -j ACCEPT
EOF
build-firewall