In this project, we are going to set up an ownCloud server on the Raspberry Pi. This server can act as your very own personal cloud storage.

As protecting your privacy becomes harder and harder, you may be considering moving your files to a private self-hosted cloud storage. If this is the case, then this tutorial is perfect for you.
The ownCloud web interface is very similar to the many cloud storage providers that are available, such as Dropbox, Google Drive, and more. This similarity will make changing over to the self-hosted software much easier.
It is important to remember that since your data will be stored on your home network, you will end up with using more bandwidth if you upload and download files from outside your network.
This tutorial will take you through everything you need to know to get ownCloud setup and accessible.
If you are curious and want to learn more about the ownCloud software, be sure to check out the ownCloud website.
Equipment
I made use of the following equipment for this personal cloud storage setup.
Recommended
- Raspberry Pi ( Amazon )
- Micro SD Card ( Amazon )
- Ethernet Cable ( Amazon ) or Wi-Fi ( Amazon )
- External Hard Drive ( Amazon ) or USB Drive ( Amazon )
Optional
Note: It is highly likely that the USB ports on the Raspberry Pi will be unable to power an external hard drive so you may need to invest in a powered USB hub.
We last tested this tutorial on the Raspberry Pi 5 running Raspberry Pi OS Bookworm. We highly recommend that you update the to the latest operating system for the best experience.
Video
If you are a visual person and would like to see our video on how to put this tutorial together, check out the video below.
It will take you through everything you need to know get your Raspberry Pi ownCloud server up and running.
Setting up The Raspberry Pi ownCloud Server
Firstly, you will need to have a Raspberry Pi with an OS installed. If you haven’t installed Raspberry Pi OS, then check out our guide on installing Raspberry Pi OS. We recommend using the latest version for the best performance and reliability.
There are quite a few ways you can install ownCloud onto your Raspberry Pi. In this tutorial, we will be using Docker to set up ownCloud.
In our previous version of this tutorial, we used Nginx, but this method is deprecated, and we now recommend using Docker, especially since ownCloud still relies on PHP7.4.
Installing Docker
The first thing we need to do is install Docker on our Raspberry Pi. We will need this software to run the ownCloud software.
1. Firstly, in the terminal or via SSH, we will need to update the Raspberry Pi and its packages. Do this by entering the following two commands.
sudo apt update
sudo apt upgrade -y
2. You will need to ensure that you have Docker on your Raspberry Pi before proceeding to the next few steps. If you already have it installed, go to step 3.
If you need to install Docker, run through our tutorial on setting up Docker on the Raspberry Pi. It will take you through all the steps to set up the software correctly.
https://pimylifeup.com/raspberry-pi-docker/
Creating the Required Directories
3. We now need to create the directories for where we will store the compose file and environment variables.
You can do this by running the mkdir command. The “-p
” option will create any missing directories.
sudo mkdir -p /opt/stacks/owncloud
4. Now change into the newly created directory by using the cd command.
cd /opt/stacks/owncloud
Setting up the Docker Compose File
5. Before we proceed, we will need to get the IP address of the Raspberry Pi. You will need to use the IP address in the environment file and to access the ownCloud web interface.
I recommend that you set your Raspberry Pi IP to static to avoid it changing in the future.
To get the IP address of the Raspberry Pi, enter the hostname command with the option “-I
“.
hostname -I
6. It is time to write a compose file for our ownCloud setup. This file is a set of instructions Docker will run through to set up all the relevant services with the specified options. Alongside ownCloud, we will be setting up a MySQL and a Redis server.
Create and edit this file by running the following command. We will be using the nano text editor.
sudo nano compose.yaml
7. In this file, copy and paste the following text. Thankfully, we do not need to make any changes to this file, as any extra configurations will be stored in an environment file.
services:
owncloud:
image: owncloud/server:${OWNCLOUD_VERSION}
container_name: owncloud_server
restart: always
ports:
- ${HTTP_PORT}:8080
depends_on:
- mariadb
- redis
environment:
- OWNCLOUD_DOMAIN=${OWNCLOUD_DOMAIN}
- OWNCLOUD_TRUSTED_DOMAINS=${OWNCLOUD_TRUSTED_DOMAINS}
- OWNCLOUD_DB_TYPE=mysql
- OWNCLOUD_DB_NAME=owncloud
- OWNCLOUD_DB_USERNAME=owncloud
- OWNCLOUD_DB_PASSWORD=owncloud
- OWNCLOUD_DB_HOST=mariadb
- OWNCLOUD_ADMIN_USERNAME=${ADMIN_USERNAME}
- OWNCLOUD_ADMIN_PASSWORD=${ADMIN_PASSWORD}
- OWNCLOUD_MYSQL_UTF8MB4=true
- OWNCLOUD_REDIS_ENABLED=true
- OWNCLOUD_REDIS_HOST=redis
healthcheck:
test: ["CMD", "/usr/bin/healthcheck"]
interval: 30s
timeout: 10s
retries: 5
volumes:
- ${OWNCLOUD_FILES_LOCATION}:/mnt/data
mariadb:
image: mariadb:10.11 # minimum required ownCloud version is 10.9
container_name: owncloud_mariadb
restart: always
environment:
- MYSQL_ROOT_PASSWORD=owncloud
- MYSQL_USER=owncloud
- MYSQL_PASSWORD=owncloud
- MYSQL_DATABASE=owncloud
- MARIADB_AUTO_UPGRADE=1
command: ["--max-allowed-packet=128M", "--innodb-log-file-size=64M"]
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-u", "root", "--password=owncloud"]
interval: 10s
timeout: 5s
retries: 5
volumes:
- ./mysql:/var/lib/mysql
redis:
image: redis:6
container_name: owncloud_redis
restart: always
command: ["--databases", "1"]
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
volumes:
- ./redis:/data
Once you are done, save and exit by pressing CTRL + X, Y, and then ENTER.
8. It is time to write the environment file. This file will contain all the configurations we wish to set for the ownCloud software. For example, usernames, passwords, ports, and more. Docker automatically reads it and will match and replace the placeholders in the compose file with the relevant data from the environment file.
To create the environment file, enter the following command.
sudo nano .env
9. In this file, you will need to enter the following lines and replace each placeholder with the value you wish to use. We will explain each of these options below.
OWNCLOUD_VERSION=<VERSION>
OWNCLOUD_DOMAIN=<DOMAINORIP>:<HTTPPORT>
OWNCLOUD_TRUSTED_DOMAINS=<DOMAINORIP>
ADMIN_USERNAME=<ADMINUSERNAME>
ADMIN_PASSWORD=<ADMINPASSWORD>
HTTP_PORT=<HTTPPORT>
OWNCLOUD_FILES_LOCATION=<MOUNTPATH>
<VERSION>
This placeholder represents the version of ownCloud you want to run on your Raspberry Pi. I recommend using thelatest
, but you can always specify an older version such as10
.<DOMAINORIP>
Use this option to specify the allowed address for accessing the ownCloud instance. For example, if I want to use it locally, I will use the local IP, such as192.168.0.15
.
If I want to access the software remotely, I can use an external IP address or domain name. You can add multiple domains and IPs by separating each of them with a comma. For example,192.168.0.15,test.pimylifeup.com
. Please note, that multiple IPs and domains only applies to theOWNCLOUD_TRUSTED_DOMAINS
variable.<HTTPPORT>
This is the default port that ownCloud will listen on. I recommend using a port such as8080
or similar to avoid conflicts with other software.<ADMINUSERNAME>
Replace this placeholder with the username you wish to use for your admin account. You will not be able to change this after the first setup.<ADMINPASSWORD>
Like the username, the admin password is only used for the first setup. Afterward, you will need to change the password in the web interface.<MOUNTPATH>
This is the path for storing the data of ownCloud. Using.data
will store it within/opt/stacks/owncloud
directory. You can change this directory to wherever suits you the best.
You could set it to a mounted drive by using something like/mnt/usb1/owncloud
. A mounted drive is a good option as it allows you to gain access to a lot of storage space.
OWNCLOUD_VERSION=latest
OWNCLOUD_DOMAIN=192.168.0.15:8080
OWNCLOUD_TRUSTED_DOMAINS=192.168.0.15
ADMIN_USERNAME=pimylifeup
ADMIN_PASSWORD=pimylifeup
HTTP_PORT=8080
OWNCLOUD_FILES_LOCATION=./data
Once you are done, save and exit the file by pressing CTRL + X, Y, and then ENTER.
Starting the ownCloud Server with Docker
10. To start your ownCloud server, all you need to do is run the following command.
Once initiated, Docker will download all the required software and start up each of the service with the specified options. Using the -d
option will run Docker in the background.
docker compose up -d
First Start of ownCloud on the Raspberry Pi
I will briefly go through the basics of ownCloud running on the Raspberry Pi. If you want more information, I highly recommend checkout out the manuals on their website. You can find them at the ownCloud manual site here.
11. In your favorite web browser, you need to go to your Raspberry Pi’s IP address.
If you don’t know your IP address, you can run the hostname command on the Raspberry Pi.
hostname -I
Below is an example of the address you will need to enter into the browser. Remember to update the IP address with the one you get from using the command above.
http://192.168.0.15:8080
12. You should now be greeted with a login page similar to the one below. Simply enter the username and password that we set in the environment file.

13. You will now see a page with a pop-up on how you can install the apps for desktop, Android, and iOS.

14. Lastly, test that you can upload files to your ownCloud installation by simply dragging and dropping a file into the web interface. It should upload without any issues.

15. You now have ownCloud installed and running on your Raspberry Pi. The next couple of sections cover the basics for remote access, updating software, and backing it up to somewhere secure.
Setting up Remote Access
If you want to access the server remotely, I highly recommend using a service like Cloudflare Tunnels or Tailscale. These services are relatively easy for most people to understand and setup. Alternatively, setting up a reverse proxy like Traefik, or Nginx proxy manger will also work.
Once you have chosen your method of exposing ownCloud to the internet you will simply need to specify the IP address and port of the software. Most of the software above will generate certificate for your domain name.
Updating ownCloud Docker
Using Docker makes updating your ownCloud software super easy, and only involves a few simple steps.
1. Before you update, we recommend that you backup any data in case something goes wrong with the update. Follow our backup section for more information.
2. You will need to first change to the location of your ownCloud compose file. If you followed this tutorial, use the command below.
cd /opt/stacks/owncloud
3. You can simply tell Docker to pull the latest versions of the software specified in the compose file.
docker compose pull
4. Once the latest software has been downloaded, you must issue the compose up command. This command ensures that the software running in docker is updated to the latest versions we downloaded earlier.
docker compose up -d
Backing up ownCloud Docker
Backing up your data is highly important as data drive failure, natural disasters, corruption, or accidental deletion can happen at any time and when you least expect it. Luckily, backing up data is relatively straightforward.
I recommend you can use rclone on the Raspberry Pi or something similar to copy and store the data in another location. You can also automate the following steps using a bash script and setting up cron.
1. You will need to first change into the location of the compose file.
cd /opt/stacks/owncloud
2. First, stop the docker container by running the following command
docker compose stop
3. The next couple of lines require you to have rclone installed, but they will simply sync the contents from the source location to the destination. For example, /opt/stacks/owncloud/data
will sync to /backups/owncloud/data
.
You can also setup rclone to sync to a remote location rather than local. This method is highly recommended for backing up important data.
sudo rclone sync /opt/stacks/owncloud/data /backups/owncloud/data --progress
sudo rclone sync /opt/stacks/owncloud/mysql /backups/owncloud/mysql --progress
4. Once the above two commands are finished, start the docker container by running the following command.
docker compose up -d
As I mentioned earlier, you can add the above commands into a bash script that you can then automate the backup sequence. I highly recommend that you schedule the backup to occur when the server is least likely to be in use.
Conclusion
I hope this tutorial has helped you set up your very own Raspberry Pi ownCloud. You should now be able to upload and store files within your own personal cloud.
If you are interested in other self-hosted projects, I also recommend taking a look at Immich on the Raspberry Pi. It is a great software for storing and viewing photos.
If you have any troubles, want to leave feedback or if I have missed anything feel free to drop us a comment below.
The raspberry pi can only boot into emergency mode after I attempted to mount my external storage… I have no idea where I went wrong, any ideas anyone?
Hi Gus,
There is no problem when I access my raspberry pi in local network.
But when I access it in Internet, it shows 400 bad request, the plain HTTP request was sent to HTTPS port.
I have 54321 for external port and 443 for internal port.
What should I do to fix it?
Cheers
Hello Gus,
Is there a way to install Owncloud on Apache instead of Nginx. I have already followed your tutorial to create a webserver using Apache so what should I do?
Thanks
I get an error “Can’t create or write into the data directory /media/ownclouddrive” when I try to setup the administration. I did setup an external hard drive, and can confirm the folder exists on the RPi.
New problem:
When I try to setup the admin for the first time, I get “504 Gateway Time-out”.
Hi Gus
Great tutorial!! As a complete Pi novice I was able to follow this and get ownCloud working and even syncing from my smartphone. I also added UFW fire wall. Now comes the fun bit which I do not understand.. things have stopped working…I get:
“Secure Connection Failed
The connection to XXX.XXX.XXX.XXX was interrupted while the page was loading.
The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.”
I went back through things and turned UFW off. I checked iptables was not doing anything. I checked that the cert and perm files were in the nginx folder… they were. I checked they were installed in firefox.. they were. The webserver is working OK on the local machine using the machines IP address (This is a fixed IP) and my other PC’s can ping it OK..
So now I am totally stumped.. any suggestions?
i got no error throughout the end but when at last i reboot my pi and try to reconnect it does not let me connect it. I guess this step has some thing to do with it (I don’t really know tho)
“Now simply copy and paste the following code into the file. Replace my IP (192.168.1.116) at server_name (There is 2 of them) with your Raspberry Pi’s IP.”
I’ve changed my IP to
192.168.1.9
when I type
https://192.168.0.107
instead of owncloud coming up and letting me setup I get “this webpage is not available ERR_CONNECTION_REFUSED” Any ideas? I followed all the instructions and everything appeared to work until this.Hi there!
Thank you for the in depth tutorial. It was really useful. At the very end, when I try to launch the GUI for first time setup, it shows me this:
"PHP module cURL not installed.
Please ask your server administrator to install the module."
As I am a complete beginner, I do now know what can I do more, as I installed the module as described during the installation process.
Any ideas? Thank you.
Hi Chad,
It sounds like that curl didn’t install. Can you try installing it again by running the following command.
sudo apt-get install curl php5-curl
If this comes up with an error try running the following lines to bring your Pi up to date.
sudo apt-get update
sudo apt-get upgrade
I hope this helps!
Thank you Gus! That fixed it. Other issue: just yesterday I moved, and entering the Pi’s IP does not give me anything (so not owncloud, which was the case before after applying your fix). I thought that it’s an IP issue, so I changed the new local ip at the two server_name instances as mentioned above. But it still doesn’t show up.
So I was thinking: is there a command to “start” Owncloud after a reboot (like BitTorrentSync for ex.), or is it supposed to be just accessible right away?
If there isn’t than I’m facing a problem I do not understand yet.
Adding to my previous comment, I tried reaching owncloud again on its new IP, and this time it gave me a message saying: You are accessing the server from an untrusted domain… …configure the “trusted_domain” setting in config/config.php”. So I tried to open the file, and updated the IP there also. Since than I can reach owncloud (although I did not configure it yet to external access so we shall see what the future holds). Interestingly, this “You are…” did appear only once, not before, and not after for a half an hour before I fixed config.php.
In short: problem solved.
OK, I managed to get this thing working except for ONE BIG ISSUE. I can’t see what other people are doing and they can’t see what I’m doing. If I upload, delete, rename a file the change is only visible in my account. Other account are uneffected.
What could be causing this?
Great post, found the information to be invaluable in configuring my Pi for the task.
I have a few questions, just because I’d like to shake things up with some of the settings. Is there a hardware reason why files can’t be bigger than 2GB? And what was the purpose in configuring the swap file to be 512MB? Are the two connected, like a file sent to owncloud can’t be written to media until it is held in RAM/swap (or am I reading too much in to it and the 2GB limit is arbitrary, something higher than the defaults)?
Can i set up more websites on the ngix ? because i dont want my raspi to have only the owncloud on it , seems like a waste . Can i set it up to be a webserver that has owncloud instead ?
Hello, thank you for the tutorial.
When rebooting after trying to mount the drive my pi goes into emergency mode, i have looked at the journalctl and i can see the following errors;
vc_vchi_sm_init: failed to open VCHI service
[vc_sm_connected_init]: failed to initialize shared memory service
sd 0:0:0:0: [sda] No cashing mode found
sd 0:0:0:0: [sda] Assuming drive cache: write through
Failed to mount /media/ownclouddrive.
Dependency failed for Local File Systems.
Do you have any advice?
Many Thanks,
Ricky
I have got the point of mounting the drive but when I try the IP address in a browser I get a 502 bad gateway error.
Where can I check for errors?
thanks for the excellent tutorial, how could i map the drive so it is available in windows to drag/drop files?
When I try to sign on when using a network I get nginx’s message of 403 Forbidden. I don’t believe I can forward my ethernet settings since I am at school.
The solution was to connect to the ip address via ethernet computer. I tried that and I got the same error. I believe the port forwarding is wrong even though i see a 403 forbidden
Hello thanks for the great tutorial I make it work in my home network but I did not managed to enter it from Internet it gave me page cannot be displayed, i forwarded the port 80 on the router with ip of the raspberry I ll post mine setting below can you please help me thanks in advance
'trusted_domains' =>
array (
0 => 'example.ddns.net',
1 => '192.168.1.115',
2 => '{external IP}',
),
'datadirectory' => '/var/www/owncloud/data',
'overwrite.cli.url' => 'https://{external IP}',
);
server {
listen 80;
server_name (external IP);
}
server {
listen 443 ssl;
server_name {external IP );
Hey. when i tried to edit /etc/nginx/sites-enabled/default when i tried to save aand overwrite the file, it said file could not be opened for writing, what do i do?
Firstly, great article – been running owncloud on my PiZero now for a few months.
However, I’ve only just realised that I should be able to use the TextEditor plugin for code/txt files on my drive. But every time I click on a file, it tries to download it?
It *seems* (based on doing a bit of googling) that perhaps my MIME types have not been set correctly (perhaps in nginx?). I can see my install of owncloud has the TextEditor plugin enabled and should be active for the filetypes I’m trying, but it seems something’s not quite setup correctly.
Any ideas would be much appreciated :o/
Hi there,
A great guide and most of it worked out without a problem. I’m wondering though if you can help me with a problem im having or if anybody knows solution.
I can upload files with a size of up to 200 or 300 MB without a problem. Anything bigger I get the following message: “Request Entity to Large”. If been trying to find a fix for this. I checke the
.user.ini
, thephp.ini
and also the.htaccess
again but they all have the correct values (2000M) added. I can’t really explain why it’s not working and I haven’t found a solution for it.I’m using an external HDD with is set up and formatted correctly. Also is can upload as many small files as I want so I don’t see the HDD being the problem.
Thanks again for any help in this matter.
I will test this out and hopefully find out why it is having issues with large files.
I actually found the solution myself. I the default .htaccess file the lines are written as follows:
php_value upload_max_filesize 513M
php_value post_max_size 512M
php_value memory_limit 512M
I just replaced the number at the end but you have to add an underscore as you showed it so it looks like this:
php_value_upload_max_filesize 2000M
php_value_post_max_size 2000M
php_value_memory_limit 2000M
Maybe this is a help for someone!
Chears
Great tutorial! I just had one problem. When I type in my IP to go to owncloud it gives me a privacy error. Is there any way to fix that or get around that? any help would be greatly appreciated.