Raspberry Pi - a-maze-1ng/MISC GitHub Wiki
1. - Software recommendations
Program | Application | Link |
---|---|---|
SD Card Formatter | Format SD Cards | https://www.sdcard.org/downloads/formatter/ |
Balena Etcher | Flash OS images to SD cards | https://www.balena.io/etcher/ |
Win32DiskImager | write a raw disk image to a removable device or backup a removable device | https://sourceforge.net/projects/win32diskimager/ |
Putty | PuTTY is an SSH and telnet client | https://www.putty.org/ |
WinSCP | WinSCP is a SFTP client and FTP client | https://winscp.net/eng/download.php |
2. - Standard Setup
2.1 - Use RPi-Imager
Select Menu and set user, password, ssh and WiFi (optional)
pi//raspberry user//password does not work anymore!
create pi as a standard user! see pihole
2.2 - Manual setup
2.2.1 - Wifi connection
- create
wpa_supplicant.conf
in/boot
- use any text editor and edit the
wpa_supplicant.conf
file and add:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=DE
network={
scan_ssid=1
ssid="SSID"
psk="PASSWORD"
key_mgmt=WPA-PSK
}
2.2.2 - Activate SSH connection
- create a file
ssh
in/boot
2.2.3 - Change Timezone and Hostname
- Use Putty and the RPi IP-adress to connect via SSH
raspi-config
- Change Timezone and setup a new Hostname
2.2.4 - Change standard password
passwd
sudo passwd
2.2.5 - Update the all installed packages
sudo apt-get update && sudo apt-get upgrade -y && sudo apt autoremove -y && clear
2.2.6 - Cron job
crontab -e
if the script should run as pi usersudo crontab -e
if the script should run with root privileges
example:
#variables
home_dir = /home/pi/scripts/
logfile_dir = /home/pi/logfiles/
timestamp=date +20%y_%m_%d_%H_%M_%S
# update pihole system at reboot
@reboot python ${home_dir}update_pihole.py >> ${logfile_dir}log_update_pihole_reboot_$(${timestamp}).log 2>&1
# update pihole system every 7days at 3am
0 3 */7 * * python ${home_dir}update_pihole.py >> ${logfile_dir}log_update_pihole_7days_$(${timestamp}).log 2>&1
get full cron log
cd /var/log
cat syslog.1 syslog | grep CRON
https://askubuntu.com/questions/222512/cron-info-no-mta-installed-discarding-output-error-in-the-syslog
This version works flawless!
0 3 * * * cmd >> /some/log/file 2>&1
example:
#every 7days at 3:00 + write to a logfile
0 3 */7 * * python /home/pi/test.py >> /home/pi/test.log 2>&1
3. - Pihole
Achtung es muss ein Nutzer Pi vorhanden sein!
Seit einiger Zeit muss über den RaspberryPi Imager explizit ein Nutzer vergeben werden!
https://pi-hole.net/
3.1 - Pihole customized block page
nano /etc/pihole/pihole-FTL.conf
- add
BLOCKINGMODE=IP
to file
3.2 - Unbound root hints
wget https://www.internic.net/domain/named.root -qO- | sudo tee /var/lib/unbound/root.hints
3.3 - For Android ads
Youtube Link
Android apps are allowed by default to use an own DNS-server.
A workaround is to block port 53 and 853 on the Router
Block Port 53 and 853 @Fritz!Box
Internet -> Filter -> Listen -> Netzwerkanwendung (Dropdown-Menü)
3.4 - Pihole DNS @ Fritz!Box
Internet -> Zugangsdaten -> DNS-Server
Heimnetz -> Netzwerk -> Netzwerkeinstellungen -> IPv4-Einstellungen
3.5 - Dynamic DNS with noip
Free service: NoIP
- register and setup
4. - OpenVPN
Tutorial (sempervideo):
Video 2
Video 3
Video 4
Install for RPi:
https://github.com/Nyr/openvpn-install
Achtung: die noip adresse als public ip angeben [email protected]
4.1 - Unblock ports for VPN @Fritz!Box
4.2 - Install NoIP (DUC) dynamic update client
4.3 - Start NoIP (DUC) dynamic update client automatically
nano /etc/rc.local
- add
/usr/local/bin/noip2 &
beforeexit 0
5 - Backup Raspberry Pi SD Card
- Close GoogleDrive Application
- Use Win32DiskImager
- Create .img from SD-Card
- Compress .img file in the .bz2 format (e.g.) with 7-zip