Raspberry Pi OS
Standard configuration
Install
- Download image here
- Enable SSH by placing a
ssh
file in the boot partition - Create
userconf.txt
in the boot partition containingusername:password
, generated usingecho 'MYPASSWORD' | openssl passwd -6 -stdin
. On Windows, you can use the Git Bash. - Boot
- Change root password with
sudo passwd
- Config with
sudo raspi-config
- Change swap size if needed - Source
- Stop swap
sudo dphys-swapfile swapoff
- Edit
sudo nano /etc/dphys-swapfile
and changeCONF_SWAPSIZE=100
- Setup new swap
sudo dphys-swapfile setup
- Start swap
sudo dphys-swapfile swapon
- Reboot
- Stop swap
Check also common Linux setup in the Linux page!
Manage IP address / DHCP
- Edit
sudo nano /etc/dhcpcd.conf
- At the bottom, uncomment and change
interface eth0
and following - If you want to use Cloudflare DNS:
static domain_name_servers=1.1.1.1 1.0.0.1 2606:4700:4700::1111 2606:4700:4700::1001
Overclock
- CPU: in
raspi-config
- SD card:
sudo bash -c 'printf "dtoverlay=sdhost,overclock_50=100\n" >> /boot/config.txt'
- Sourcesudo cat /sys/kernel/debug/mmc0/ios
to check the clock
Date & Time
Raspberry OS manage time with timedatectl
:
- Show existing date & time:
date
- Show status
timedatectl status
- Enable NTP
timedatectl set-ntp True
then restart the NTP servicesudo systemctl restart systemd-timesyncd.service
Software install
Docker
- Download
docker
install scriptcurl -sSL https://get.docker.com >> docker.sh
- Run the script
sh ./docker.sh
- Add
pi
user todocker
groupsudo usermod -aG docker pi
- Log-out and log-in
Duplicati
Install on Raspberry Pi OS
- Install Mono Framework
sudo apt install mono-complete ca-certificates-mono
- Sync certificates
sudo cert-sync /etc/ssl/certs/ca-certificates.crt
wget
the download.deb.
from the Duplicati website- Install
sudo apt install ./duplicati*.deb
orsudo dpkg -i duplicati*.deb
- Check for additional missing dependencies
sudo apt -f install
- Allow Duplicati in the firewall
sudo ufw allow 8200
- Set up Duplicati as a service
- Edit new file
sudo nano /etc/systemd/system/duplicati.service
- Copy-paste the service file content:
[Unit] Description=Duplicati After=network.target [Service] Nice=19 IOSchedulingClass=idle EnvironmentFile=-/etc/default/duplicati ExecStart=/usr/bin/duplicati-server $DAEMON_OPTS Restart=always [Install] WantedBy=multi-user.target
- Edit file
sudo nano /etc/default/duplicati
- Replace the last line of the initscript content:
DAEMON_OPTS="--webservice-interface=any --webservice-port=8200 --portable-mode"
- Enable and start the Duplicati service
sudo systemctl enable duplicati.service sudo systemctl daemon-reload sudo systemctl start duplicati.service sudo systemctl status duplicati.service
- Edit new file
- If wished, set-up system-wide backup:
- Source data:
/etc, /home, /root, /var
excluding/var/lock/, /var/run
and Temporary file - Options:
zip-compression-level: 1
- default on Linux is 6, but this slow down the Raspberry Pi - If only upload, in order to help the Raspberry Pi
asynchronous-concurrent-upload-limit:
1asynchronous-upload-limit:1
- Source data:
Sources:
- Backup Domoticz with Duplicati - Sancla
- Help with installing on Raspberry Pi - Duplicati forum
- How To Backup Nextcloud
Samba - Windows Share
- Install it
sudo apt install samba samba-common-bin
- Create a share on root directory
sudo mkdir -m 1777 /share
- 1 is sticky bit
- 777 is everyone permission to r/w/e
- Edit samba configuration
sudo nano /etc/samba/smb.conf
- Add at the bottom of the file
[share] Comment = share Path = /share Browseable = yes Writeable = Yes guest only = no create mask = 0777 directory mask = 0777 valid users = joe, greg
- This set up a r/w share only for joe and greg users
- Check all options here
- Add at the bottom of the file
- Add a user
- Create a new UNIX user
sudo adduser joe
- Add user to samba
sudo smbpasswd -a joe
- Create a new UNIX user
- Add samba to ufw exception, if you have it
sudo ufw allow Samba
- Restart samba
sudo samba restart
Create an Access Point
From this guide:
-
Install dependencies:
sudo apt install hostapd sudo systemctl unmask hostapd sudo systemctl enable hostapd sudo apt install dnsmasq sudo DEBIAN_FRONTEND=noninteractive apt install -y netfilter-persistent iptables-persistent
-
Edit
sudo nano /etc/dhcpcd.conf
:interface wlan0 static ip_address=192.168.4.1/24 static routers=192.168.4.1 static domain_name_servers=1.1.1.2 1.0.0.2 nohook wpa_supplicant
-
Edit
sudo nano /etc/sysctl.d/routed-ap.conf
and/or in/etc/sysctl.conf
:# Enable IPv4 routing net.ipv4.ip_forward=1
-
Update iptables
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE sudo netfilter-persistent save
-
Configure dnsmasq
- Copy the original file
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
-
Edit
sudo nano /etc/dnsmasq.conf
conf interface=wlan0 # Listening interface dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h # Pool of IP addresses served via DHCP domain=wlan # Local wireless DNS domain address=/gw.wlan/192.168.4.1 # Alias for this router
conf
- Copy the original file
-
sudo rfkill unblock wlan
-
Change below to your liking and update
sudo nano /etc/hostapd/hostapd.conf
country_code=GB interface=wlan0 ssid=NameOfNetwork hw_mode=g #g = 2.4 GHz, a = 5 GHz channel=7 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=AardvarkBadgerHedgehog wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP
-
sudo reboot
and enjoy!
For some troubleshooting help:
- Check
sudo systemctl status hostapd.service
,wpa_supplicant.service
anddnsmasq.service
if you have troubles - If error with
hostapd
: unmask the service, orrfkill unblock wlan
and thenrfkill list wlan
to check - If error with
dnsmasq.service:
:- Check configuration
sudo nano /etc/dnsmasq.conf
, last line should look likedhcp-option=6,1.1.1.2,1.0.0.2
and not have a,
at the end - If
DHCP packet received on wlan0 which has no address
, checkifconfig
and try to manually set the IPsudo ifconfig wlan0 192.168.4.1
- Check configuration
- If no internet on device, try to reapply firewall setting:
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE