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:

  1. A Raspberry Pi (3 or higher, preferably)

  2. SSH access to the Raspberry Pi

  3. 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_data

Get uuid:

[copy/paste >] lsblk -f   

record UUID here: ____________________________

Update the fstab File

Open your configuration file:

  • [copy/paste >] sudo nano /etc/fstab
  • UUID=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-reload

Mount:

[copy/paste >]sudo mount /dev/sda1 /mnt/nextcloud_data

Verify:

[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)

  1. Install Docker:

    [copy/paste >] curl -sSL https://get.docker.com | sh
  2. Add User to Group:

    [copy/paste >] sudo usermod -aG docker $USER
    • CRITICAL: Log out of SSH and log back in now.  Type: Exit

  3. Create Directory:

    [copy/paste >] mkdir ~/nextcloud && cd ~/nextcloud
  4. Create docker-compose.yml:

    [copy/paste >] nano docker-compose.yml
    • Paste 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

  1. Launch:

    [copy/paste >]docker compose up -d
  2. Access 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)

  1. Enable Redis Caching:

    [copy/paste >] docker exec --user www-data nextcloud-app-1 php occ config:system:set memcache.local --value "\OC\Memcache\Redis"
  2. Enable File Locking:

    [copy/paste >] docker exec --user www-data nextcloud-app-1 php occ config:system:set memcache.locking --value "\OC\Memcache\Redis"
  3. 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 up

In the Tailscale web admin:

  1. Select the icon on the far right of the nextcloud machine row

  2. Select Disable Key Expiry

  3. 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 admin
  • Update System:

    [copy/paste >] cd ~/nextcloud && docker compose pull && docker compose up -d
Next
Next

Why YouTubers endorse products…