From 52c65ec7f4016788cbbdefa0e6aeeaef349a974c Mon Sep 17 00:00:00 2001 From: KemoNine Date: Fri, 31 Jul 2020 23:05:51 +0000 Subject: [PATCH] Add initial development notes --- notes.txt | 702 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 702 insertions(+) create mode 100644 notes.txt diff --git a/notes.txt b/notes.txt new file mode 100644 index 0000000..2e0680f --- /dev/null +++ b/notes.txt @@ -0,0 +1,702 @@ +######################################## +# IMPORTANT CONSIDERATIONS +######################################## + +This setup does NOT use SSL for anything. Use acme.sh + vhosts + nginx if you really wanna walk that path + +######################################## +# Setup environment +######################################## +https://ubuntu.com/download/raspberry-pi/thank-you?version=20.04&architecture=arm64+raspi +boot ubuntu server 64bit + ubuntu / ubuntu +update to latest of everything +apt update && apt install parted wget curl nano tmux vim htop iotop nload +ip addr +ssh into rpi + +######################################## +# Inspiration +######################################## + +https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-4#installation +https://github.com/phortx/Raspberry-Pi-Setup-Guide + +######################################## +# Prep / install arch linux on micro sd card +######################################## + +parted /dev/sda +mklabel msdos +mkpart + p + [enter] + 1 + 100M +mkpart + p + [enter] + 100M + -1 +set 1 boot on +set 1 lba on +q + +mkfs.vat /dev/sda1 +mkfs.btrfs /dev/sda2 + +mkdir /mnt/arch +mount -o nodiratime,noatime,compress /dev/sda2 /mnt/arch +mkdir /mnt/arch/boot +mount /dev/sda1 /mnt/arch/boot +cd /mnt/arch +wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-4-latest.tar.gz +tar -xpf ArchLinuxARM-rpi-4-latest.tar.gz +rm ArchLinuxARM-rpi-4-latest.tar.gz + +cat > /mnt/arch/boot/config.txt < /etc/locale.conf +sed -i "s/#en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen +locale-gen +nano -w /etc/hostname +nano -w /etc/hosts + +######################################## +# Swap +######################################## + +mkdir /swap +chattr +C /swap +fallocate -l 1024M /swap/swap.1 +chmod 600 /swap/swap.1 +mkswap /swap/swap.1 +swapon /swap/swap.1 +echo 'vm.swappiness=1' > /etc/sysctl.d/99-sysctl.conf +echo "/swap/swap.1 none swap defaults 0 0" >> /etc/fstab + +######################################## +# Tweak journald +######################################## + +mkdir /etc/systemd/journald.conf.d/ +cat > /etc/systemd/journald.conf.d/00-wall.conf < /etc/systemd/journald.conf.d/00-journal-size.conf < /etc/systemd/journald.conf.d/00-audit.conf < /etc/systemd/journald.conf.d/00-console.conf < /etc/sudoers.d/yay <> ~/.bashrc < /etc/incron.d/feh < /usr/local/bin/feh-slideshow.sh <> /etc/greetd/config.toml < /etc/aliases < /etc/msmtprc < /etc/systemd/system/cronie.service.d/override.conf < /root/restic_backup.sh <> /etc/lighttpd/lighttpd.conf +mkdir /srv/http +cat > /srv/http/index.html < + + +PiFrame + + + +

CockPit Web Management

+

Monit Monitoring

+

Munin Monitoring

+

Syncthing Admin Interface

+

Picture File Browser

+ + +EOF +firewall-cmd --zone=public --permanent --add-service=http +firewall-cmd --zone=public --permanent --add-service=https +firewall-cmd --reload +systemctl enable --now lighttpd + +######################################## +# system monitoring +######################################## + +pacman -S monit +mkdir /etc/monit.d +nano -w /etc/monitrc + include /etc/monit.d/* + set httpd port 2812 and + use address 0.0.0.0 # only accept connection from localhost (drop if you use M/Monit) + allow admin:monit # require user 'admin' with password 'monit' + + + set mailserver robomail.nusku.biz port 587 + username "piframe@robomail.nusku.biz" password "r8QA6AEFaqtCdDjfvzY3gvsX" + using tls +cat > /etc/monit.d/rootfs < 80% then alert +EOF +cat > /etc/monit.d/tankfs < 80% then alert +EOF +cat > /etc/monit.d/feh < /etc/lighttpd/lighttpd-munin.conf < "/munin/" ) + +\$HTTP["url"] =~ "/munin-cgi/munin-cgi-graph" { + alias.url += ( "/munin-cgi/munin-cgi-graph" => "/usr/share/munin/cgi/munin-cgi-graph" ) + cgi.assign = ( "" => "" ) +} + +#alias.url += ( "/munin/static" => "/etc/munin/static" ) +alias.url += ( "/munin" => "/usr/share/munin/www" ) + +mimetype.assign = ( + ".html" => "text/html", + ".txt" => "text/plain", + ".css" => "text/css", + ".js" => "application/x-javascript", + ".jpg" => "image/jpeg", + ".jpeg" => "image/jpeg", + ".gif" => "image/gif", + ".png" => "image/png", + "" => "application/octet-stream" + ) +EOF +cat > /etc/systemd/system/lighttpd-munin.service < /etc/systemd/system/filebrowser-pictures.service < /etc/systemd/system/screen-on.timer < /etc/systemd/system/screen-on.service < /etc/systemd/system/screen-off.timer < /etc/systemd/system/screen-off.service < /etc/modules-load.d/i2c.conf <