-
Notifications
You must be signed in to change notification settings - Fork 2
/
SETUP
81 lines (62 loc) · 2.54 KB
/
SETUP
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
# Door sensor and website both take config from `/etc/doorpi`, which
# consists of the database host, user, password, and database name
# separated by newlines.
# The current configuration uses a SQL database from Scripts that is
# owned by the locker sipb-door. To set up a new database, run the
# following command:
# """
# CREATE TABLE door_status (
# timestamp BIGINT UNSIGNED NOT NULL PRIMARY KEY,
# status BOOLEAN NOT NULL
# );
# """
# Note that the timestamp field stores nanoseconds from the Unix epoch,
# and that status=True means the door was closed at that moment in time.
# SETUP INSTRUCTIONS FOR UBUNTU SERVER 22.04 LTS
# Download image from <https://ubuntu.com/download/raspberry-pi/thank-you?version=22.04&architecture=server-arm64+raspi>
# Flash to MicroSD card
# Boot and wait until ubuntu user is generated (it can take a while)
# Login as ubuntu:ubuntu
# Change root password to office root
passwd root
# Relogin as root
deluser --remove-home ubuntu
snap remove lxd
snap remove core20
snap remove snapd
apt remove snapd
rm -rf ~/snap
dpkg-reconfigure cloud-init
# Uncheck everything except for "None"
apt purge cloud-init
rm -rf /etc/cloud /var/lib/cloud
apt remove netplan.io
rm -rf /usr/share/netplan /etc/netplan
echo "[Match]" >> /etc/systemd/network/10-eth0.network
echo "Name=eth0" >> /etc/systemd/network/10-eth0.network
echo "" >> /etc/systemd/network/10-eth0.network
echo "[Network]" >> /etc/systemd/network/10-eth0.network
echo "LinkLocalAddressing=ipv4" >> /etc/systemd/network/10-eth0.network
echo "Address=10.187.2.56/16" >> /etc/systemd/network/10-eth0.network
echo "DNS=8.8.8.8" >> /etc/systemd/network/10-eth0.network
echo "DNS=8.8.4.4" >> /etc/systemd/network/10-eth0.network
echo "" >> /etc/systemd/network/10-eth0.network
echo "[Route]" >> /etc/systemd/network/10-eth0.network
echo "Destination=0.0.0.0/0" >> /etc/systemd/network/10-eth0.network
echo "Gateway=10.187.0.1" >> /etc/systemd/network/10-eth0.network
networkctl reload
vim /etc/ssh/sshd_config
# Change to "PermitRootLogin yes"
vim /etc/default/motd-news
# Change to ENABLED=0
chmod -x /etc/update-motd.d/10-help-text
timedatectl set-timezone America/New_York
# Seems to be necessary to get everything to acknowledge the timezone change
reboot
git clone https://github.com/sipb/doorpi2
echo "sql.mit.edu" >> /etc/doorpi
echo "sipb-door" >> /etc/doorpi
echo "<PASSWORD>" >> /etc/doorpi
echo "sipb-door+doorpi" >> /etc/doorpi
apt install python3-gpiozero python3-pymysql uwsgi python3-flask uwsgi-plugin-python3 nginx
# Follow instructions in SETUP files for sensor and web