Your own cloud server with Owncloud on the Raspberry Pi

The management, synchronization, and sharing of files, calendar information, address book data, music, and photos is widely used nowadays. It is offered by many (often freely available) cloud-based services like Dropbox, Sugarsync, Flickr, Picasa and many others. The big players like Apple, Google, and Microsoft also offer multiple of these services and people can use all of these with just a single account. While these “free” services might be very comfortable the not-so-free part of all these services is that your most private data is actually stored on servers that are not under your direct control and your data is often also used to generate an advertisement profile of you. If you want to have your data on your very own piece of hardware right under your control Owncloud might be an interesting option for you. It offers all the nice services like CalDAV, CardDAV, and WebDAV, which allow for managing your calendars, contacts, music, photos, and files in general in your own cloud. In the following, I give a brief overview about the steps that are needed for an installation and I present a setup script that automates the whole installation and update process. The same script can later be used for updating your Owncloud installation.

Here is an overview about the steps that are needed for installing Owncloud on a freshly installed image:

  1. Update and upgrade APT packages
  2. Make sure that the group www-data exists
  3. Install all needed packages, e.g., Apache, PHP, SQLite
  4. Perform firmware update with 240 MB RAM, and 16 MB video
  5. Generate self-signed certificate (that is valid for one year here) to be used for SSL connections
  6. Enable Apache modules that are needed by Owncloud
  7. Disable unneccessary (for Owncloud) module(s) to lower the needed resources
  8. Configure Apache to use self-signed certificate
  9. Enable SSL site
  10. Limit the number of parallel Apache processes
  11. Resize the swap file to 512 MB
  12. Download and install the latest Owncloud release
  13. Change group and owner of all /var/www files recursively to www-data
  14. Finally, restarts the Apache service

I set up a script that automates these steps and gives you a ready-to-use installation of Owncloud. You can find the script in my Github repository. This script was tested on the Raspbian distribution from 2012-07-15.

First of all, make sure that Git is installed:

Then you can download the latest PiCloud setup script with

The script is executed with

The initial screen should then look like this:


Parts of the steps done by the script were inspired from this blog.

I hope that this script is of some help for some people. I would be happy to get feedback or comments!

UPDATE: I added the possibility to use the NGiNX webserver instead of Apache . The NGiNX server does not use as many resources as the Apache and, thus, should run faster. The updated script can be found in the repository.

WebDAV access (also for iOS)

You can acccess your Owncloud instance via WebDAV by using the URL


together with your chosen user name and password.

Synchronizing with iOS

If you want to synchronize your calendar(s) and your contacts of your iOS device(s), these I formation might be of note rest for you. It seems that there are still some (documentation) issues with the official Owncloud wiki about the needed iOS settings. These settings, at least, work for me with the NGiNX installation:

Calendar (CalDAV)

SSL enabled, port 443

Contacts (CardDAV)

SSL enabled, port 443

Note the differences in the server settings!

Backup of contact and calendar data

I found this article very helpful for setting up a backup solution for the contact and calendar data.

Check Also

A Glance at the Cubox-i4

Recently, I got a grip to a Cubox-i4Pro. It is a mini computer with low …

  • decon

    I installed the the script but I can’t log in. When I try I just get a loading icon in my browser and then I get kicked back to the logon screen. It doesn’t matter if the password is right or wrong (I don’t even get an error message :/). I can’t get anywhere from the logon screen.

  • I followed the instructions and used the script and it all worked fine – I can log in locally so will now work on storage. However, I don’t know where else to ask so start here – in regards to the part of the script, I’m at a loss. I want to use my domain name with but haven’t a clue what exactly I do or what in fact I need to ask. I currently use for personal email with gmail – I followed the gandi instructions to achieve it but don’t understand it. In order to access my owncloud from anywhere on the www, how do I set it up with Do I have to use something like Simple step by step instructions for a nob would be appreciated. Thanks in advance.

    • I am using and configured my router accordingly. is then replaced by the dyndns URL. Unfortunately, I do not have the time to write a step-by-step guide in these days, but maybe someone else can post a link to such an article here!?

  • Jasper

    I tried installing this nice script, but I fail with the cloning from github. I do not have experience with git, but it gives me the following error:

    “Cloning into ‘OwnCloudPie’…
    fatal: remote error: repository not found”

    I have opened port 9418 on my router for github, but it seems I need some other setting… I use the latest Wheezy (2-9-2013).

    • Jasper

      Nevermind. Seems like I entered something wrong in the line myself. Copy pasting through telent did the trick

  • Mats Sandvoll

    What is the best way to uninstall the OC server? I want to do a clean install with apache.


    • You can uninstall nginx together with the configuration files with the command sudo apt-get purge nginx.
      The Owncloud files are installed in the directory /var/www/owncloud by the OwncloudPie Script. If you want to remove them you could do it with sudo rm -rf /var/www/owncloud

  • KissShot

    Is there any method to just change server’s IP that I typed in the first section of Installation?

    Thank you for make&sharing this amazing script!!

    • You can run the script again and choose the first menu entry only (the one that allows you to set the server URL). That will modify the NGiNX server settings as well. Remember that you need to restart the service (or the whole system if you like) before these changes take effect.

      • KissShot

        how can i modify url without selecting new installation?

      • KissShot

        i’ve solved problem by modifying “/etc/nginx/sites-available/default files”
        by manual.

        thankyou again for this script

      • Glad to hear that!

  • Bernd

    thanks a lot for this script. I had it only used for updating my existing owncloud-installation because I´m not very firm with linux. It worked fine, thanks.

  • Magnus

    Does this script work with ubuntu server 12.10 with owncloud 5.0? I want to update to 5.0.3 🙂

    • Personally, I do not have any experience with this script when used with a distribution other than Raspbian. Maybe someone else has tried it?

  • HughJasole

    How do I set the OwnCloud data directory to an external 3TB drive (/dev/sda1 mounted to /mnt/usb1)? I installed OwnCloud using the manual method and always received permission errors when trying to use a different data folder than the default.

  • HughJasole

    Does anyone know how I can change the default data directory to an external USB drive (/dev/sda1/ mounted to /mnt/usb1)?

    • pwl

      isn’t it enough to edit config/cpnfig.php ?
      i’d guess to change ‘datadirectory’ => ‘/mnt/usb1’,

    • You should mount the external drive by adding it in fstab.

      Then in my case I just make a symbolic link from /var/www to /mnt/MYMOUNTPOINT/www/
      (the command is something like ln -s /FROM /TO)
      You can do it from/to any folder.

      This is an easy workaround that works really well.

  • Mats Sandvoll

    Have anyone tried php accelerator with this script? I have installed apc, but I don’t know the best way to configure it.


  • Adam

    hello there run the script and when i try to connect I get error 403 forbidden?

    using nginx

    • The download should work in the meantime. It looks as if the Owncloud servers needed some time to provide the archive for downloading.

  • clive

    Just tried this and get a 403 forbidden page using NGINX.

    Can you fix it please.

    Many thanks

  • Red_Sparcstotting

    Thanx for a great script.
    Can’t get the certificate to work though. Always have to let myself in the back door through an exception and with a warning from firefox. Have got a dynamic “hostname =” (from Used it within the script (first prompt) and in making the certificate.
    The pi-server is at private ip so my router is set to forward the https port 443 to that ip. No problem to reach the server at “” and to administer from there if you disregard the fact that the certificate is not validated.
    Have a Thomson smart router that won’t let you forward port 80. Is that the reason for my problem?

    • What you describe sounds as if works correct: Self-signed certificates need to be “manually” trusted by the user, because they are not signed by an officially trusted authority. Just let Firefox trust your certificate and remind that decision once. At that it will not ask again.
      If you want to use an officially trusted certificate, you would need to buy it from such a corresponding organization.

      • Red_Sparcstotting

        Now I get it! Works OK with Opera but firefox forgets the exception between sessions. My bad I think. Wrong personal setting somewhere.

        Thanx again.

  • Tako

    At the end of the script I got a few errors, but it did a screen clear, the last line it left was cannot find directory /var/www/owncloud

  • Justin Booze

    Hi! First off, thanks for the script! It works great! However, I wanted to know how can I turn off the SSL requirement? I plan to run this on my local network. Also, the SSL makes it difficult for me to sync using OC’s client software.

    Thank you again!

    • You need to edit /etc/nginx/sites-available/default for that. I have not done that, though, so that I cannot give more specific advice here.

  • munklefish

    How can we update an existing installation?

    If I follow your instructions above, with a view to running the software/installer as an update, i only get as far as:


    git clone git://

    It fails saying that OwncloudPie already exists.

    Any pointers would be greatly appreciated.


    • If you used the OwncloudPie-Script for installing Owncloud, you could also use it to update Owncloud: There is a menu entry “Update” that checks for newer versions of Owncloud and downloads and installs it accordingly.

  • Yang

    When using OwncloudPie (NGiNX version) to share a file, the option for sending a URL has my resolved local IP address in it rather than my domain name (using noip) even though in the script, I have specified the domain name. Obviously, this wont work for others outside of my LAN.

    Is there somewhere in owncloud that I can change this to always use the unresolved domain name?

    • PhotonX

      Same problem for me on ArkOS (Nginx, ownCloud 5). The public URL is always set to [local IP]/… rather than [public domainname]/… I suppose there is a misconfiguration somewhere, but where?

  • Gerry

    Thanks for the script !

    Unfortunately I get the ” 403 forbidden error” described further down and it does not vanish. Also after reboot and wait and several tries. No luck.

    The nginx error log says:

    … [error] 2002#0: *3 directory index of “/var/www/owncloud/” is forbidden, client:, server:, request: “GET /owncloud/ HTTP/1.1”, host: “”

    The dir ‘”/var/www/owncloud/” looks fine:

    drwxr-xr-x 2 www-data www-data 4096 Sep 12 21:58 .
    drwxr-xr-x 3 www-data www-data 4096 Sep 12 21:58 ..

    Does anybody have a clue ?

    I’m lost as I also could not find anything similar in the OC forums ?


    • Gerry

      installing from root account (instead of ‘sudo’ and all worked fine

      I had the well known problem with the ‘en_US.UTF-8’- locale which was not installed on my system. The script did add the locale, but did not generate the chracter set. ‘locale -a’ did not list the en_US.UTF-8′

      ‘dpkg-reconfigure locales ‘ or ‘locale-gen en_US.UTF-8’

      solved the issue !

      • Thanks for that hint! I just added that to the OwncloudPie Script!

  • Alexander

    Recently installed the script and everything went smooth til the point were I would like to connect to it: Website not found and the URL path was set to (same as my Pi).
    Any suggestions?

  • Fadi

    This script is cool! I like it! Thank you 😉

  • Seventi6

    How do I go about removing all this without reformatting my drive?

    • Thanks for that question! I have just added a function for uninstalling an OwncloudPie installation to the script. You need to update your OwncloudPie Script – you should see a new menu entry “Uninstall OwncloudPie” afterwards.

  • Bosn

    Awesome script!

    I’m just having a problem configuring external USB storage post-script. I’ve mounted a 2TB ext4 USB hard drive to /media/USBHDD0 via UUID in the fstab. I then created an owncloud directory on the drive and moved the /var/www/owncloud/data directory. I gave www-data permissions to the owncloud folder on the hard drive just before the initial ownCloud web config was run to create a web admin account. In that initial setup I used the advanced setting to point the data directory to /media/USBHDD0/ownCloud/data.

    Everything runs smoothly but when I go to Admin -> Personal in the web page I see a space available that reflects only the remaining space on my SD card, NOT the hard drive.

    I’ve been stuck on this for quite a while so any suggestions would be appreciated!

  • Michael

    It worked so great for me! Thank you for all the work! I am a total beginner in linux and raspberry but I made this almost without problems.
    I’ve got 2 questions:
    1. How secure is this for me. How easily can it be hacked from outside? Can i improve the security somehow?
    2. If someday ownclowd releases a new stable version, how can I easily upgrade it?
    Thank you!

    • 1) The security of your installation depends on all kinds of things. To see what the script does you could have a look at If you find something to improve I would be glad to be told about it 😉

      2) You can update your Owncloud installation with the OwncloudPie Script form within the menu.

      • Michael

        Thank you.
        oh sure, IF I could find something to imprive, I would tell you. But I’m a bloddy beginner, so better not bet on me…
        I just hope that some kind of admin passwort isn’t (“admin” and “0000”)

        I modiefied your script in line 105.
        I added

        location owncloud {
        and added some more lines, to get access without https but with http on some other folders, so I can host a website without http…

        Thank you!

      • The script does not change any passwords so that you must change the standard passwords appropriately.

      • Michael

        can you tell me how to change the password?

      • Michael

        Ah okay, this PW I changed of course at the installation.
        I thought there could be another passwort, just for the nginx server…

  • jeff

    Stupid question: How can I press the OK-Button in main menu? One of the entries 1, 2, 3 etc. is always selected besides the OK-Button ans „enter“ selects one of the entry instead of the OK-Button.

  • Darío Alonso

    Hi there,

    Many thanks for this. It is really helpful.

    One question: after the installation, the owncloud service starts on boot or we need to configure this?


    • The web server, Apache or NGiNX, is started automatically, so that you do not need to configure this.

  • dieg0

    Standard MySQL support would be great! Performance with SQLite and more than one ownCloud user or with a few hundred files becomes really bad. Even ownCloud advises not to use SQLite ( I even think that SQLite’s suitability for single user use is a lie.

  • mazinger

    Problems after update.
    Hi, first of all, thank you for your work and this blog, I leveraged successfully on it since long time. Unfortunately I have a problem now: I just updated the raspberry installation using your script, as in the past, when the procedure went well at least a couple of times, but not this one. As background, before OwnCloud i did an update of the overall Raspian, without any difficulty; and I’m using NGiNX. After the update I rebooted, but the server doesn’t answer, either connecting the IP from the browser or directly through the OwnCloud client for OSX.
    I see many options in front of me, from a full re-installation to a more pragmatic installation over another SD card, just to test if this latest build works fine. In the first case I will lose my data, option which I don’t like too much. I regret I updated, I’m using the system to host my calendar etc and fromn all my devices.
    Please, do you have any suggestion on configuration files or any other thing I may be able to check to re-establish the full funtionality?

    • mazinger

      Update: I recreated a new installation on a new SD and it works fine. On the old one the problem is not solved. Any suggestion on what to copy – how to recover my data for the new instalation will be appreciated.

  • Detlef

    Thanks for the script – it makes my life easier. I had dealed with a lot of advices on the net but now I get it up and running within one hour.
    Unfortunately, I came across an error (but I quickly found a solution) and would like to share my findings.
    The script puts the ownCloud installation to /var/www/owncloud – that’s fine.
    But together with the nginx root folder entry /var/www leads this to an error message in the administrator page of owncloud:
    ——– German ——–
    Ihr Web-Server ist noch nicht für eine Datei-Synchronisation konfiguriert, weil die WebDAV-Schnittstelle vermutlich defekt ist. Bitte prüfen Sie die Installationsanleitungen.
    ——– English ———
    Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken. Please double check the installation guides.
    The solution which works for me is to change the nginx config file at /etc/nginx/sites-available/default and change the line
    root /var/www/; to
    root /var/www/owncloud;

    I am sure there are other solutions possible.

    • mazinger

      I confirm the problem reported by you.
      Unfortunately the solution doesn’t work for me. I restarted the server , I tried twice. I re-set
      root /var/www/;
      and it works again.

    • Paul Hein

      Confirmed. Just a restart of the server helped it.
      sudo service nginx restart

  • picajoso

    I’d like to know if some of the options available on the script works when I already have a working Nginx installation (I’ve got a WordPress blog hosted on my RPi, for example).

    Does the script overwrite that one and maybe makes the current sites and services unreacheable?


  • Ian


    Just had a go at setting this up. Thanks for the script! A few issues. In the admin page it stated that my files weren’t secure and that people on the internet could see them. I got round this by creating the .htaccess file (sudo touch) in /var/www/owncloud.

    The error message has gone away but not really sure if this is the best way! Secondly an error about WEBDAV syncing not working. I’m guessing this is because my server name and certificates are set as my dynamic DNS address and not the local IP.

    I can access fine locally, but when trying to access using my dynamic dns it just doesn’t work. Any ideas? The port forward is setup and online services report the port 8080 is open.
    I go to https://mydynamicdns:8080/owncloud (8080 translates to port 443 of my raspberry pi ip address. Netstat -n on the pi shows listening.

  • Tom

    Love your work. Thought I might try the same thing for Arch, to test performance. If it works out I’m happy to keep this in your Git repo to keep it simple for everyone. But you know linux well, I don’t, do you think Arch would probably show little difference?

    • As far as I know, Arch uses a different package management system as Raspbian. So that would at least be one difference. It should be possible to make the script run on Arch without many modifications, thought.

      If zou have something, feel free to post this at Github at!

  • Daniel Andersen

    Hey! The install went great but i can’t access locally or via my ip. I have opend port 80 for raspberry’n. I installed with NGiNX. Mayby it isnt running? I have restarted a couple of times..

    • Daniel Andersen

      Ok, i found out that nginx isnt running, this is the error:
      sudo /etc/init.d/nginx start

      Starting nginx: nginx: [emerg] SSL_CTX_use_certificate_chain_file(“/etc/nginx/cert.pem”) failed (SSL: error:02001002:system library:fopen:No such file or directory error:20074002:BIO routines:FILE_CTRL:system lib error:140DC002:SSL routines:SSL_CTX_use_certificate_chain_file:system lib)

      nginx: configuration file /etc/nginx/nginx.conf test failed

  • John

    Just wanted to thank PetRockBlog for this super easy way of getting Owncloud onto my Raspberry PI. I now have my own cloud server running the latest version of Owncloud 7.0.2 at time of writing.

    Thanks again PetRockBlog all your hard work to make installing Owncloud nice and easy for everyone is really much appreciated.

  • Ho Wil

    I used your script to set up a Pi as fall-back solution for my owncloud on a cubietruck. It works very well.
    Does anyone have experience with using this script on a cubieboard or cubietruck? I guess since it is ‘just’ (impressive work!) a shell script the chances are high that it works on any arm board?

  • dondon

    There are some problem with the scripts.After instaling NGINIX server and owncloud the result is that i can see only empty screen .It’s look like there is misconfiguration in php

  • SithLordRick

    First off a HUGE thank you as this made installing OC much easier on the Pi 2 than what I was dealing with beforehand. Problem though is how can you logon to the console? I don’t recall setting a Admin password I will say I was working on this late last night so maybe I did miss it but I’m pretty sure there is a admin account for Owncloud..

  • MikeDPitt420

    Thanks very much for this script 😀 I set it up a while back and am running version 6.0 using nginx. Everything has been working great, including folder syncing with android and windows, although I had to make some changes for nginx and webdav to work. If I use the script to upgrade to the newest version, is there a way to keep my nginx settings and insure webdav will continue to work as well? What would be the easiest way to perform this upgrade without “breaking” my current setup? Also, in the newer version is the file size limit larger ? Or is this a dependency of the pi?

  • jso

    Cool script indeed 🙂 Unfortunately, the update function fails on latest owncloud versions which require an .htaccess file to be copied. Unfortunately, the current scripts’ “cp -r owncloud/* /var/www/owncloud/” is missing dot files. Perhaps you want to fix this…

  • Ironheiner

    Hello, very good script. I just had install my Owncloud Pi several times with it. But now I had a Pi 2 and would like to install owncloud there.
    Works your script with the owncloud version 8.2.1?

    • Edwin W. Heiser IV

      any luck? i also want to try this on a pi 2

  • octhrope

    Attempted to install this multiple times both with apache and nginx. script no longer is valid. 5-4-2016

  • tarod208

    This was a huge help! Thank you so much for sharing this. While I am here I want to write another big thank you for all of your work with Retropie. Thank you and thank you!!

%d bloggers like this:
Skip to toolbar