|
| 1 | +# Raspberry Pi Setup |
| 2 | + |
| 3 | +- Flash OS to SD card |
| 4 | + |
| 5 | +- configure static IP for ethernet and wlan |
| 6 | + |
| 7 | +- disable wifi |
| 8 | + |
| 9 | +- disable bluetooth |
| 10 | + |
| 11 | +- mute audio |
| 12 | + |
| 13 | +- connect to gigabit ethernet |
| 14 | + |
| 15 | +- update repositories `sudo apt-get update` |
| 16 | + |
| 17 | +- upgrade software `sudo apt-get upgrade -y` |
| 18 | + |
| 19 | +- install docker (debian) - https://docs.docker.com/engine/install/debian/ |
| 20 | + |
| 21 | +- docker Linux post-install (group modifications) - https://docs.docker.com/engine/install/linux-postinstall/ |
| 22 | + |
| 23 | +- Install cloudflared - https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/get-started/create-local-tunnel/#1-download-and-install-cloudflared |
| 24 | + |
| 25 | +- Create and/or connect Cloudflare tunnel |
| 26 | + |
| 27 | +- install nordvpn - https://nordvpn.com/download/linux/ |
| 28 | + |
| 29 | + - to login from CLI, run `nordvpn login` in the terminal and copy the link it provides |
| 30 | + - open the link in the browser and log in with Nord account |
| 31 | + - after login, copy the URL of the 'continue' button |
| 32 | + - in the terminal, use `nordvpn login --callback "{your success URL}"` to login |
| 33 | + |
| 34 | +- configure nordvpn |
| 35 | + |
| 36 | + - enable meshnet `nordvpn set meshnet on` |
| 37 | + - enable lan-discovery `nordvpn set lan-discovery on` |
| 38 | + - enable cybersec `nordvpn set cybersec on` |
| 39 | + |
| 40 | +- configure pi hardening |
| 41 | + |
| 42 | + - https://sunknudsen.com/privacy-guides/how-to-configure-hardened-raspberry-pi |
| 43 | + |
| 44 | + - http://www.arch13.com/security-setup-hardening-of-raspberry-pi-os-buster/ |
| 45 | + |
| 46 | + - outline: |
| 47 | + |
| 48 | + - ensure pi user not used |
| 49 | + |
| 50 | + - ensure sudo with password |
| 51 | + |
| 52 | + - `rm /etc/sudoers.d/010_*` |
| 53 | + |
| 54 | + - disable root user history |
| 55 | + |
| 56 | + - ``` |
| 57 | + echo "HISTFILESIZE=0" >> ~/.bashrc |
| 58 | + history -c; history -w |
| 59 | + source ~/.bashrc |
| 60 | + ``` |
| 61 | +
|
| 62 | + - disable root login and password auth |
| 63 | +
|
| 64 | + - ``` |
| 65 | + sed -i -E 's/^(#)?PermitRootLogin (prohibit-password|yes)/PermitRootLogin no/' /etc/ssh/sshd_config |
| 66 | + sed -i -E 's/^(#)?PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config |
| 67 | + systemctl restart ssh |
| 68 | + ``` |
| 69 | +
|
| 70 | + |
| 71 | +
|
| 72 | + - ensure non-default hostname |
| 73 | +
|
| 74 | + - install ufw firewall |
| 75 | +
|
| 76 | + - `sudo apt-get install ufw` |
| 77 | + - `sudo ufw enable` |
| 78 | + - `sudo ufw allow http` |
| 79 | + - `sudo ufw allow https` |
| 80 | + - `sudo ufw limit ssh` |
| 81 | +
|
| 82 | + - install fail2ban `sudo apt-get install fail2ban |
| 83 | + |
| 84 | + - install unattended upgrades |
| 85 | + |
| 86 | + - `sudo apt-get install unattended-upgrades` |
| 87 | + |
| 88 | + - enable unattended upgrades `sudo dpkg-reconfigure --priority=low unattended-upgrades` |
| 89 | + - You’ll be presented with a confirmation screen that you want to enable automatic software updates. Select `Yes` to proceed. |
| 90 | +
|
| 91 | +- install borgbackup `sudo apt install borgbackup` |
| 92 | +
|
| 93 | +- configure borgbackup - https://borgbackup.readthedocs.io/en/stable/quickstart.html |
| 94 | +
|
| 95 | + - create initial repo `borg init --encryption=repokey /path/to/storage/{hostname} |
| 96 | + - run initial full backup `sudo borg create --verbose --stats --compression lz4 /storage-hdd/backups/{hostname}::full_{now} /etc /home /root /var /usr/local/bin /usr/local/sbin /usr/local/etc /usr/local/src /opt /srv` |
| 97 | + - configure borg automated backup |
| 98 | +
|
| 99 | +- install and configure cosmos-server - https://cosmos-cloud.io/doc/1%20index/ |
| 100 | +
|
| 101 | + - `docker run -d --network host --privileged --name cosmos-server -h cosmos-server --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /:/mnt/host -v /{external storage path}/cosmos:/config azukaar/cosmos-server:latest` |
| 102 | + - Don't use https for cosmos. This is handled via the Cloudflare tunnel |
| 103 | +
|
| 104 | +- configure automount external storage (if present) |
| 105 | +
|
| 106 | + - https://unix.stackexchange.com/a/654953 |
| 107 | +
|
| 108 | +- install cosmos apps |
| 109 | +
|
| 110 | + - Nextcloud |
| 111 | + - Set up cron |
| 112 | + - Set up plugins |
| 113 | + - Mount ffmpeg binaries |
| 114 | + - `/storage-hdd/utilities/ffmpeg-6.1/ffmpeg:/usr/bin/ffmpeg` |
| 115 | + - `/storage-hdd/utilities/ffmpeg-6.1/ffprobe:/usr/bin/ffprobe` |
| 116 | + - Ghost |
| 117 | +
|
| 118 | +- Install Discourse |
| 119 | +
|
| 120 | + - Install launcher |
| 121 | + - configure & deploy data container |
| 122 | + - configure & deploy web container |
| 123 | + - Expose ports |
| 124 | + - Add cosmos URL to route traffic to web container |
| 125 | +
|
| 126 | +- Install Collective Commerce (Solidus) |
| 127 | +
|
| 128 | +
|
| 129 | +
|
| 130 | +
|
| 131 | +
|
| 132 | +# Dokku |
| 133 | +
|
| 134 | +For Dokku on raspi, use arm64 version of docker images when needed: |
| 135 | +
|
| 136 | +Postgres |
| 137 | +
|
| 138 | +- `dokku postgres:create community-engine-db --image imresamu/postgis --image-version latest` |
0 commit comments