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.confin/boot - use any text editor and edit the
wpa_supplicant.conffile 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
sshin/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
passwdsudo 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 -eif the script should run as pi usersudo crontab -eif 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
5 - Home Assistant
Größe SD-Karte: 64GB
6 - 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