A DIY home automation and security project
The security PI is used as a NAS/FTP for IP cameras to store video and a application server for the AtHome app to communicate with. All security related devices are setup on an isolated LAN.
- Change password
- Enable SSH
- Change host name
- enable Wifi to connect to primary network
- setup static IP for isolated LAN
- update apt-get - sudo apt-get update
- Create user and user groups
- Configure storage
- Setup FTP server
- Install dotnet SDK
- Install git - sudo apt-get install git
- Install ffmpeg - sudo apt-get install ffmpeg
- Install ngrok
Add the follow to dhcpcd.conf - sudo nano /etc/dhcpcd.conf
# Static LAN for security Devices
interface eth0
static ip_address=192.168.55.100/24
Here we will create a user group called hometeam and a user called homer
sudo groupadd hometeam
sudo useradd homer -g hometeam -s /sbin/nologin -d /dev/null
sudo adduser pi hometeam
Mount storage used to store camera recordings.
https://askubuntu.com/questions/154180/how-to-mount-a-new-drive-on-startup
If you have already created a disk partition and file system skip to step 9
- Run sudo fdisk /dev/sdb
- Press O and press Enter (creates a new table)
- Press N and press Enter (creates a new partition)
- Press P and press Enter (makes a primary partition)
- Then press 1 and press Enter (creates it as the 1st partition)
- Finally, press W (this will write any changes to disk).
- Exit fdisk tool
- sudo mkfs.ext4 /dev/sda1
- Add the text below to fstab - sudo nano /etc/fstab
#device mountpoint fstype options dump fsck
/dev/sda1 /media/secure-data/ ext4 defaults 0 1
- sudo reboot
sudo chown -R homer:hometeam /media/secure-data
sudo chmod -R 774 /media/secure-data
sudo rm -r /media/secure-data/lost+found
mkdir /media/secure-data/live
mkdir /media/secure-data/archive
https://www.raspberrypi.org/documentation/remote-access/ftp.md
sudo apt install pure-ftpd
# -u and -g values are ids for the homer user and hometeam group
sudo pure-pw useradd homer -u 1001 -g 1001 -d /media/secure-data/live -m
sudo pure-pw mkdb
sudo ln -s /etc/pure-ftpd/conf/PureDB /etc/pure-ftpd/auth/60puredb
sudo service pure-ftpd restart
Manual dotnet install
cd ~
wget https://download.visualstudio.microsoft.com/download/pr/dbf4ea18-70bf-4b0f-ae9c-65c8c88bcadd/115e84fb95170ddeeaf9bdb9222c964d/dotnet-sdk-3.1.301-linux-arm.tar.gz
mkdir /usr/share/dotnet
sudo chown -R pi:hometeam /usr/share/dotnet
tar zxf dotnet-sdk-3.1.301-linux-arm.tar.gz -C /usr/share/dotnet
Add dotnet to PATH - nano ~/.bashrc
export DOTNET_ROOT=/usr/share/dotnet
export PATH=$PATH:/usr/share/dotnet
wget -O ngrok.zip https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-arm.zip
unzip ngrok.zip
rm ngrok.zip
sudo mv ngrok /usr/local/bin
# Get token from https://dashboard.ngrok.com/auth/your-authtoken
ngrok authtoken <YOUR_AUTH_TOKEN>