Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
| raspberry_pi_4 [2024/11/30 16:49] – removed - external edit (Unknown date) 127.0.0.1 | raspberry_pi_4 [2024/11/30 16:49] (current) – ↷ Page name changed from raspberry_pi to raspberry_pi_4 admin | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Raspberry Pi 4 ====== | ||
| + | {{tag> | ||
| + | ===== Python-Pandas-Plotly ===== | ||
| + | Path: / | ||
| + | |||
| + | < | ||
| + | docker build -t python-pandas-plotly -f Dockerfile . | ||
| + | docker run -d --name Python-Pandas-Plotly -p 5000:5000 -it python-pandas-plotly | ||
| + | |||
| + | docker exec -it Python-Pandas-Plotly /bin/bash | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== DB Load and Backup ===== | ||
| + | ==== DB Load ==== | ||
| + | < | ||
| + | $ cat / | ||
| + | #!/bin/bash | ||
| + | |||
| + | sleep $[ ( $RANDOM % 720 ) + 1 ]s | ||
| + | |||
| + | python3 / | ||
| + | python3 / | ||
| + | python3 / | ||
| + | |||
| + | tail / | ||
| + | |||
| + | docker exec FW_PostgreSQL /bin/bash -c / | ||
| + | |||
| + | sleep 20 | ||
| + | |||
| + | mail -s "DB Load logs - `date +%Y-%m-%d`" | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | $ cat / | ||
| + | #!/bin/sh | ||
| + | # @author: | ||
| + | # @description: | ||
| + | # @FoundAt: | ||
| + | |||
| + | |||
| + | # FTP LOGIN | ||
| + | HOST=' | ||
| + | USER=' | ||
| + | PASSWORD=' | ||
| + | |||
| + | # DISTANT DIRECTORY | ||
| + | REMOTE_DIR='/ | ||
| + | |||
| + | #LOCAL DIRECTORY | ||
| + | LOCAL_DIR='/ | ||
| + | |||
| + | # RUNTIME! | ||
| + | echo | ||
| + | echo " | ||
| + | date | ||
| + | |||
| + | lftp -u " | ||
| + | set ftp: | ||
| + | set ftp: | ||
| + | set ssl: | ||
| + | # transfer starts now... | ||
| + | lcd $LOCAL_DIR | ||
| + | cd $REMOTE_DIR | ||
| + | mput -P 4 *.html | ||
| + | exit | ||
| + | EOF | ||
| + | echo | ||
| + | echo " | ||
| + | date | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | $ cat / | ||
| + | #!/bin/bash | ||
| + | |||
| + | echo -e " | ||
| + | echo "SET TIMEZONE=' | ||
| + | </ | ||
| + | |||
| + | ==== Backup ==== | ||
| + | < | ||
| + | # cat / | ||
| + | #!/bin/bash | ||
| + | |||
| + | pg_dumpall > / | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | $ cat / | ||
| + | #!/bin/bash | ||
| + | |||
| + | docker exec -it FW_PostgreSQL /bin/bash -c / | ||
| + | |||
| + | sudo rsync -av / | ||
| + | |||
| + | # Do we want to gzip all the files? | ||
| + | # sudo find . -maxdepth 1 -type f ! -name ' | ||
| + | |||
| + | mail -s " | ||
| + | </ | ||
| + | |||
| + | === Permissions fix === | ||
| + | < | ||
| + | postgres@482ecde1f1c1:/ | ||
| + | drwxr-xr-x | ||
| + | |||
| + | root@rpi64: | ||
| + | |||
| + | root@rpi64: | ||
| + | |||
| + | postgres@482ecde1f1c1:/ | ||
| + | |||
| + | postgres@482ecde1f1c1:/ | ||
| + | drwxr-xr-x | ||
| + | </ | ||
| + | |||
| + | === Alternate solution (still incomplete) === | ||
| + | /etc/fstab | ||
| + | < | ||
| + | // | ||
| + | </ | ||
| + | |||
| + | ==== crontab ==== | ||
| + | < | ||
| + | $ crontab -l | ||
| + | 25 6 * * * / | ||
| + | 00 8 * * * / | ||
| + | |||
| + | # FreeDNS update | ||
| + | 4,24,44 * * * * sleep 37 ; wget -O - http:// | ||
| + | </ | ||
| + | |||
| + | ===== NGINX (Cloud) ===== | ||
| + | / | ||
| + | < | ||
| + | version: ' | ||
| + | services: | ||
| + | app: | ||
| + | image: ' | ||
| + | container_name: | ||
| + | restart: unless-stopped | ||
| + | ports: | ||
| + | - ' | ||
| + | - ' | ||
| + | - ' | ||
| + | volumes: | ||
| + | - ./ | ||
| + | - ./ | ||
| + | </ | ||
| + | Console | ||
| + | < | ||
| + | docker exec -it -u 0 nginx /bin/bash | ||
| + | </ | ||
| + | / | ||
| + | < | ||
| + | #!/bin/bash | ||
| + | |||
| + | SCRIPT_DIR=" | ||
| + | echo " | ||
| + | |||
| + | docker ps --format " | ||
| + | docker ps -a --format " | ||
| + | docker image ls | grep -i nginx | awk ' | ||
| + | |||
| + | cd $SCRIPT_DIR | ||
| + | docker-compose build; docker-compose up -d | ||
| + | </ | ||
| + | / | ||
| + | < | ||
| + | #!/bin/bash | ||
| + | |||
| + | SCRIPT_DIR=" | ||
| + | echo " | ||
| + | |||
| + | docker ps --format " | ||
| + | docker ps -a --format " | ||
| + | |||
| + | cd $SCRIPT_DIR | ||
| + | docker-compose build; docker-compose up -d | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Mail ===== | ||
| + | < | ||
| + | # apt-get install mailutils | ||
| + | </ | ||
| + | |||
| + | ===== exim4 ===== | ||
| + | < | ||
| + | # dpkg-reconfigure exim4-config | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | $ sudo cat / | ||
| + | |||
| + | dc_eximconfig_configtype=' | ||
| + | dc_other_hostnames=' | ||
| + | dc_local_interfaces=' | ||
| + | dc_readhost=' | ||
| + | dc_relay_domains='' | ||
| + | dc_minimaldns=' | ||
| + | dc_relay_nets='' | ||
| + | dc_smarthost=' | ||
| + | CFILEMODE=' | ||
| + | dc_use_split_config=' | ||
| + | dc_hide_mailname=' | ||
| + | dc_mailname_in_oh=' | ||
| + | dc_localdelivery=' | ||
| + | root@rpi64: | ||
| + | </ | ||
| + | < | ||
| + | $ sudo cat / | ||
| + | |||
| + | # password file used when the local exim is authenticating to a remote | ||
| + | # host as a client. | ||
| + | # | ||
| + | # see exim4_passwd_client(5) for more documentation | ||
| + | # | ||
| + | # Example: | ||
| + | ### target.mail.server.example: | ||
| + | seanys.com: | ||
| + | </ | ||
| + | |||
| + | ==== References ==== | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | |||
| + | ==== DNS Utils ==== | ||
| + | < | ||
| + | sudo apt-get install dnsutils | ||
| + | </ | ||
| + | |||
| + | ===== Python bits ===== | ||
| + | < | ||
| + | $ sudo apt-get install python3-pip | ||
| + | $ sudo pip3 install config plotly pandas icecream feedparser psycopg2 sqlalchemy | ||
| + | </ | ||
| + | ...and maybe | ||
| + | < | ||
| + | $ sudo apt install python3-psycopg2 | ||
| + | </ | ||
| + | |||
| + | ===== Mount USB ===== | ||
| + | Just skip the " | ||
| + | ==== References ==== | ||
| + | How to format and mount a USB drive on Raspberry Pi? - [[https:// | ||
| + | |||
| + | ===== SWAP resize ===== | ||
| + | < | ||
| + | sudo dphys-swapfile swapoff | ||
| + | free | ||
| + | | ||
| + | Mem: | ||
| + | Swap: 0 | ||
| + | |||
| + | sudo nano / | ||
| + | sudo dphys-swapfile setup | ||
| + | want / | ||
| + | sudo dphys-swapfile swapon | ||
| + | sudo reboot | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== ZRAM (not used on RPi64) ===== | ||
| + | ZRAM is a RAM based compressed, swap mem kernel module | ||
| + | < | ||
| + | # remove the old dphys version | ||
| + | $ sudo / | ||
| + | $ sudo apt-get remove --purge dphys-swapfile | ||
| + | # install zram | ||
| + | $ sudo wget -O / | ||
| + | # set autoload | ||
| + | $ sudo nano / | ||
| + | # add the next line before exit 0 | ||
| + | / | ||
| + | # save with < | ||
| + | |||
| + | $ sudo chmod +x / | ||
| + | $ sudo nano / | ||
| + | # alter the limit with * 2 | ||
| + | mem=$(( ($totalmem / $cores)* 1024 * 2)) | ||
| + | # save with < | ||
| + | $ sudo reboot | ||
| + | </ | ||
| + | |||
| + | ===== Docker and Docker-Compose ===== | ||
| + | < | ||
| + | curl -sSL https:// | ||
| + | sudo usermod -aG docker pi | ||
| + | sudo apt-get install libffi-dev libssl-dev | ||
| + | sudo apt install python3-dev | ||
| + | sudo apt-get install -y python3 python3-pip | ||
| + | sudo pip3 install docker-compose | ||
| + | sudo systemctl enable docker | ||
| + | </ | ||
| + | |||
| + | ==== References ==== | ||
| + | * Install 64 bit OS on Raspberry Pi 4 + USB boot - https:// | ||
| + | * How To Install Docker and Docker-Compose On Raspberry Pi - https:// | ||
| + | |||
| + | ===== Format a USB-connected drive ===== | ||
| + | < | ||
| + | fdisk /dev/sdb | ||
| + | mkfs -t ext4 /dev/sdb1 | ||
| + | mount /dev/sdb1 /media/ssd/ | ||
| + | </ | ||
| + | ==== References ==== | ||
| + | * Mount ext4 USB flash drive to Raspberry Pi - https:// | ||
| + | * Disk Inspector: Retrieving and setting hard drive parameters with hdparm - https:// | ||
| + | |||
| + | ===== Apache2 / PHP ===== | ||
| + | ==== Apache 2 ==== | ||
| + | < | ||
| + | apt install apache2 -y | ||
| + | usermod -a -G www-data pi | ||
| + | chown -R -f www-data: | ||
| + | </ | ||
| + | |||
| + | ==== PHP ==== | ||
| + | === 7 === | ||
| + | < | ||
| + | apt install php7.4 libapache2-mod-php7.4 php7.4-mbstring php7.4-mysql php7.4-curl php7.4-gd php7.4-zip php7.4-xml -y | ||
| + | </ | ||
| + | === 8.1 === | ||
| + | < | ||
| + | curl https:// | ||
| + | echo "deb [signed-by=/ | ||
| + | sudo apt update | ||
| + | sudo apt install php8.1-cli | ||
| + | </ | ||
| + | |||
| + | ==== References ==== | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | |||
| + | ===== GitList ===== | ||
| + | < | ||
| + | wget https:// | ||
| + | unzip gitlist-2.0.0.zip | ||
| + | cd | ||
| + | </ | ||
| + | < | ||
| + | rsync -av / | ||
| + | mkdir / | ||
| + | chown www-data.www-data / | ||
| + | nano config.ini-example | ||
| + | </ | ||
| + | < | ||
| + | diff config.ini config.ini-example | ||
| + | 4c4 | ||
| + | < repositories[] = '/ | ||
| + | --- | ||
| + | > repositories[] = '/ | ||
| + | |||
| + | </ | ||
| + | ===== Argon ONE ===== | ||
| + | ==== ARGON ONE Pi 4 Power Button Functions ==== | ||
| + | The following chart will help with the Power button functions. Once the script is installed, it will work with Pi OS 32/64-Bit and within RetroPie. | ||
| + | |||
| + | ^ PI 4 STATE ^ ACTION ^ FUNCTION | ||
| + | |OFF |Short Press |Turn ON| | ||
| + | |ON |Long Press (>= 3s) |Soft Shutdown and Power Cut| | ||
| + | |ON |Short press (< | ||
| + | |ON |Double tap |Reboot| | ||
| + | |ON |Long Press (>= 5s) |Forced Shutdown| | ||
| + | |||
| + | ==== Fan control script ==== | ||
| + | |||
| + | Installation | ||
| + | < | ||
| + | curl https:// | ||
| + | </ | ||
| + | |||
| + | Run | ||
| + | < | ||
| + | argonone-config | ||
| + | -------------------------------------- | ||
| + | Argon One Fan Speed Configuration Tool | ||
| + | -------------------------------------- | ||
| + | WARNING: This will remove existing configuration. | ||
| + | Press Y to continue:y | ||
| + | Thank you. | ||
| + | |||
| + | Select fan mode: | ||
| + | 1. Always on | ||
| + | 2. Adjust to temperatures (55C, 60C, and 65C) | ||
| + | 3. Customize behavior | ||
| + | 4. Cancel | ||
| + | NOTE: You can also edit / | ||
| + | Enter Number (1-4):3 | ||
| + | |||
| + | Please provide fan speeds and temperature pairs | ||
| + | |||
| + | Provide minimum temperature (in Celsius) then [ENTER]:44 | ||
| + | Provide fan speed for 44C (0-100) then [ENTER]:20 | ||
| + | * Fan speed will be set to 20 once temperature reaches 44 C | ||
| + | |||
| + | Provide minimum temperature (in Celsius) then [ENTER]:54 | ||
| + | Provide fan speed for 54C (0-100) then [ENTER]:45 | ||
| + | * Fan speed will be set to 45 once temperature reaches 54 C | ||
| + | |||
| + | Provide minimum temperature (in Celsius) then [ENTER]:65 | ||
| + | Provide fan speed for 65C (0-100) then [ENTER]:65 | ||
| + | * Fan speed will be set to 65 once temperature reaches 65 C | ||
| + | |||
| + | Provide minimum temperature (in Celsius) then [ENTER]:75 | ||
| + | Provide fan speed for 75C (0-100) then [ENTER]:100 | ||
| + | * Fan speed will be set to 100 once temperature reaches 75 C | ||
| + | |||
| + | Provide minimum temperature (in Celsius) then [ENTER]: | ||
| + | |||
| + | Thank you! We saved 4 pairs. | ||
| + | Changes should take effect now. | ||
| + | |||
| + | </ | ||
| + | |||
| + | Settings before and after crash prevention attempt | ||
| + | < | ||
| + | $ cat / | ||
| + | # | ||
| + | # Argon One Fan Speed Configuration | ||
| + | # | ||
| + | # Min Temp=Fan Speed | ||
| + | 48=15 | ||
| + | 55=45 | ||
| + | 65=65 | ||
| + | 75=100 | ||
| + | $ cat / | ||
| + | # | ||
| + | # Argon One Fan Speed Configuration | ||
| + | # | ||
| + | # Min Temp=Fan Speed | ||
| + | 44=20 | ||
| + | 54=45 | ||
| + | 65=65 | ||
| + | 75=100 | ||
| + | </ | ||
| + | |||
| + | ==== References ==== | ||
| + | * Install Argon ONE Scripts in Pi OS (32/64-bit) - http:// | ||
| + | |||
| + | ===== Azure SQL Edge ===== | ||
| + | docker-compose.yml | ||
| + | < | ||
| + | # docker-compose.yml: | ||
| + | version: ' | ||
| + | services: | ||
| + | mssql: | ||
| + | image: mcr.microsoft.com/ | ||
| + | container_name: | ||
| + | user: root | ||
| + | restart: always | ||
| + | environment: | ||
| + | ACCEPT_EULA: | ||
| + | MSSQL_SA_PASSWORD: | ||
| + | volumes: | ||
| + | - ./ | ||
| + | - ./ | ||
| + | - ./ | ||
| + | ports: | ||
| + | - 1433:1433 | ||
| + | </ | ||
| + | ==== References ==== | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | |||
| + | ===== Temperature reading on Webmin ===== | ||
| + | < | ||
| + | sudo apt install lm-sensors | ||
| + | </ | ||
| + | |||
| + | ===== RPiMonitor ===== | ||
| + | < | ||
| + | sudo apt-get install dirmngr | ||
| + | sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 2C0D3C0F | ||
| + | sudo wget http:// | ||
| + | sudo apt-get update | ||
| + | sudo apt-get install rpimonitor | ||
| + | sudo / | ||
| + | </ | ||
| + | ==== Modifications ==== | ||
| + | / | ||
| + | < | ||
| + | include=/ | ||
| + | </ | ||
| + | / | ||
| + | < | ||
| + | ... | ||
| + | static.8.source=df / | ||
| + | static.8.regexp=\S+\s+(\d+).*\/ | ||
| + | ... | ||
| + | dynamic.7.source=df / | ||
| + | dynamic.7.regexp=\S+\s+\d+\s+(\d+).*\/ | ||
| + | ... | ||
| + | </ | ||
| + | |||
| + | ==== Restart ==== | ||
| + | < | ||
| + | sudo service rpimonitor restart | ||
| + | </ | ||
| + | |||
| + | ==== References ==== | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | |||
| + | |||
| + | ===== Calibre (stopped, waste of time) ===== | ||
| + | /etc/fstab | ||
| + | < | ||
| + | // | ||
| + | </ | ||
| + | |||
| + | ==== Add content ==== | ||
| + | Beware: copies files into " | ||
| + | < | ||
| + | xvfb-run calibredb add / | ||
| + | </ | ||
| + | |||
| + | ==== Run server ==== | ||
| + | < | ||
| + | calibre-server --with-library ~/ | ||
| + | </ | ||
| + | ==== References ==== | ||
| + | * [[https:// | ||
| + | |||
| + | |||
| + | ===== SWAP ===== | ||
| + | < | ||
| + | sudo dphys-swapfile swapoff | ||
| + | sudo nano / | ||
| + | sudo dphys-swapfile swapon | ||
| + | </ | ||
| + | |||
| + | ==== References ==== | ||
| + | [[https:// | ||
| + | ===== Fixes ===== | ||
| + | * How to fix raspi-config “The splash screen is not installed so cannot be activated” - https:// | ||
| + | * STICKY: If you have a Raspberry Pi 4 and are getting bad speeds transferring data to/from USB3.0 SSDs, read this - https:// | ||
| + | * [[https:// | ||
| + | |||
| + | ===== References ===== | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | |||
| + | ===== Install logs ===== | ||
| + | * [[sendmail]] | ||
| + | * [[Install X Window|X Window]] | ||
| + | * [[Install exim4|exim4]] | ||
| + | * [[apt autoremove 2021-04-26]] | ||
| + | * [[RPi 3b+ EEPROM update]] | ||
| + | * [[RPi 4 EEPROM update]] | ||