Setup Raspberry Pi
-
Install the latest Raspberry Pi image to SD Card
-
Create a file in the boot partition called
ssh
-
Update packages
sudo apt-get update sudo apt-get upgrade sudo apt-get autoremove sudo reboot
-
Create a new user
sudo adduser epson
- Add to sudo
sudo visudo
add the lineepson ALL=(ALL) NOPASSWD:ALL
- Remove old user
sudo deluser pi
- Enable password less ssh
mkdir .ssh
- Copy contents of local
~/.ssh/id_rsa.pub
to pi~/.ssh/authorized_keys
- Fix permissions
chmod 700 .ssh; chmod 640 .ssh/authorized_keys
-
Fix the time
sudo apt-get install ntpdate sudo /etc/init.d/ntp stop sudo ntpd -q -g sudo /etc/init.d/ntp start
-
Reboot nightly
sudo vi /etc/crontab
- Add
0 5 * * * root reboot
-
Install node
uname -m
sudo apt-get install xz-utils
wget https://nodejs.org/dist/v10.16.2/node-v10.16.2-linux-armv7l.tar.xz
xz -d node-v10.16.2-linux-armv7l.tar.xz
tar xf node-v10.16.2-linux-armv7l.tar
cd node-v10.16.2-linux-armv7l
sudo cp -R bin/ include/ lib/ share/ /usr/local/
cd ..
rm -rf node-v10.16.2-linux-armv7l
sudo npm install -g npm
-
Install node-pi-rs232
-
sudo su -
(npm install requires being root and not just sudo) apt-get install git
cd /opt
git clone https://github.com/joeferner/node-pi-rs232.git
cd /opt/node-pi-rs232
npm install
- Autostart, add
/opt/node-pi-rs232/run.sh > /dev/null 2>&1 &
to/etc/rc.local
-
-
Change pi to readonly mode (see https://github.com/adafruit/Raspberry-Pi-Installer-Scripts/blob/master/read-only-fs.sh)
scp read-only-fs.sh 192.168.0.161:
sudo bash read-only-fs.sh
- Enable boot-time read/write jumper?
y
- GPIO pin for R/W jumper:
21
- Install GPIO-halt utility?
n
- Enable kernel panic watchdog?
y