Raspberry Pi Server

Technical

Posted by Sam Bartle on 22 April 2019

List of Installed Software and its role.

  • PiVPN (http://www.pivpn.io) - Setup script and easy management for OpenVPN to allow remote access to my home network, along with secure VPN when using untrusted WiFi networks.
  • Samba - Creates a share for my Windows machines to backup to a 3TB Seagate USB drive.
  • fr24feed/dump1090 - Uses a DVB-T TV Stick and an antenna to collect ADS-B Broadcast
  • ser2net - Serial Port to Network Forwarding, allows me to configure my burglar alarm over the LAN without needing the £190 adapter
  • OpenSSH - Tunnelling, Management and Maintenance access.
  • neofetch - To provide the flash Message of the Day screen output and the Pi Logo on login.
  • inadyn - To update my Dynamic DNS hosts to allow access from outside using a specified hostname.
  • Pi-Hole - Ad Blocking DNS server for my network.

Installing

PiVPN

PiVPN's installer is very simply, simply SSH into the Pi and run the following: curl -L https://install.pivpn.io | bash

Flightradar 24 (fr24feed)

Flightradar 24 can be installed by running: sudo bash -c "$(wget -O - https://repo-feed.flightradar24.com/install_fr24_rpi.sh)" It may be necessary to install dump1090 first manually as it sometimes fails when installed with the fr24feed install script.

neofetch

apt-get install newfetch

inadyn

apt-get install inadyn

Pi-Hole

Pi-Hole is equally as easy to install as PiVPN (for good reason PiVPN's installer is based on Pi-Holes), SSH in and run: curl -sSL https://install.pi-hole.net | bash

OpenSSH

You can enable the SSH server with the Pi setup script. You then just need to add any client keys to the ~/.ssh/authorized_keys file per user. You should then chmod the file to 600 (chmod 600 ~/.ssh/authorized_keys)

ser2net

apt-get install ser2net

Samba

apt-get install samba

Configuring

Configure PiVPN to use PiHole as default DNS server for clients.

  • SSH into the Pi
  • sudo nano /etc/openvpn/server.conf
  • Remove all the dhcp-option lines pointing to the existing DNS servers.
  • Add a single line: push "dhcp-option DNS 10.8.0.1"
  • Save and Quit
  • sudo nano /etc/pihole/setupVars.conf
  • Add "PIHOLE_INTERFACE=tun0" belowe the "PIHOLE_INTERFACE=eth0" line.
  • Save and Quit
  • sudo nano /etc/dnsmasq.d/02-ovpn.conf
  • Add "interface=tun0"
  • Save and Quit
  • Reboot

Configuring the Login MOTD

  • cd /etc/update-motd.d/
  • nano 10-neofetch
    #!/bin/sh
    neofetch
  • nano 20-uname
    #!/bin/sh
    uname -snrvm

Configuring Inadyn

# /etc/inadyn.conf
logfile /var/log/inadyn/inadyn.log
# Or use the system syslog mechanism for log messages
# syslog
verbose 1
period 300
# Set interface to bind to
# bind eth3
# Set interface to check for IP
# iface eth1
# Full path to external command, or script, to run after a successful DDNS update
# exec /usr/local/bin/script.sh

# FreeDNS.afraid.org
system [email protected]
username <username>
password <password>
alias <hostname>

Configuring ser2net

I have a USB Serial adapter, connected to a Texecom Burglar alarm, which I can connect to over the network using ser2net to forward the serial data over TCP/IP to the Texecom Wintex software.

#Texecom Alarm
7000:raw:0:/dev/ttyUSB1:19200 8DATABITS NONE 2STOPBITS