Install NextCloud on a Raspberry Pi 4 with OpenMediaVault and Docker

dbtechdiy, OpenMediaVault, Raspberry Pi, Tutorials, VideoLeave a Comment

Install NextCloud on a Raspberry Pi 4

In this post we’ll look at how to Install NextCloud on a Raspberry Pi 4 with OpenMediaVault and Docker.

We’re going to use the setup from https://hub.docker.com/_/nextcloud, but we’re going to change one thing: the database.

The database that is being used in the docker-compose file on the site isn’t compatible with ARM processors, so we’ll need to change that in a bit.

But first, we need to get logged in to our Raspberry Pi’s Portainer. This tutorial assumes that you already have Docker and Portainer installed, most likely via OpenMediaVault.

Prerequisites

  • You’ll need a domain name.
  • You’ll need to a CloudFlare account with your domain name pointed to it.
  • You’ll need to point a subdomain to your home’s IP address. Make sure that Proxy Status is “DNS Only”. Also make sure that you change SSL/TLS to “Full”.
  • You’ll need to forward ports 80 and 443 to your Raspberry Pi.
  • You’ll need NGINX Proxy Manager installed.
  • You’ll need to create a volume in OpenMediaVault for your NextCloud file storage.

Installation

Open Portainer on your Raspberry Pi and create a new Stack.

Paste the following into your new stack:

version: '2'

volumes:
  nextcloud:
  db:

services:
  db:
    image: yobasystems/alpine-mariadb:latest
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    restart: always
    volumes:
      - db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=password #Change This
      - MYSQL_PASSWORD=password #Change This
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  app:
    image: nextcloud
    ports:
      - 8080:80
    links:
      - db
    volumes:
      - nextcloud:/var/www/html #Change 'nextcloud' to your external drive volume if available
    restart: always

Change the few things as noted above.

Click the “Deploy the Stack” button.

Next, go to your NGINX Proxy Manager dashboard. Create a new Proxy Host.

  • Fill in the domain name (or subdomain) you designated for your NextCloud install.
  • Scheme should be http.
  • Forward Hostname/IP should be your Raspberry Pi’s IP address.
  • Foward port should be 8080.
  • Click the “Block Common Exploits” toggle.

Go to the SSL tab.

  • Change “None” to “Request a New SSL Certificate”.
  • Click the “Force SSL” and “HTTP/2 Support” toggles.
  • You can click the HSTS toggles if you’ve enabled HSTS in CloudFlare.
  • Click “Save”.

After a moment, you should see that everything has deployed correctly.

Next, go to https://nextcloud.yourdomain.com (change this to your actual domain) and you should see the NextCloud install page.

  • Enter an Admin username and password.
  • Change the database type to MySQL/MariaDB.
  • Enter the username, password, and database name as you have them in your Portainer Stack.
  • Change Database location to from “localhost” to “db” (without quotes).
  • Toggle the option for additional app installation to meet your needs.
  • Click “Finish setup”.

At this point, you can go get some lunch or something as the install process will take a while since we’re on a 4 core ARM processor.

Once the install is complete, you’ll be taken to the NextCloud dashboard and then you should be good to go!