Installing and configuring NextCloud (worksheet)
THE TUTORIAL IS MEANT TO BE USED WITH THIS VIDEO!
YouTube tutorials can be a pain to actually follow, so here’s the worksheet that accompanies the video - for your convenience.
I recommend both printing this out, to use as a checklist, and keeping the page up, so you can copy-and-paste the entries.
What you need:
A Raspberry Pi (3 or higher, preferably)
SSH access to the Raspberry Pi
A USB drive (optional, but recommended - contents will be formatted)
This step is only applicable if using a USB drive – the contents will be erased in this step!
STEP 1: Prepare the USB Drive (Formatting & Mounting)
Identify the drive:
[copy/paste >] lsblk (typically /dev/sda1, or similar)Record device name here: _______________
Format to ext4:
[copy/paste >] sudo mkfs.ext4 /dev/sda1 you can get a warning that there’s an existing volume. If you proceed (‘y’), it will delete all of the data on the USB drive
Create Mount Point:
[copy/paste >] sudo mkdir -p /mnt/nextcloud_dataGet uuid:
[copy/paste >] lsblk -f record UUID here: ____________________________
Update the fstab File
Open your configuration file:
[copy/paste >] sudo nano /etc/fstabUUID=YOURUUIDHERE /mnt/nextcloud_data ext4 defaults,auto,users,rw,nofail 0 2
exit nano with Ctrl-x, and y to save
Reload:
[copy/paste >]sudo systemctl daemon-reloadMount:
[copy/paste >]sudo mount /dev/sda1 /mnt/nextcloud_dataVerify:
[copy/paste >] df -h(Verify /mnt/nextcloud_data appears)
Set Permissions
[copy/paste >] sudo chown -R 33:33 /mnt/nextcloud_data[copy/paste >] chmod -R 750 /mnt/nextcloud_data
STEP 2: Install Nextcloud & Redis (Docker)
Install Docker:
[copy/paste >] curl -sSL https://get.docker.com | shAdd User to Group:
[copy/paste >] sudo usermod -aG docker $USERCRITICAL: Log out of SSH and log back in now. Type: Exit
Create Directory:
[copy/paste >] mkdir ~/nextcloud && cd ~/nextcloudCreate docker-compose.yml:
[copy/paste >] nano docker-compose.ymlPaste the following:
services:
db:
image: mariadb:10.6
restart: always
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
volumes:
- db_data:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=your_root_pwd
- MYSQL_PASSWORD=your_db_pwd
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
redis:
image: redis:alpine
restart: always
app:
image: nextcloud
restart: always
ports:
- 8080:80
depends_on:
- db
- redis
volumes:
- nextcloud_config:/var/www/html
- /mnt/nextcloud_data:/var/www/html/data
environment:
- MYSQL_PASSWORD=your_db_pwd
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_HOST=db
- REDIS_HOST=redis
volumes:
db_data:
nextcloud_config:
ctrl-x: Y
Launch:
[copy/paste >]docker compose up -dAccess UI: http://<RPi-IP>:8080
(replace port number, if you changed it in the Nextcloud Docker config)
· Create admin username: _____________ nextcloudadmin
· Create admin password:______________ nextcloudpass (there are pw strength requirements)
· Click Install
· Select apps, and click install recommended apps, or skip
· If the web ui goes unresponsive. Wait a couple minutes, and then: docker compose restart
STEP 3: Post-Install Optimization (The Turbo Pi Setup)
Enable Redis Caching:
[copy/paste >] docker exec --user www-data nextcloud-app-1 php occ config:system:set memcache.local --value "\OC\Memcache\Redis"Enable File Locking:
[copy/paste >] docker exec --user www-data nextcloud-app-1 php occ config:system:set memcache.locking --value "\OC\Memcache\Redis"Configure Redis Host:
[copy/paste >] docker exec --user www-data nextcloud-app-1 php occ config:system:set redis --value '{"host": "redis", "port": 6379}' --type json
STEP 4: Install Tailscale and register the device
This assumes you have a Tailscale account. If not register for one here!
[copy/paste >] curl -fsSL https://tailscale.com/install.sh | sh[copy/paste >] sudo tailscale upIn the Tailscale web admin:
Select the … icon on the far right of the nextcloud machine row
Select Disable Key Expiry
Record nextcloud Tailscale IP here: ______________________
STEP 5: Verification & Web UI Config
Verify Storage: Admin Settings > System (Ensure "Free Space" matches your USB drive size).
STEP 6: Maintenance
Reset Password (If locked out):
[copy/paste >] docker exec -it --user www-data nextcloud-app-1 php occ user:resetpassword adminUpdate System:
[copy/paste >] cd ~/nextcloud && docker compose pull && docker compose up -d