-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.sh
72 lines (54 loc) · 2.21 KB
/
setup.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
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# install required packages
sudo apt add-repository ppa:mosquitto-dev/mosquitto-ppa
sudo apt update
sudo apt -y install libatlas-base-dev git python3-venv dnsmasq hostapd mosquitto mosquitto-clients
# install recommended packages
sudo apt -y install tmux nmap vim-gtk
# set up python environment
python3 -m venv fusion-env
source fusion-env/bin/activate
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
# install python packages
pip install --upgrade pip
pip install jupyter
pip install numpy
pip install bokeh
pip install paho-mqtt
#pip install platformio
# install platformio dev version as the normal version does not support python3 yet
pip install -U https://github.com/platformio/platformio-core/archive/develop.zip
# configure platformio
echo "export PATH=$PATH:~/.platformio/penv/bin" >> ~/.bash_profile
# install platformio libraries
# maybe use -g for gloabl install?
cd nodes/pio
pio lib install 31 # Adafruit Unified Sensor
pio lib install 19 # DHT sensor library
pio lib install 89 # MQTT PubSubClient library
cd ../..
# add PIO udev rules
curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/develop/scripts/99-platformio-udev.rules | sudo tee /etc/udev/rules.d/99-platformio-udev.rules
sudo service udev restart
# configure jupyter
echo "c.NotebookApp.open_browser = False" >> ~/.jupyter/jupyter_notebook_config.py
echo "c.NotebookApp.ip = '*'" >> ~/.jupyter/jupyter_notebook_config.py
echo "c.NotebookApp.port = 8888" >> ~/.jupyter/jupyter_notebook_config.py
# set up WiFi
sudo systemctl stop dnsmasq
sudo systemctl stop hostapd
sudo cp additional_files/install/dhcpcd.conf /etc/
sudo service dhcpcd restart
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
sudo cp additional_files/install/dnsmasq.conf /etc/
sudo cp additional_files/install/hostapd.conf /etc/hostapd/hostapd.conf
sudo echo "DAEMON_CONF=\"/etc/hostapd/hostapd.conf\"" >> /etc/default/hostapd
sudo systemctl start hostapd
sudo systemctl start dnsmasq
sudo cp additional_files/install/sysctl.conf /etc/
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
sudo sed '19iiptables-restore < /etc/iptables.ipv4.nat' /etc/rc.local
# access point
# existing