This repository has been archived by the owner on Aug 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
151 lines (111 loc) · 3.74 KB
/
setup.py
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
* Copyright (C) 2017 Hendrik van Essen
*
* This file is subject to the terms and conditions of the MIT License
* See the file LICENSE in the top level directory for more details.
"""
"""setup script"""
"""
BASIC SYSTEM PRIVATE COMPUTER
sudo apt-get install python3-pip
sudo apt-get install python-pip
sudo apt-get install python-zmq
ARDUINO
sudo apt-get install minicom python3-serial
Kookye FM-70
http://kookye.com/2016/07/24/use-arduino-drive-fingerprint-sensor/
unzip and copy to <arduinosketchfolder>/libraries/
cd <arduinosketchfolder>/libraries/
git clone https://github.com/adafruit/DHT-sensor-library
git clone https://github.com/adafruit/Adafruit_Sensor
install ArduinoJson within Arduino IDE from Library Manager (Sketch -> Include Library -> Manage Libraries)
"""
"""
BASIC SYSTEM RASPBERRY PI
enable SSH
change lines in /etc/ssh/sshd_config
####################################################
PermitRootLogin no
PasswordAuthentication no
####################################################
banning ips trying to login with wrong credentials
sudo apt-get install fail2ban
DISPLAY
https://learn.adafruit.com/adafruit-2-2-pitft-hat-320-240-primary-display-for-raspberry-pi/detailed-installation
SOUND
sudo apt-get install python3-pygame
sudo apt-get install python-pygame
Dynamic DNS client with NoIP.com
(https://www.noip.com/support/knowledgebase/installing-the-linux-dynamic-update-client-on-ubuntu/)
cd /usr/local/src/
wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
tar xf noip-duc-linux.tar.gz
cd noip-2.1.9-1/
make install
Autostart noip2 on boot
sudo nano /etc/systemd/system/noip2.service
script from https://gist.github.com/NathanGiesbrecht/da6560f21e55178bcea7fdd9ca2e39b5
####################################################
[Unit]
Description=No-ip.com dynamic IP address updater
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
Alias=noip.service
[Service]
# Start main service
ExecStart=/usr/local/bin/noip2
Restart=always
Type=forking
####################################################
sudo systemctl enable noip2
sudo systemctl start noip2
APACHE
sudo a2enmod cgi
/etc/apache2/sites-available/mypidrei.ddns.net.conf
####################################
<VirtualHost *:80>
<Directory /var/www/my_pi_drei/webserver/www/>
Options +ExecCGI
DirectoryIndex index.py
</Directory>
AddHandler cgi-script .py
ServerAdmin webmaster@localhost
DocumentRoot /var/www/my_pi_drei/webserver/www/
ServerName mypidrei.ddns.net
</VirtualHost>
####################################
sudo a2ensite mypidrei.ddns.net.conf
disable indexing in /etc/apache2/apache2.conf
####################################
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
####################################
to
####################################
<Directory /var/www/>
Options -Indexes +FollowSymLinks
AllowOverride None
Require all granted
</Directory>
####################################
sudo service apache2 restart
add in /etc/hosts
####################################
127.0.0.2 mypidrei.com
####################################
You will need to forward port 80 (Webserver) and 22 (SSH, optional) in your router settings
SSL For Apache using Certbot
You will need to forward port 443 (HTTPS) in your router settings
sudo apt-get install python-certbot-apache
sudo certbot --apache -d mypidrei.ddns.net (needs user input. Recommended option "Secure"(redirection of http to https))
CONFIG
copy from webserver/config config_example and rename the copy to config.py
-> replace all placeholder in the file
"""