Introduction: OwnCloud 9 on Raspberry Pi - DIY Dropbox

Picture of OwnCloud 9 on Raspberry Pi - DIY Dropbox

Everyone has data, and whether you store it locally, or pay for a cloud-based service, there never seems to be enough storage space to go around. In this project we are going to take control of our data using a small chip computer known as the Raspberry Pi. After you are done, you will have a cloud-based storage solution for a fraction of the cost a service like Google Drive or Dropbox.

Some features of OwnCloud:

  1. Free
  2. You are in control of your data
  3. An iOS and Android app to sync files, and more importantly, photos and videos, automatically
  4. Accessible from anywhere

EDIT: This Instructable has been superseded by my NextCloud Instructable, while OwnCloud is still available and relevant, I would HIGHLY recommend it over OwnCloud.

Step 1: What Do You Need?

Picture of What Do You Need?

For this project, you will need...

  • One Raspberry Pi, I would recommend the Pi 3 because it is the fastest model, and has a built in WiFi chip, all for the standard price of $35. The older models will work, (with varying degrees of success) but I do not recommend the Zero, it has no display outputs, and is substantially less powerful.

  • One SD card for the Pi, make sure to get the right one for your Pi, some require a Micro SD, while others take a full size SD card. For those of you with a Pi 3, you will need a Micro SD. It should be at least 8GB, otherwise, you will run out of space.

  • One data drive, I use a Seagate External HDD, this works extremely well, although I am sure that this tutorial will work with other models as well. Another option is to just buy a very large SD card, and store the data locally. The only disadvantage to this is that you will not be able to unplug the drive from the Pi, and be able to view the data from a computer, which I have found to be quite helpful.

Step 2: Install the Operating System

Picture of Install the Operating System

The first real step in this process is to get the OS installed on the Pi. To start, you will need a few things...

  1. Win32 Disk Imager, a program that will write the OS to the SD card
  2. The image file, this is the actual operating system

You can download Win32 Disk Imager from the link below

You can download the Operating System by clicking below

Once you have all of these files and programs, get them extracted and running on your computer, once that is done, look at Win32 Disk Imager. If you click on the little folder icon, it will pull up a window that lets you find the extracted image file. Select that file, and with the SD card plugged in, click write. Make sure that you are writing the correct drive though! It will ask you if you want to continue, and just click yes until the process starts. Once that finishes you are ready to move on to the next step.

Step 3: How to Acess the Pi?

Picture of How to Acess the Pi?

To begin work on your server, you have a few options, the first is to just plug the Pi into a monitor and add programs through the terminal, but this can be a little tedious. What I do and would suggest for anyone is to access the Pi through SSH, which basically means that you are using a computer to access the Pi from your home network. Something to consider is that SSH only provides the terminal, there is no GUI, but this should not be a problem.

As a side note, there is a virus going around the internet known as Mirai, and it infects IOT devices, such as the Raspberry Pi when they are open to the internet and still use the default password. Because of this the Raspberry Pi foundation disabled SSH access by default in the latest OS release. I still have an old copy, so I have used that one to start with SSH enabled, and from there immediately change passwords and update the OS from the terminal. They claim that there is a way to enable SSH by placing a file titled ssh in the boot directory, and that will tell the kernel to turn it on, but I have not figured it out. This means that you may have to connect it to a screen, at least to enable SSH access.

For those of you who want to use a SSH client, I use PuTTY, which you can download by clicking the link below

You access the Pi through this program by inserting the Pi's IP address , which can usually be found in your router configuration page, or by running the command ifconfig in the terminal, and then clicking Open. It will warn you of some stuff, but it is your Pi, so you can click yes. Make sure to change the default password if you are using this method.

Step 4: Install OwnCloud

Picture of Install OwnCloud

This seems a little counterintuitive, but installing OwnCloud first installs the necessary programs to run a website. This means that you install one program and get more than one. This makes for an extremely easy install, you not only get OwnCloud, but you also get Apache, and the necessary programs that allow Apache to read php files.

To install OwnCloud, you must elevate to root. This can be done in the terminal by typing sudo -i

Next, you need to copy some things into the terminal.


wget -nv -O Release.key


apt-key add - < Release.key


sh -c "echo 'deb /' > /etc/apt/sources.list.d/owncloud.list"


apt-get update


apt-get install owncloud

These commands will install OwnCloud, however I am not sure they will install updated versions as they are released. As of today, the 20th of December 2016, the latest version of OwnCloud is 9.1.3, and if you want to make sure that you are installing the latest version, you can find these commands at the link below

Step 5: Install Dataplicity

Picture of Install Dataplicity

So, now OwnCloud is up and running but it is only accessible from your home network, to make it accessible from anywhere, we will use a service called Dataplicity. There are other options, but I have found that this works the best when compared to other services, like using a DNS service like No-IP, because they provide an unsecure connection, that you can secure with a self-signed SSL certificate, which your browser does not trust. Dataplicity is the best option.

Start by going to

and creating an account, then copy the code that it displays into the terminal of your Pi. Once the install is finished, go into the website, it will direct you to your Pi, click on it and you will see a terminal similar to what you have been using to edit the files on your Pi. If you want, you can use this website to edit your Pi from anywhere, not just your home network.

Take a look around, and click on the "Activate Wormhole" button, this creates a secure website for your Pi, and you can access it from anywhere. It opens to the Debian Default Page, which is completely worthless to us, which leads us to the next step...

Step 6: Redirect to Owncloud

Picture of Redirect to Owncloud

As I said before, the Apache Default page is useless, so it would be really great if we could simply redirect you to the OwnCloud homepage instead.

Download the text file at the bottom of this step to get started,

Copy that long series of numbers in your web address for the Pi, and replace the x's with it. (There are three lines that you have to change), then copy this text.

Type in the terminal,

sudo nano /var/www/html/index.html

and a page with a lot of text should open. Delete it all, and paste in the text from the file you just modified. This will redirect you to the OwnCloud homepage.

Save and exit by following the onscreen commands. (The up arrow means "control")

Step 7: Configure the Storage Device

Picture of Configure the Storage Device

So before you setup OwnCloud, we first have to setup the storage device to be used as the data directory. Whatever you do, do not do anything to OwnCloud through the website just yet!

**It has been brought to my attention that I did not specify a file system for the drive. For this tutorial and fstab permissions to work, the drive MUST be formatted as NTFS! I do not know the equivalent FAT32 permissions, and have run into problems when attempting to use that FS. Make it easy on yourself and use NTFS!

The first step is to make the data directory, you can do this by pasting the command below into the terminal.

sudo mkdir /mnt/clouddrive

Then, you should check where the drive is located in the system by typing,

sudo blkid

The output for the drive I am using is

/dev/sdb1: LABEL="Seagate Expansion Drive" UUID="5E2EC4372EC40A4B" TYPE="ntfs" PARTUUID="19216f8a-01"

And the important thing to notice is the /dev/sdx part. This will be important when we mount the drive.

Next, I have found that Raspbian automatically mounts my HDD, so to mount it where I want it (/mnt/clouddrive) i need to unmount everything by typing

sudo umount -a

Then I can mount it by typing

sudo mount /dev/sdb1 /mnt/clouddrive

When you do this, change sdb1 to whatever you saw when you input blkid for your drive, if it's the only drive plugged in to the Pi, it will probably be sda1.

So now the drive is mounted, but this is not permanent, if you turn the Pi off, it will have to be remounted. But fear not, there is a solution. Open fstab by typing

sudo nano /etc/fstab

Download the text file below to edit.

This will ONLY work if your drive is formatted as NTFS, otherwise, the Pi will think that is uses a different File System!

You will notice that I have one line that is different, and this is the line that I use for my fstab. You have two options...

  1. Leave the file as is, but replace the UUID with the UUID you get from running blkid, and then copying the new line into fstab on the Pi
  2. Or replacing UUID=############ with /dev/sdxx (your devlink from running blkid) and

    then copying the new line into fstab on the Pi

The reason I give you these options is simple. The first one is the most complicated, but it will ensure that your drive always mounts to the same point, even if you plug in more drives. The second option is easy, but if you plug in more drives, it is likely that your storage drive will not mount to the same place, and OwnCloud will not know.

Step 8: Setup OwnCloud

Picture of Setup OwnCloud

This next step is super simple, all you need to do is go on to your server's website, and it will ask you to create an admin account. Do that, but before you click finish, change the data directory by clicking on the "Storage and Database" button. If you guessed that you should change it to /mnt/clouddrive , then you are correct, change that, and then you can click finish. It will open to a first run wizard, which you can read over, if you want.

Step 9: Extra Parts

Picture of Extra Parts

So at this point you are pretty much done, but there are some steps that I would highly recommend doing to make sure that your server is functioning at its peak.

  1. Enable a php accelerator, this will drastically decrease loading times for the pages of the site, and I can say that this is a must for anyone who wants to use this as a practical solution for their life.
  2. Enable external storage and install smb client, for me, I have files on my HDD, and I want to see them from OwnCloud, but when I open the site, they are not there. For people who have preexisting files on their drive, this is a huge time saver.
  3. Setup hdparm, this is program that automatically spins down your hard drive when not in use, for anybody using an external hard drive, this will undoubtedly extend the live of your drive.
  4. Expand the upload limit, who doesn't want to upload bigger files? Remember if you have to put a large file on the server, you might be able to plug the drive into another computer, and move it from there before plugging it back in.

To enable the php accelerator, simply copy this into the terminal

sudo apt-get install php-apc

To enable external storage, simply go to the apps pane, this is under the dropdown menu at the top left. And go to "Not Enabled" Find External Storage Support and enable it. Now under the admin tab you can add external storage mounts. For me, my files are located in the same data directory my uploaded files would be, so I would add a local storage mount, with the location /mnt/clouddrive/name/files

If you also have preexisting files, do this, and replace name with your admin username. Once the files show up, you can even delete the mount point, and it will still recognize them!

To setup hdparm or any other spin down service, all you have to do is follow this tutorial, it's easy, it makes sense, and I don't think I can explain it any better, if you want it, it's here.

One side note on that, I set my drive to turn off after two minutes, which works pretty well, I've had no problems with it, and see no reason for it to wait 10 minutes to turn off. That is a value of 24 in the spindown_time variable, if you wanted to know, if you have problems, let me know, I am tweaking my settings now, but if you have trouble I'd be happy to help.

One more thing, the app seems to automatically load when I get home, a little hard to explain, but on iOS, the device picks up that I am home, and almost queues the app in the background, which causes the drive to spin up as long as I am connected to the internet, I'm trying to get to the bottom of it now.

Finally, expanding the upload limit can be done from the admin page, I have found that setting it at 1.95 GB makes it default to 2GB, the highest, but when the input is 2GB it doesn't work.

Step 10: Tips for Sucess

Picture of Tips for Sucess

So, now that you have finished your server, I will leave you with some tips, with the advent of Mirai, you may want to consider adding a firewall to your Pi, I do not use one, but it would be a great security measure if you don't mind the slower speeds. A good one can be installed by typing

sudo apt-get install ufw

and then

sudo ufw enable

be warned, it will disrupt all SSH connections, so make sure to run

sudo ufw allow ssh

Additionally, don't be afraid to try things, you just built a home based cloud server, and if it breaks because you are trying to make it better, so what? You can make a backup disc image just in case you break anything, or even start over. It's always repairable. Leave comments below on what you thought of this project, things that you did to make it better, as well as overall feedback, it would be greatly appreciated.

Lastly, make it look good! If you are using this as a real life solution, make sure that it has a permanent place, somewhere you won't accidentally step on it. I've mounted mine to the wall of a closet, and that's where it lives, in fact, I'll even include a picture of what it looks like, so anyone who wants an example can see one.

If you noticed, I have some extra lights on my Pi, these are USB flash drives that I stripped down, when plugged, in they have some lights that adds a little bit to the whole look, there are so many ways to make it look good, let me know what you did!

Congratulations on completing this project, it is definitely not easy, and for Linux beginners, this is something to be proud of. I made this Instructable because when I started on my journey to build a cloud server, there were no good, reliable tutorials, they all had very little to them, and were not helpful. Overall, it took me a year to finally finish, and to have a product that I am satisfied with. I felt like it was my duty to help people in the same place that I was. Let me know if you have ANY questions!

P.S. I would HIGHLY recommend the iOS app to complement the server, it is well worth the $0.99 because it automatically uploads pictures that you take to the server. I cannot speak for the android version, but from what I have heard, it is much better than the iOS version.


newbipi (author)2017-10-15

hi, I'm stuck on step 6 apparently i dont have the directory /var/www/html/index.html i have searched the pi's directory up to /var/www and only 3 other directories exist in there.

rexN5 (author)2017-06-01

hello. thanks for the tutorial! i jisy want to know which directory was the owncloud installed in?

FlyingHazard (author)rexN52017-06-02

It should have been installed into /var/www/html/owncloud. If you like OwnCloud, try out NextCloud, it's better, although a little harder to set up, but I think that you will like it a lot more, especially when considering performance! I wrote an Instructable on it too, maybe consider checking it out!

rexN5 (author)FlyingHazard2017-06-02

thank you! i will look into that

Thomas sxt (author)2017-03-19

Hello ,

Great tutorial thanks !I used raspberry 3 and I have issue uploading large file with with windows it get stuck at 99% , i also tryed cyberduck do you have an idea what can cause this

FlyingHazard (author)Thomas sxt2017-03-19

I have had that problem before as well, and unfortunately, I haven't found a solution. I am working on an Instructable on setting up Nextcloud, which is OwnCloud but MUCH better, with that you shouldn't experience these problems. Otherwise, you could try unplugging the drive and just uploading the file from your PC. Sorry I couldn't help more!

Thomas sxt (author)FlyingHazard2017-03-19

Thanks for you answer ! I gonna check nextcloud

FlyingHazard (author)Thomas sxt2017-03-19

Yeah, go for it! The install can be a total pain, so don't worry if you don't get it right away. I'm planning on releasing that Instructable in the next few months, but I have a lot going on right now. I'm working on a VPN for bypassing an adaptive firewall, so that's a pain. Good luck, I have it partially working, but even now I can tell it is a much better system!

Thomas sxt (author)FlyingHazard2017-03-19

i Know the feeling ... good luck for your work!

MattB374 (author)2017-03-16

Similar to henelolx, I'm having issues getting to my owncloud server for the last step. When I use the link from dataplicity it opens to a page titled dataplicity port forwarding that simply says Not Found. I've double checked the string of letters/numbers for my device and made sure it's typed right in the html. Any suggestions?

FlyingHazard (author)MattB3742017-03-18

That's pretty weird, you're implying that you're clicking in the link in the website. If all goes as planned, the script should redirect you to the correct page, which is

If you aren't redirected to this, then something is wrong. Alternatively, this message is not a 404 error. This means that something is wrong with Dataplicity. Maybe try running the install again by clicking add a device and running that code in the terminal. Sorry if this is a little confusing, let me know if you have any questions.

MattB374 (author)FlyingHazard2017-03-18

I have the server up and running now, Thanks! The error came from using the roughly 20 digit long number from the dataplicity url instead of the 10 digit wormhole number. I do have one more question, The dork that I am managed to forget to change the data directory to /mnt/clouddrive, is it still possible to change this somewhere?

henelolx (author)2017-03-05

help! when I got to my servers web site it just says "404 not found" and "nginx/1.6.2" below it

FlyingHazard (author)henelolx2017-03-05

Hi, this means that the files for the website are not in the location that you typed in the URL. You can find the location of these files by going to /var/www/html and typing the command ls -la to get an output of the files stored there, and changing the URL accordingly. This could also be an NGINX problem, so maybe consider running apache instead. Let me know if you have any more questions.

Jason27 (author)2017-02-21

I'm having a very strange issue. I have set up everything and i am sometimes able to put files on my Owncloud. BUT, my Dataplicity losses connection to my pi after about 3 seconds and it keeps cycling on and off. I also keep getting messages about how i cant connect to the server from Owncloud (Remote Service Unavailable). I am very new to all things raspberry pi, so all help is appreciated!

Jason27 (author)Jason272017-02-21

I also just plugged my external HDD into my laptop to see if the files i was able to put on owncloud were on there and there was nothing there...

FlyingHazard (author)Jason272017-02-21

That's pretty weird. In theory, this project would work (with different fstab permissions) if you used a native Linux file system, like ext4, which Windows can't understand. Since you're new to RPi (and probably Linux?) I'm willing to bet this is not the case. Best bet - check the database. If I had to guess, there may be problems with the mountpoint. As for Dataplicity, there's not a lot I can do for you, but they are doing some changes to the system (I think) so maybe try updating your dataplicity client. If nothing works, you may have to try a fresh install, that may be the only thing that works. In fact, I'm in the process of rebuilding mine now! I was trying to build a whole house audio server and well...?

Jason27 (author)FlyingHazard2017-02-22

I will be resetting my Pi and starting over. It seems like a better solution than trying to fix whats already messed up. I really appriciate the response!

FlyingHazard (author)Jason272017-02-22

Ok, that's probably what I would have done too. Once you get it working, you can create a disk image of the software that you can flash if you break it again. Fair warning, the image is about 16GBs, but it's pretty useful. (I'm saying this having not listened to my own advice!) Good luck!!

Jason27 (author)FlyingHazard2017-02-27

I got it working now!!! SORTA... haha I am officially seeing all the files I have uploaded in real time on my HDD. The issue is that Dataplicity is still timing out and causing issues with occasional files. I am able to add PDF's and Word docs but any PPT file doesn't upload with a "Remote Server Unavailable"... I am having the weirdest issues...

SamB211 (author)Jason272017-02-28


FlyingHazard (author)SamB2112017-03-01

Try that ^^^

Good luck!

FlyingHazard (author)Jason272017-03-01

Maybe try a reboot? Or even re-install Dataplicity by selecting add device in the web browser. It might mess with the wormhole configuration though! I've honestly never seen this before, so I'm just trying to think of what I would do, let me know how it goes!

RudyR31 (author)2017-02-18

fixed that, now it throws a "MySQL/MariaDB username and/or password not valid You need to enter either an existing account or the administrator." error! too many errors :(

FlyingHazard (author)RudyR312017-02-18

Hi, when you set up the database at first, (when you set up the admin user) make sure that you are using SQLite as the database. It appears that you inadvertently changed it.
Let me know if it works!

BlakeH49 (author)2017-02-03

Thank you for this guide. It has been a great help. I do have one issue and its a little frustrating because its the last step. When I'm setting up in OwnCloud I get the error Cannot write data into /mnt/clouddrive. I am testing things out with a thumb drive before I go out and buy a new HD. The thumb drive was reformatted to NFTS. Here is what my fstab is

proc /proc proc defaults 0 0

/dev/mmcblk0p1 /boot vfat defaults 0 2

/dev/mmcblk0p2 / ext4 defaults,noatime 0 1

UUID=7CF40B2FF40AEB6A /mnt/clouddrive ntfs defaults,uid=33,grid=33,umask=007,nofail

# a swapfile is not a swap partition, no line here

# use dphys-swapfile swap[on|off] for that

Thank you again

FlyingHazard (author)BlakeH492017-02-04

Quick question, did you set up the flash drive as the data directory, or configure it as external storage? If it's set up as external storage, it might not work, at least that's the error I got when I first tried what you are doing. I'll have to play around with mine to see if I can replicate the issue. Sorry I can't help right away. You could try running

sudo chmod 777 /mnt/clouddrive

To change the permissions of the drive to readable/writable by any user. If that works make sure to set strong directory permissions afterwards because those permissions leave your data extremely acessible to the internet. (Link here for instructions - )


sudo chown www-data:www-data /mnt/clouddrive

To change the owner and group of the mount point.

BlakeH49 (author)FlyingHazard2017-02-04

Thank you for the help. I tried both and they did not work. I found an external HD I had forgotten about so I tried it with that and had the same issue. Here is the fstab from when I tried it with the HD. I'm not sure if its setup as the data directory or as external storage. This is my first time doing a project other than setting up retropi machines and those are very easy.

roc /proc proc defaults 0 0

/dev/mmcblk0p6 /boot vfat defaults 0 2

/dev/mmcblk0p7 / ext4 defaults,noatime 0 1

UUID=861E215E1E21490F /mnt/clouddrive ntfs defaults,uid=33,grid=33,uma$

# a swapfile is not a swap partition, no line here

# use dphys-swapfile swap[on|off] for that

FlyingHazard (author)BlakeH492017-02-18

So sorry I forgot to reply! Try to set strong directory permissions through the terminal, it might work other that that, and I'm really sorry, I don't know what to do. You could check a forum for OwnCloud.

TimonŽ1 (author)2017-01-31

HELP! :(

When setting up my OwnCloud I get an error saying "Cannot write data into /mnt/clouddrive". What can I do :(?

FlyingHazard (author)TimonŽ12017-01-31

Hey! I had that problem too!!

Just messing with you, I'd be happy to help. First a few questions, and then I can explain.

1. What drive are you using, and more importantly, what file system is it using?

Your file system, or FS helps the computer read the drive, you can find this out by plugging it into a PC and left-clicking properties.

2. What is your fstab entry?

Copy and paste the contents of your /etc/fstab file in your reply, or just attach a screenshot.

So that error you are getting usually means that OwnCloud does not have permission to read or write to your drive, this means that it cannot do anything. This can be caused by incorrect mount permissions (fstab) and this is usually a file system problem. I forgot to mention this, but all drives should be formatted as NTFS for this tutorial to work.

Finally thanks for asking, and especially for commenting instead of messaging me directly, that way people can find the answer if they have a similar problem!

Thanks! Let me know your settings, and I should be able to fix this!

Just a note, I added to the Instructable that the drive should be formatted NTFS.

gerardomaduro1 (author)2017-01-04

Simple and functional! You know MLDonkey? I have a simple guide to make a emule/torrent download server with a RPi!

Thanks, I took a look, that sounds pretty cool, I might give it a try at some point!

I have this guide but in spanish..

Nice I checked it out with my limited Spanish knowledge and it doesn't seem that hard but at the same time has a really useful function, I'll give it a try!

If you want, I can help you with that.. I have a little server with MLDonkey server running

I can help you if you want, I speak spanish hehehehehe

Actually, my Spanish knowledge has just improved dramatically with the help of Translator for Microsoft Edge, it's amazing just how quickly you can learn!!

JacobR4 (author)2017-01-05

WOW!!!! i have a Raspberry pi and i will attempt to do this! great idea! I was looking online for a RP NAS, Thanks!

FlyingHazard (author)JacobR42017-01-05

Cool, thanks, let me know how it goes!

BenManning (author)2016-12-31

when i type "sudo nano /var/www/html/index.html" into the terminal a blank page opens up when there is meant to be text inside it. Can you help me?

FlyingHazard (author)BenManning2016-12-31

So there should be text, but it may not matter. When you go into dataplicity click on the wormhole link. If you see the apache default page, then the file path is wrong. If it's blank, then it may be reading the file you wish to modify, it is blank, so it should show a blank page. If it's blank you can continue. If it's not, read the apache default page. It will tell you where the HTML for that page is located and you should modify that. I hope that made sense! Let me know if you have more questions.

Swansong (author)2016-12-21

This is a great alternative :)

FlyingHazard (author)Swansong2016-12-22


Sebastian Arnke (author)2016-12-21

Why don't you use Nextcloud indtead of Owncloud? It is more secure and fully open source?

Honestly, I had only used OwnCloud, but when I looked up NextCloud, they seemed pretty similar, and at this point, I see no reason to change what works really well for me. Now that you point it out though, I may give it a try in the future.

About This Instructable




Bio: FPV Pilot, RC Fanatic, broken NextCloud Server too many times to count. Latest projects include whole home audio system based on Forked-DAAPD and Shairport-Sync as ... More »
More by FlyingHazard:Raspberry Pi Safe Shutdown/Reboot With Amazon Dash ButtonsA Guide to Learning and Understanding the Alexa Skills KitRaspberry Pi AirPlay Speaker
Add instructable to: