Install the Raspberry Pi OS on the SSD drive with the Raspberry Pi Imager.
Boot the Pi and ssh to it.
mkdir nextcloud
cd nextcloud
mkdir -p app/config app/custom_apps app_data caddy_data db_data cloudflaredIn order for www-data and pi users to read and write nextcloud directories. New files will inherit these permissions.
sudo setfacl -R -m u:pi:rwx app app_data
sudo setfacl -R -d -m u:pi:rwx app app_data
sudo setfacl -R -m u:www-data:rwx app app_data
sudo setfacl -R -d -m u:www-data:rwx app app_data
sudo setfacl -R -m mask:rwx app app_data
sudo setfacl -R -d -m mask:rwx app app_datanextcloud/docker-compose.ymlnextcloud/Caddyfilenextcloud/nextcloud-docker/Dockerfile
cd nextcloud-docker && docker build -t jakzal/nextcloud:latest && cd -Create a group and user for uid/gid 65532 that the cloudflared uses.
sudo groupadd -g 65532 -U pi nonroot
sudo useradd -g 65532 -M -u 65532 nonrootIt might also be good to add the pi user to the www-data group in /etc/group.
Create the volume for cloudflared certs and configuration.
docker compose run --no-deps cloudflared tunnel login
docker compose run --no-deps cloudflared tunnel create nextcloud
docker compose run --no-deps cloudflared tunnel route dns nextcloud next.example.comMake a note of the tunnel ID.
Create cloudflared/config.yml.
tunnel: <TUNNEL-ID>
credentials-file: /home/nonroot/.cloudflared/<TUNNEL-ID>.json
ingress:
- hostname: "next.example.com"
service: http://web
originRequest:
originServerName: "next.example.com"
- service: http_status:404
docker compose up -dGo to https://next.example.com and complete the installation.
Update app/config/config.php with your configuration.
Mv data and fix app_data permissions.
sudo mv app/data/* app_data/
sudo mv app/data/.ocdata app_data/
sudo mv app/data/.htaccess app_data/
sudo chown -R www-data:www-data app_data/Rescan the files.
docker compose exec -u www-data app php occ files:scan --allGo to the admin overview to check the installation. In case of problems with missing .ocdata file, go to Basic Settings -> Webcron -> back to Ajax.
Create /lib/systemd/system/nextcloud.service.
Enable the nextcloud.service and start it.
sudo systemctl enable nextcloud.service
sudo systemctl start nextcloud.service