Boot without the monitor 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 echo '' ' ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=CN network={ ssid="xxx" psk="xxx" } ' '' > wpa_supplicant.confsudo raspi-config sudo iwconfig wlan1 txpower off
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 sudo apt -y update sudo apt -y upgrade sudo apt -y install rpi-eeprom sudo rpi-eeprom-update sudo rpi-eeprom-update -a sudo apt-get install zsh sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh) " sudo apt -y install vim sudo chsh -s /bin/zsh curl -sSL https://install.pi-hole.net | bash curl -L https://install.pivpn.io | bash pivpn add pivpn remove pivpn list pivpn -qr
Passwordless SSH access 1 2 3 4 5 6 7 8 9 cd ~/.sshssh-keygen cat raspberrypi.pub cat ~/.ssh/raspberrypi.pub | ssh pi@192.168.2.2 'mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys' chmod g-w $HOME chmod 700 $HOME /.ssh chmod 600 $HOME /.ssh/authorized_keys
Static IP address 1 2 3 4 5 6 interface eth0 static ip_address=192.168.0.4/24 static routers=192.168.0.254 static domain_name_servers=192.168.0.254 8.8.8.8
AdGuard 1 2 3 4 5 6 7 8 9 10 cd $HOME wget https://static.adguard.com/adguardhome/release/AdGuardHome_linux_armv6.tar.gz tar xvf AdGuardHome_linux_armv6.tar.gz sudo setcap 'CAP_NET_BIND_SERVICE=+eip CAP_NET_RAW=+eip' ./AdGuardHome @reboot /home/pi/AdGuardHome/AdGuardHome &
clash 1 2 3 4 5 6 wget https://github.com/Dreamacro/clash/releases/download/v1.5.0/clash-linux-armv7-v1.5.0.gz tar xzvf clash-linux-armv7-v1.5.0.gz @reboot /home/pi/clash-linux-armv7 &
VNC https://magpi.raspberrypi.org/articles/vnc-raspberry-pi
Rclone & Google Drive 1 2 3 4 5 6 7 8 9 10 sudo apt -y install fuse curl -L https://raw.github.com/pageauc/rclone4pi/master/rclone-install.sh | bash rclone config mkdir -p /tmp/gdrive fusermount -u /tmp/gdrive sudo vim /etc/fuse.conf
Auto Mount 1 2 3 4 5 6 7 8 9 10 11 sudo blkid UUID=633a8bc8 /media/3T ext4 defaults,auto,users,rw,nofail 0 0 UUID=d271d018 /media/TM ext4 defaults,auto,users,rw,nofail 0 0 UUID=53f3ce6b /media/8G ext4 defaults,auto,users,rw,nofail 0 0 sudo chown -R pi:pi /media/3T /media/TM
Ramdisk & Logs 1 2 3 4 5 6 7 8 9 tmpfs /var/lib/plexmediaserver tmpfs defaults,noatime 0 0 tmpfs /home/pi./cache tmpfs defaults,noatime 0 0 tmpfs /tmp tmpfs defaults,noatime 0 0 tmpfs /var/log tmpfs defaults,noatime 0 0
Fix Ext4 sudo fsck.ext4 -vfy /dev/sda2
Swap space on an external hard drive 1 2 3 4 sudo vim /etc/dphys-swapfile CONF_SWAPFILE=/media/3T/swapfile CONF_SWAPSIZE=8192
AFP & Time Machine 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 sudo apt -y install netatalk gparted sudo vim /etc/netatalk/afp.conf sudo systemctl restart netatalk
Samba 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 sudo apt-get install samba samba-common-bin sudo vim /etc/samba/smb.conf sudo smbpasswd -a pi sudo systemctl restart smbd
Plex Server 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 mkdir -p "/tmp/plexmediaserver" sudo mount -t tmpfs -o size=1000M tmpfs /tmp/plexmediaserver sudo chown -R pi:pi /var/lib/plexmediaserver sudo apt -y install apt-transport-https curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add - echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.listsudo apt -y install plexmediaserver sudo vim /etc/default/plexmediaserver hostname -I sudo vim /boot/cmdline.txt sudo mkdir -p /etc/systemd/system/plexmediaserver.service.d sudo vim /etc/systemd/system/plexmediaserver.service.d/override.conf sudo systemctl stop plexmediaserver sudo service plexmediaserver stop sudo systemctl enable plexmediaserver.service sudo systemctl restart plexmediaserver.service
Crontab -e 1 sudo apt -y install php php-curl
crontab -e
1 2 3 4 5 6 7 8 echo '' 'mkdir -p /tmp/gdrive fusermount -u /tmp/gdrive /usr/bin/rclone mount Plex:Plex /tmp/gdrive --umask 0000 --default-permissions --allow-non-empty --allow-other --buffer-size 64M --dir-cache-time 48h --vfs-read-chunk-size 128M --vfs-read-chunk-size-limit 1500M & ' '' > rclone.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 echo '' ' mkdir -p /tmp/gdrive/backup/ PlexPath="/var/lib/plexmediaserver/Library/Application Support/Plex Media Server" tar cf - --exclude="$PlexPath/Logs" --exclude="$PlexPath/Cache" --exclude="$PlexPath/Crash Reports" /var/lib/plexmediaserver | lz4 -f - /tmp/gdrive/backup/plex.tar.lz4 ' '' > backup.shecho '' ' lz4 -d /tmp/gdrive/backup/plex.tar.lz4 | tar -xC / PlexPath="/var/lib/plexmediaserver/Library/Application Support/Plex Media Server" mkdir -p "$PlexPath/Logs" "$PlexPath/Cache" "$PlexPath/Crash Reports" ' '' > restore.shchmod a+x backup.sh restore.sh echo '' ' sudo apt update && sudo apt upgrade && sudo apt autoremove && sudo apt clean pihole -up && pihole -g ' '' > update.shchmod a+x update.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 @reboot vncserver @reboot /home/pi/rclone.sh @reboot sleep 30 && /home/pi/restore.sh */30 * * * * /home/pi/backup.sh 0 3 * * * /home/pi/update.sh 0 22 * * * cd ~/Bot;python3 autoPill.py 0 9 * * * php ~/Bot/bilibiliRun.ph
sudo crontab -e
1 2 # 0 4 * * * /sbin/shutdown -r @reboot sleep 90 && sudo service plexmediaserver start
Jellyfinhttps://jellyfin.org/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 sudo apt install apt-transport-https wget -O - https://repo.jellyfin.org/jellyfin_team.gpg.key | sudo apt-key add - echo "deb [arch=$( dpkg --print-architecture ) ] https://repo.jellyfin.org/$( awk -F'=' '/^ID=/{ print $NF }' /etc/os-release ) $( awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release ) main" | sudo tee /etc/apt/sources.list.d/jellyfin.listsudo apt update sudo apt install jellyfin echo '' '#!/bin/zsh JELLYFINTMP="/tmp/jellyfin" USRBIN="/usr/bin" mkdir -p $JELLYFINTMP/log $JELLYFINTMP/cache $JELLYFINTMP/transcodes \ $JELLYFINTMP/data \ $JELLYFINTMP/metadata \ $JELLYFINTMP/config $USRBIN/jellyfin \ -C $JELLYFINTMP/cache \ -l $JELLYFINTMP/log \ -d $JELLYFINTMP/data \ -c $JELLYFINTMP/config \ --ffmpeg $USRBIN/ffmpeg & ' '' > jellyfin.shchmod a+x jellyfin.sh nohup ./jellyfin.sh </dev/null & sudo systemctl disable jellyfin sudo usermod -aG video jellyfin