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:

[gist id=3358189]

Then you can download the latest PiCloud setup script with

[gist id=3358194]

The script is executed with

[gist id=3358196]

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.

195 thoughts on “Your own cloud server with Owncloud on the Raspberry Pi

  1. tarod208 says:

    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!!

  2. Ironheiner says:

    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?

  3. jso says:

    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…

  4. MikeDPitt420 says:

    Thanks very much for this script :D 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?

  5. SithLordRick says:

    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..

  6. dondon says:

    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

  7. Ho Wil says:

    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?

  8. John says:

    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.

  9. Daniel Andersen says:

    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 says:

      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

  10. Tom says:

    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?

  11. Ian says:


    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.

  12. picajoso says:

    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?


  13. Detlef says:

    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 says:

      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.

  14. mazinger says:

    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 says:

      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.

  15. Darío Alonso says:

    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?


  16. jeff says:

    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.

  17. Michael says:

    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!

  18. Bosn says:

    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!

    • petRockBlog says:

      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.

  19. Alexander says:

    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?

  20. Gerry says:

    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 says:

      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 !

  21. Yang says:

    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 says:

      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?

  22. munklefish says:

    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.


    • petRockBlog says:

      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.

  23. Justin Booze says:

    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!

  24. Tako says:

    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

  25. Red_Sparcstotting says:

    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?

    • petRockBlog says:

      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 says:

        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.

  26. Mats Sandvoll says:

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


    • jijijaco says:

      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.

  27. HughJasole says:

    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.

  28. Bernd says:

    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.

  29. KissShot says:

    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!!

    • petRockBlog says:

      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.

    • petRockBlog says:

      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

  30. Jasper says:

    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).

  31. joffa says:

    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.

    • petRockBlog says:

      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!?

  32. decon says:

    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.

  33. jijijaco says:


    I’m a little concern about the rpi-update done herein.

    If I’m not mistaken, the rpi-update script is updated (and owned) by raspbian, do you really need to fetch it from “” ?

    I think that the apt-get upgrade is sufficient enough.

    Great script anyway, thank you for it !

  34. Andrew says:

    Will this script work with my previously install Raspbmc? Is there a way to manually configure the two. How does the web interface work with XBMC’s web interface?


  35. hack2009 says:

    its not working for me on the latest release of wheezy. it bypasses the making of the certification and when I go to xx.xx.xx.xx/owncloud it redirects me to

  36. Christoffer Hauthorn Boisen says:

    How well is the Raspberry-Owncloud combination performing? I’m thinking about replacing my Dropbox-setup with this, but I wonder if the Raspberry is any good for this type of solution. No files are larger than 100mb, and most files are probably less than 1mb in size.

    • petRockBlog says:

      I have nearly no experience with the various versions of the Owncloud client. Maybe someone else here?

      One thing to consider is the upload speed of your DSL/cable internet connection. I can live with that in my case, though.
      Setting your RPi up with Owncloud is quite easy with the script here. I would simply go for a try.

  37. Mats Sandvoll says:


    I downloaded the Owncloud app for iOS and wanted to connect to my server. After I upgraded to the newest Owncloud version I’m not able to connect to the server any more. I tried to access the path; http://yourServerUrl/webdav.php/remote from a web interface, but I can’t connect. I get the following error: Access error: 404 — Not found. The owncloud support told me that the problem should be solved with enabling all http verbs. How can I do that with Nginx?

    Thanks for the help.

  38. David says:

    1st off left me say thank you for this. I forgot to thank you last time, how rude of me. I believe I found another bug in your script. Not entirely sure where its at though. Its a permissions issue with a temporary directory. Upon trying to export users it throws an error saying no permissions to create zip in tmp directory. It doesn’t say what the location of the tmp directory is though :(. I tried chown’ing the /tmp directory with ownclouds user you set with no go. Maybe you could add that to the list

    • petRockBlog says:

      Hi David, I tried out the export function for a user on my installation. Even though it was quite slow everything worked fine. I have to admit that it were only 2-3 MB overall. Maybe the amount of (user) data was too large? I read at that doing a manual export of the user data (in case of a large amount of data) might be the best solution. However, I have only very limited experience with the export topic.
      Currently, I am “only” using Owncloud for storing my contacts and calendars. I perform a backup with a shell script that is called as a cronjob from a NAS in out local network.

  39. daniel says:

    Hey I was able to install my owncload and i was wondering if it possible to upload files larger than 512. I would greatly appreciate an answer. Btw the script is awesome !!!

    • David says:

      yes you are able to, log in as admin. go to the settings gear in the bottom left click the admin tab. Then change the size from there. Before warned if you change it higher than that you might run into timeout issues of where it never uploads

  40. David says:

    I believe I found a bug in the script. Everything runs and installs fine but when you use the function “main_setservername()” It’s not updating all instances of what you set. Whatever I set in the interface you created you can go to “https://urlname/owncloud/” which will work. If you type in just regular “http://ipaddress” It will still try to, but it redirects. it will be the default of what you set of “”. No matter how many times you update it via the interface on the script it wont update the original instance of it.

    Also one way to optimize your owncloud instance, you could install “php-apc” which just caches frequently used php scripts. The load time for the website goes down considerably.

    • Florian says:

      Thank you!
      If you want to have the Owncloud instance and it’s web server publicly available it is important to have the latest fixes/updates (possibly security relevant fixes) installed. I agree that apt-get upgrade typically updates more than the Owncloud relevant components, but it is the easiest way to ensure that all relevant updates are installed. Also, compared to time your Owncloud instance is running (in my case 24/7), running apt-get upgrade during the Owncloud installation does not seem to be much time in contrast.
      Just my opinion though.

  41. Gio Kanaan says:

    hello, I apreciate you taking the time to create this script it has helped me a lot. but I have a problem, due to a power surge i have had to re install Owncloud several times. Now it only works when i am on my local network and if i restart my browser. I do have a proxy so i am wondering if that could be a issue.


  42. Mats Sandvoll says:

    Hi, and thanks for the great script!
    I’m having a problem with changing the owncloud data directory to a directory on a external hard drive. I have mounted the hard drive to /mnt/DISK and created a directory (owncloud) inside, so /mnt/DISK/owncloud. I have also set the permissions to www-data;

    pi@raspberrypi /mnt/DISK $ ls -l
    total 0
    drwxr-xr-x 1 www-data www-data 4 Jan 22 19:29 owncloud

    Then I changed the datadirectory in the config.php in /var/www/owncloud/config directory;

    ‘passwordsalt’ => ‘#######’,
    ‘datadirectory’ => ‘/mnt/DISK/owncloud’,
    ‘dbtype’ => ‘sqlite3’,
    ‘version’ => ‘4.90.7’,
    ‘installed’ => true,

    When I try to load my owncloud server I get “502 Bad Gateway, nginx/1.2.1”.

    If I change the datadirectory back to /var/www/owncloud/data, It works as normal but I would like to change the directory to /mnt/DISK/owncloud. The external drive is running a HFS+ file system, but that should’t matter since I have read and write access.

    Do anyone know what to do?

  43. ligurius says:

    Maybe someone can help. Seems owncloud did install correctly (yay!). I did input my local IP as server url. Now when i try connect to or i do get :

    Error –
    The page ‘’ couldn’t be loaded.
    Cannot connect to destination (XX.XXX.XXX.XXX)

    someone did ask before about changing the adress in /etc/nginx/sites-avilable/default but this did not help. So what did i do wrong and how to fix it?
    Im newbie when it comes to linux and stuff like that :).

  44. Eric says:

    Hi, first of all.. Thanks for the script.
    How can i change the directory of owncloud? Is it possible to make a forward to the directory owncloud?
    ” ”
    didn’t did the trick for me..

    Can you help me?

  45. RpiNewbie says:

    new into RPi and OwnCloud worlds, your script was very useful to me…thanks for making that available!

    Couple of comments/suggestions:
    -while the initial installation worked fine, after messing around with the first OwnCloud install, I wanted to restart with a fresh one. There the script didn’t want to override/refresh any of the existing config file (NGINX,…). I deleted some manually but that’s not ideal as some didn’t get recreated.
    => maybe add an option to “cleanup/uninstall” existing install?

    -add an option to only change the server URL and associated SSL certificate (that can also be used when one will need to recreate the expired SSL cert)


    • Name says:

      Best for a fresh restart is to purge all previous installed packages with
      ”sudo apt-get purge nginx sendmail openssl ssl-cert php5-cli php5-sqlite php5-gd php5-curl php5-common php5-cgi sqlite php-pear php-apc git-core autoconf automake autotools-dev curl libapr1 libtool curl libcurl4-openssl-dev php-xml-parser php5 php5-dev php5-gd php5-fpm“
      ”sudo apt-get autoremove –purge“
      before starting the script again. This should give you a complete new start.

      • RpiNewbie says:

        Thanks! I will keep that for the next time as my setup seems to be running fine.
        One small issue I had after the 2nd install (so I am not sure whether it is related to my system or to the script): the directory “/srv/http/owncloud” (which is apparently used for some caching) didn’t have the right ownership (and therefore permissions): it was owned by root instead of www-data. This didn’t seem to have any impact on the behaviour of OwnCloud, but the NGINX error log was reporting some PHP mkdir() permission errors.

    • Thomas says:

      Hey gaborgabor2, may you please post some more details? How did you run the script (which commands)? What if you reboot your pi and try to run the script again?

      The script is working for me with a clean install of raspbian wheezy. There must be something wrong with your system…
      Which operating system are you using?

  46. Thomas says:

    Me again… There is a security issue in the official nginx configuration recommended by the owncloud-wiki (so your script is vulnerable as well):

    Just include the line “try_files $uri =404;” in the php-location-block, so that the configuration looks like this:

    # enable php
    location ~ .php$ {
    try_files $uri =404;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param HTTPS on;
    include fastcgi_params;

    Otherwise it is possible to execute any php-code on the server and as a consequence compromite it.


    • Florian says:

      Thanks a lot for that!
      I have inserted your patch into the script.
      However, I do not have the RPi accessible for the next three weeks, so that I was not able to test it. Someone is already experiencing a problem. Did I insert your patch as intended? Do you see a problem?

      • Thomas says:

        I’m using this patch in my installation and everything is working fine.
        Adding a line to the nginx-config won’t harm the installation-process. The problem of gaborgabor2 must be somewhere else.

      • Thomas says:

        Maybe it is a good idea to not touch the sdram_freq and core_freq for overclocking. Nearly all Pi’s should work well with arm_freq=800 but there are many posts out in the net saying that overclocking sdram_freq is not working with there Pi’s. Since 800|250|400 is an option you can choose in the raspi_config (and so tested by the manufacturer), 800|350|450 isn’t and may be to high for some Pi’s.

  47. Domenico U Malament Dileo says:

    Hi Florian,
    very compliments for your script, it works correctly in Apache but it does not work with server nginx. the problem is that when you go in the address /owncloud it does not unpload the page but it says error404.

    thanks a lot,

  48. Thomas says:

    Hi Florian,
    I’m wondering why you use “fastcgi_pass;” in your script instead of “fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;” to enable php-fpm?


      • Thomas says:

        Yes, you can get it working like this:

        There is no folder /var/run/php-fpm. You can create it or let it just listen to /var/run/php-fpm.sock. I used the second option:
        1. Edit your nginx-configuration with “fastcgi_pass unix:/var/run/php-fpm.sock;”
        2. Edit /etc/php5/fpm/pool.d/www.conf with “listen = /var/run/php5-fpm.sock”

        Restart php-fpm and nginx and your done. Using the unix-port shoult be a bit faster than the TCP-port. Compare:

        Wish everybody a happy new year :)

      • Thomas says:

        Just recognized that there is a mistake:
        It shoud be fastcgi_pass unix:/var/run/php5-fpm.sock;
        (with php5, not only php, so that both path are equal.)

  49. Thomas says:

    Hey Florian,
    it would be great if you can build in some questions like:

    • Do you want to use ssl or plain http (unsecure)?
    • Do you want to overclock the pi to 800|450|350?
    • Should we try to update the pi’s firmware?

    This would give the user of your script more control over what is happening. Thanks for your great work!

      • Thomas says:

        Unfortunately I’m not a coder and I just managed to understand what the code is doing. Reading a bit in the code and doing some testing is the only thing I can help with…

  50. boyfriend jacket says:

    Appreciating the time and effort you put into your blog and in depth information you provide.
    It’s great to come across a blog every once in a while that isn’t the same out of date rehashed
    information. Excellent read! I’ve saved your site and I’m
    adding your RSS feeds to my Google account.

  51. DaGeek247 says:

    Alright, I literally installed Lubuntu, and then did the instructions for running this script. Everything went smoothly, but when I connect to the server on a another network machine ( I get redirected to

    Where do I change this to the static network IP that I want it to be?

  52. retix says:

    I just had to re-image my SD card and I’m now having problems getting the script to work properly. The script shows that it installed properly, but when I navigate to http://localhost/owncloud/, all I get is a screen showing the Index of /owncloud, rather than the startup wizard for owncloud. Any suggestions? I’m getting frustrated and have reimaged MULTIPLE times trying to get this to work. (I’m trying to run the Apache server version) It is almost as though the ownCloud service is not starting and I can’t find any instructions on manually starting the service

  53. a says:

    Ok, i rerun the script and the second time (without creating the directory manualy) it goes further but also ends with errors:

    error: failed to validate delta base reference at offset 14690236 from //root/.rpi-firmware/.git/objects/pack/pack-23bf2f66e6f80d32f843b0ed7b1b19c4816c4fed.pack
    error: failed to read object e7eaf7649bbcf4886045a87796381fa757fe2fe7 at offset 14690215 from //root/.rpi-firmware/.git/objects/pack/pack-23bf2f66e6f80d32f843b0ed7b1b19c4816c4fed.pack
    fatal: packed object e7eaf7649bbcf4886045a87796381fa757fe2fe7 (stored in //root/.rpi-firmware/.git/objects/pack/pack-23bf2f66e6f80d32f843b0ed7b1b19c4816c4fed.pack) is corrupt – OwncloudPie Setup.

    │ We are now going to create a self-signed certificate. │
    │ While you could simply press ENTER when you are asked │

    ./ line 179: /usr/bin/openssl: cannot execute binary file
    mkdir: cannot create directory `/srv/http’: Input/output error
    ./ line 194: /etc/init.d/php5-fpm: cannot execute binary file
    ./ line 195: /etc/init.d/nginx: cannot execute binary file
    want /var/swap=512MByte, checking existing: keeping it

    = = = = = = = = = = = = = = = = = = = = =
    Updating to latest Ownclo……..======>] 11,890 –.-K/s in 0.1s

    2012-12-07 20:32:55 (92.8 KB/s) – `Changelog’ saved [11890/11890]

    ./ line 85: /usr/bin/head: cannot execute binary file
    http://: Invalid host name.
    basename: missing operand
    Try `basename –help’ for more information.
    ./ line 88: /bin/tar: cannot execute binary file
    basename: missing operand
    Try `basename –help’ for more information.
    rm: cannot remove `’: No such file or directory
    mv: cannot stat `owncloud/’: No such file or directory – OwncloudPie Setup.

    Sorry for posting so much text…

    To your questions:

    Does the server start? how do i test it?
    Is is available via the local IP address? No- like there is no computer with that ip
    Is the SSL certificate set up with the correct server name? –
    Which error message does Owncloud show eventually? –
    Please provide some more information.

    When i tried your apache version last time it worked fine.

    Thanks in advance.

  54. a says:

    I tried it again with a new installation(Standart image wheezy fp…) :

    [ ok ] Restarting PHP5 FastCGI Process Manager: php5-fpm.
    Restarting nginx: nginx.
    want /var/swap=512MByte, checking existing: deleting wrong size file (104857600) , generating swapfile …swapon: /var/swap: read swap header failed: Invalid arg ument
    mkdir: cannot create directory `/var/www’: No space left on device
    Cannot find directory /var/www/owncloud.
    pi@raspberrypi ~/OwncloudPie $

    I will manually create the dir later, have to get the kids to bed now :)

    • Florian says:

      Thanks for the information!
      The message “No space left on device” indicates a problem with you free space. How large is your sd card? Did you run the “expand root_fs” option in the raspi-config script? You could do this with “sudo raspi-config”, select “expand root_fs” and then restart the RPi. This should solve the space problem.

      Hope this helps!?

      • a says:

        I aldready had done your suggestions then. The second time i ran the script it seemed not to be a problem anymore. The SDcard is 8 GB and i didnt install anything else.

  55. a says:

    Sorry i have to add, that the script does not seem to work with the newest Owncloud 4.5 and nginx. I messed around a lot on my pi but can’t get it to work. would be great i you could fix it. thanks

    • Florian says:

      Which output(s) does the script give?
      Does the server start?
      Is is available via the local IP address?
      Is the SSL certificate set up with the correct server name?
      Which error message does Owncloud show eventually?
      Please provide some more information.

  56. a says:

    Thanks a lot, just what i was searching for – this script!
    I~m beginner in using Linux, and want to give owncloud a try as i have a lot of data at googles HDs. All the best to you from Heidelberg, Germany.

  57. Phill @ Code Curators says:

    I get the following message in the admin section:

    Security Warning Your data directory and your files are probably accessible from the internet. The .htaccess file that ownCloud provides is not working. We strongly suggest that you configure your webserver in a way that the data directory is no longer accessible or you move the data directory outside the webserver document root.

    Ive installed using nginx, any ideas how to rectify this?


      • evok says:

        hi, thanks for that great script and your hard work. I also used nginx and I have the same Problem like Phill Code Curators. I tried to move it to /media and change the path at /etc/nginx/sites-available/default from var/www to /media. But it doesnt work.

        Do you have an idea where i must change the path. the rights are still www-data:www-data
        Thank you very much

      • evok says:

        Thank you very much. Now it seems to work great. No problems with security warnings.
        Maybe I have a tip for using an external storage. I connected the usb hdd to my raspberry …. looked up the name with fdisk -l and than entered the name in the /etc/fstab
        something like
        /dev/sda1 /var/www/owncloud/data/ADMINUSERNAME/files/HDD ext4 defaults 0 0

        you maybe have to change sda1 , ADMINUSERNAME for your account in owncloud and ext4 if you use another filesystem.

        Than I changed the rights for this folder (HDD) to:
        chown www-data:www-data /HDD -R
        chmod 755 /HDD -R

        I hope this solution is secure and may help some people.


    • Florian says:

      For a new download of the PiCoud script you need to run

      git clone git://

      For an update of an existing PiCloud script you have to change to the PiCloud directory and run

      git pull

      The command “wget … .git” does not download the repository files, but only an XML project file of PiCloud.

      I hope this helps!?

  58. MrLetsPeter says:

    (Sorry but there was no “Reply” button)

    My Browser say : error 105 (net::ERR_NAME_NOT_RESOLVED) sounds like something with the DNS-service s wrong. I´ve reinstalled it 3 times but it didn´t changed anything

    Ps: The Problem ony happens on the nginx installation apache runs just fine but i want to use the ningx servicce because of the performance , Sorry for spamming your Blog with Problems :(

  59. MrLetsPeter says:

    THX for this wonderfull script, works just fine.
    But ive got 2 problems:
    – first time i acces my owncloud i cant create an admin account it seems like there is already one.
    – i cant change “” to an other value (if i edit the config file and restart the nginx server there arent any changes and its still “”
    Does anyone has an idea what can be the problem?
    Thanks for Answers , and sorry for my bad english.

    • Florian says:

      Hi, there was a bug in the script that set the URL of the server constantly to and not to the choice made with the according dialog of the script. I just fixed this issue.

      If you want to manually change the server name in NGiNX config file, you need to do this with admin rights, e.g., via “sudo nano /etc/nginx/sites-available/default”.

      • MrLetsPeter says:

        First thanks for fixing the problem with the domain name (top support, superfast updated)
        but now ive got some other problems at the end of the installation ic cant reach the server if i try to restart the services with : sudo service php5-fpm restart; service nginx restart
        there is the following error
        “Restarting nginx: nginx: [alert] could not open error log file: open() “/var/log /nginx/error.log” failed (13: Permission denied)
        2012/11/24 14:25:55 [warn] 18162#0: the “user” directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.con f:1
        2012/11/24 14:25:55 [emerg] 18162#0: SSL_CTX_use_certificate_chain_file(“/etc/ng inx/cert.pem”) failed (SSL: error:0200100D:system library:fopen:Permission denie d error:20074002:BIO routines:FILE_CTRL:system lib error:140DC002:SSL routines:S SL_CTX_use_certificate_chain_file:system lib)
        nginx: configuration file /etc/nginx/nginx.conf test failed”

        Thanks for the nice support :)

      • Florian says:

        Thank you!

        Also in this case you have to run the command with super-user privileges: “sudo service …”

    • Florian says:

      I am not 100% sure, but it might be that uninstalling Apache via “sudo remove apache2” and removing the service from init.d via “sudo update-rc.d apache2 remove” is enough.

  60. Phill @ Code Curators says:

    You can now map external / additional drives direct from ownCloud via Settings > Admin > External storage.

    To do this follow the following steps:

    1) Go to your owncloud directory then open a terminal
    2) sudo wget
    3) cd PiCloud
    4) chmod +x
    5) sudo ./
    6) Follow the upgrade wizard
    7) in the terminal window type df to get a summary of all your drives. External are typically mounted as sub folders in the media folder off root
    8) Open ownCloud > settings > admin > external storage
    9) Give your external storage a name in the first box, then the location of the drive as identified via step 7
    10) Select which users can access this drive
    11) open up ownCloud in a browser and see the drive is now present in your files section
    12) You could theoretically add folders directly as drives for better organisation if required.

    Hope that helps!

    13) Check out my website / upcoming blog at for future pi and other tech blog stuff.

  61. brijesh says:

    Nice work. i just installed the same and working perfectly fine……….need one help, “how can i get my external USB hard drive space for owncloud.

    • Florian says:

      I updated the script yesterday evening and nginx can now be chosen instead of Apache. I also fixed a bug related to the update function of the script.

      The script works for me – if you have any problems or suggestions or interesting code modifications feel free to post them here or on the Github site!

    • Florian says:

      I totally agree that apache is pretty heavy weight here. Actually, I am also testing nginx currently. CardDAV and CalDAV are working without problems. However, I cannot get a WebDAV connection somehow. If this is working for you, I would be happy if I would get some instructions from you!

      • Florian says:

        An update for the installation script is at the top of my to-do list! Unfortunately, I am very busy these days so that the update has to wait for a few more days.

  62. Adam says:

    I’ve had the same problem as an above poster about the directory not being created. Where do I need to create the directory?! I tried making it in the PiCloud folder and also in the root but both give back the error message, if you could let me know the answer it be brilliant thanks!

  63. raspiatv says:

    latest version of this Script is broken, it runs but nothing works, i later found it’s not creating /var/www/owncloud. Once i created the dir myself and re0ran the script it downloaded and installed properly. Thanks very much for the script. =] hopefully the problem can be isolated and fixed.

Leave a Reply

This site uses cookies to offer you a better browsing experience. By browsing this website, you agree to our use of cookies.