Installing Nextcloud on Raspberry Pi: A Comprehensive Guide
Ohidur Rahman Bappy
MAR 22, 2025
Installing Nextcloud on Raspberry Pi: A Comprehensive Guide
In this guide, we will walk you through the process of setting up Nextcloud on a Raspberry Pi using Docker, a popular platform for running containerized applications.
Simple Setup
To begin with, you can run Nextcloud quickly using the following Docker command:
docker run -d -p 7000:80 nextcloud
This will get you a basic installation up and running in no time. However, for data persistence and easier upgrades, it's recommended to set up volumes.
With Volumes for Data Persistence
The following command sets up Nextcloud with volumes, which is useful for storing data across container shutdowns and restarts:
docker run -d -p 7000:80 \
-v /dkr/nextcloud/nextcloud:/var/www/html \
-v /dkr/nextcloud/apps:/var/www/html/custom_apps \
-v /dkr/nextcloud/config:/var/www/html/config \
-v /dkr/nextcloud/data:/var/www/html/data \
-v /dkr/nextcloud/theme:/var/www/html/themes/<YOUR_CUSTOM_THEME> \
nextcloud
Replace <YOUR_CUSTOM_THEME>
with your desired theme name if applicable.
Advanced Use Cases
For more configuration options and advanced use cases, refer to the Nextcloud Docker page. Here's a more intricate example command:
docker run -d -p 7000:80 --name=my-nextcloud --restart=always \
-v /dkr/nextcloud/nextcloud:/var/www/html \
-v /dkr/nextcloud/apps:/var/www/html/custom_apps \
-v /dkr/nextcloud/config:/var/www/html/config \
-v /dkr/nextcloud/data:/var/www/html/data \
nextcloud
Setting Up PostgreSQL with Docker
Nextcloud can be configured to use a PostgreSQL database. Set it up using Docker with the command below:
docker run --name postgres-container -e POSTGRES_PASSWORD=postgres \
-p 5432:5432 --restart=always \
-e PGDATA=/var/lib/postgresql/data/pgdata \
-v /dkr/postgres:/var/lib/postgresql/data \
-d postgres
Make sure to configure your Nextcloud installation to connect to this PostgreSQL database backend for efficient data handling.
Enjoy your self-hosted cloud storage solution on Raspberry Pi with Nextcloud!