apt-get update; apt-get -y dist-upgrade; apt -y autoremove; apt clean; apt autoclean
root@gps1:~# cat /etc/apt/sources.list
deb http://approx.my.side/raspbian/ bullseye main contrib non-free rpi
apt clean; apt update; apt upgrade; apt dist-upgrade; apt autoremove
reboot
apt-get install snmpd
apt-get install lsof
Configure remote logging
ln -s /usr/share/zoneinfo/US/Central /etc/localtime
Set swap to 1G
vi /etc/dphys-swapfile
CONF_SWAPSIZE=1024
/etc/init.d/dphys-swapfile stop
/etc/init.d/dphys-swapfile start
/boot/cmdline.txt
dwc_otg.lpm_enable=0 console=tty1 root=PARTUUID=1d8091da-02 rootfstype=ext4 elevator=deadline fsck.repair=yes net.ifnames=0 rootwait
/boot/config.txt
#GPS Changes
enable_uart=1
init_uart_baud=57600
disable_pvt=1
dtoverlay=pps-gpio,gpiopin=21
dtoverlay=pi3-disable-bt
echo “pps-gpio” >> /etc/modules
apt-get install pps-tools
reboot
lsmod
vcgencmd measure_clock arm
apt-get install gpsd gpsd-clients
/etc/default/gpsd
DEVICES="/dev/gps0"
GPSD_OPTIONS="-n"
USBAUTO="false"
root@gps1:/etc/udev/rules.d# cat 09.gps.rules
KERNEL=="ttyAMA0", SYMLINK+="gps0"
KERNEL=="pps0", OWNER="root", GROUP="tty", MODE="0777", SYMLINK+="gpspps0"
systemctl enable gpsd
reboot
systemctl status gpsd
gpsmon /dev/gps0
ppstest /dev/pps0
reboot
systemctl disable systemd-resolved
systemctl stop systemd-resolved
systemctl status
systemctl disable dhcpcd.service
Configure /etc/network/interfaces
reboot (hope for the best)
apt-get install chrony
/etc/chrony/chrony.conf
# Source Clock
refclock PPS /dev/pps0 lock NMEA refid PPS1 prefer
refclock SHM 0 offset 0.5 refid NMEA noselect
# Internal peers
peer gps2.my.side iburst prefer
# Sanity Servers
server time1.google.com iburst
server time2.google.com iburst
server time3.google.com
server time4.google.com
# Act as an NTP server
allow XXX.XXX.XXX.XXX/XX
# Only allow chronyc from the localhost
cmdallow 127.0.0.1
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift
# Allow the system clock to be stepped in the first three updates
# if its offset is larger than 1 second.
makestep 1.0 3
# Notify on error correction > 0.5 seconds
logchange 0.5
# Enable kernel synchronization of the real-time clock (RTC).
rtcsync
# Lock clock in to RAM
lock_all
# RTS
sched_priority 1
# Fudge Stratum if we cannot reach the internet
local stratum 10
# Get TAI-UTC offset and leap seconds from the system tz database.
leapsectz right/UTC
leapsecmode slew
maxslewrate 1000
smoothtime 400 0.001 leaponly
# Specify directory for log files.
logdir /var/log/chrony
# Select which information is logged.
log measurements statistics tracking
keyfile /etc/chrony/chrony.keys
systemctl enable chrony
systemctl status chrony
systemctl restart chrony
systemctl status chrony
watch “chronyc sources -v”
General OS Setup:
apt-get install libsasl2-modules postfix bsd-mailx deborphan
Create /root/.forward
/etc/postfix/main.cf: inet_interfaces = loopback-only
apt-get install bind9 dnsutils
named.conf.local
Fail2Ban
Install custom /etc/fail2ban/jail.local
apt-get install clamav
/etc/clamav/freshclam.conf
#NotifyClamd /etc/clamav/clamd.conf
Hits: 28
#!/bin/bash
# Set GPS Module Baud Rate
echo -e “\$PMTK251,57600*2C\r\n” > /dev/ttyAMA0
# Set ttyAMA0 (parent device) Pi Baud Rate
stty -F /dev/ttyAMA0 57600 clocal cread cs8 -cstopb -parenb
# Updates NMEA Sentences (? need more info)
echo -e “\$PMTK220,200*2C\r\n” > /dev/ttyAMA0
# Restart chrony
systemctl restart chrony
Limiting NMEA sentences to only $GPZDA on the Adafruit Ultimate GPS:
echo -e ‘$PMTK314,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0*29\r\n’ > /dev/ttyS0
This needs to be done at every boot AND after every time GPSd is restarted.