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:

PiClouseSetup

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

https://yourServerUrl/owncloud/remote.php/webdav/

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)

Server: https://my.servername.com/owncloud/remote.php/caldav/principals/USERNAME/
SSL enabled, port 443

Contacts (CardDAV)

Server: my.servername.com:443/owncloud/remote.php/carddav/principals/USERNAME
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

MEAN adventures continued: An UML Online Editor for PlantUML

Some weeks ago I wrote about my recent journeys into the world of web application …

  • Fabian

    I am trying this script now. Will post my thoughts when it’s done. Thanks for doing this.

  • Awesome Script!

    Really came in handy 🙂

    Also, as a bonus, I now have a better looking bash menu! Learn something new everyday!!

  • Reblogged this on Gigable – Tech Blog.

  • Jean-Marie

    wonderful ! it s work fine !

  • raspiatv

    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.

    • Thank you! Glad that it is working for you now.

      If nobody else creates a pull request before, I will have a closer look at the script …

    • same here – create the folder and than update the confguration

      • so i created the /var/www/owncloud folder i run the config again and finally it is unable to boot

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

    • I just committed an update for the script. I found the error and it should be fixed now! There was a problem with the order of creating the needed directories.

      • That’s brilliant, it installed perfectly! But how do I get the files from my memory stick (plugged into the pi) to be displayed in the owncloud window on my pc? Can’t seem to find the folder anywhere?

      • Good to hear that it is working now. I have not tried to mount any USB device for external storage so far. There are, however, at least the documentation at http://owncloud.org/support/custom-mount-configuration/ and a thread about that at http://forum.owncloud.org/viewtopic.php?f=3&t=2497.
        When you managed to get it run, you are welcome to post a link to the guide or write some lines about your solution here 🙂

  • Apache and Pi ? Humm…
    Try Nginx, it’s a lot more friendly on ressources. My owncloud is powered by nginx and everything works fine!

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

    • Olof

      Please tell us how you installed nginx with owncloud.

      • Hi!
        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.

  • Mike

    Great work !! Any new development regarding nginx or other improvements ? Thank You.

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

  • brijesh

    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.

  • 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 http://github.com/petrockblog/PiCloud.git
    3) cd PiCloud
    4) chmod +x picloud_setup.sh
    5) sudo ./picloud_setup.sh
    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 http://www.codecurators.co.uk for future pi and other tech blog stuff.

  • Olof

    thanks for the updated script with NGiNX support!

  • What would be needed to remove apache install before creating nginx installation?

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

  • MrLetsPeter

    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 “smorrebronson.homedns.org” to an other value (if i edit the config file and restart the nginx server there arent any changes and its still “smorrebronson.homedns.org”
    Does anyone has an idea what can be the problem?
    Thanks for Answers , and sorry for my bad english.

    • Hi, there was a bug in the script that set the URL of the server constantly to smorrebronson.homedns.org 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

        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 🙂

      • Thank you!

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

  • MrLetsPeter

    (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 🙁

  • I did a wget http://github.com/petrockblog/PiCloud.git and ran the installation. However I wasnt given the option to choose between nginx and apache. What am I doing wrong????

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

      cd
      git clone git://github.com/petrockblog/PiCloud.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!?

  • Hi,
    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?

    Thanks.

    • Hi Phill. Relocated your /”owncloud”/data directory somewhere else, eg. outside webroot should solve that very efficiently

      • Won’t I need to update the reference to it somewhere???

      • 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

    • I have just updated the script such it should correctly handle this problem now – the nginx configuration had to be slightly adopted in line 114 (https://github.com/petrockblog/OwncloudPie/blob/master/owncloudpie_setup.sh#L114). Does it solve your problem?

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

        greetz
        evok

  • Reblogged this on projectz and commented:
    And we have a winner, as an Owncloud user this makes perfect sense more so if i add a VPN to the same distro..

  • a

    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.

  • a

    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

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

  • a

    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 🙂

    • 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

        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.

  • a

    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
    PetRockBlock.com – OwncloudPie Setup.

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

    ./owncloudpie_setup.sh: line 179: /usr/bin/openssl: cannot execute binary file
    mkdir: cannot create directory `/srv/http’: Input/output error
    ./owncloudpie_setup.sh: line 194: /etc/init.d/php5-fpm: cannot execute binary file
    ./owncloudpie_setup.sh: 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]

    ./owncloudpie_setup.sh: line 85: /usr/bin/head: cannot execute binary file
    http://: Invalid host name.
    basename: missing operand
    Try `basename –help’ for more information.
    ./owncloudpie_setup.sh: 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
    PetRockBlock.com – 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.

  • I’m curious to find out what blog system you are using? I’m having some minor security
    issues with my latest website and I’d like to find something more safeguarded. Do you have any recommendations?

    • It is WordPress(.com). So far it is ok for what I indent to use it. But it depends on what you want to do, e.g., advertisements, plugins, custom theming …

  • retix

    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

  • 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 (192.168.1.101/owncloud) I get redirected to url.ofmyserver.com/owncloud/

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

    • forgot to mention, its an nginx install because people said it was better/faster.

    • This can be changed in the configs for NGiNX in the file /etc/nginx/sites-available/default.

      • thanks, that got it working, and now everything is perfect.

        Also, thank you for the awesome script as well. You rock.

      • Thomas

        Had the same problem. Maybe it is a good idea to mention somewhere that changing the urlofmyserver should be done as a first step.

        Don’t know why but your script is the first time I managed to get owncloud working. Thank you really much! Your work is wonderful!

      • Thanks for the hint! I added this to the menu of the script.

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

  • Thomas

    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!

    • That sounds like a good idea!

      If someone would like to support me here and propose some code modifications I would be thankful.

      • Thomas

        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…

  • Thomas

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

    Greetings,
    Thomas

    • The default with the unix port did not work for me when I initially worked on the script. Does it work for you?

      • Thomas

        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: http://todsul.com/install-configure-php-fpm

        Wish everybody a happy new year 🙂

      • Thomas

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

      • Thanks a lot for that!

  • 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,
    Domenico

  • Thomas

    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_pass 127.0.0.1:9000;
    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.

    Details:
    https://nealpoole.com/blog/2011/04/setting-up-php-fastcgi-and-nginx-dont-trust-the-tutorials-check-your-configuration/
    or
    http://wiki.nginx.org/Pitfalls#Passing_Every_.7E_.5C.php.24_request_to_to_PHP

    • 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

        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

        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.

  • gaborgabor2

    no luck with fresh install – could someone please help?
    [FAIL] startpar: service(s) returned failure: nginx … failed!

    • Thomas

      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?

  • gaborgabor2

    I used the 2012-12-16-wheezy-raspbian is it a problem?
    How should i update the script?

    • gaborgabor2

      I have just updated but still the same error msg.

      • gaborgabor2

        I have formatted my sd card and started from scratch. It is working now. Install was longer so probably I was broken previously.

  • RpiNewbie

    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)

    Thanks.

    • Name

      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“
      and
      ”sudo apt-get autoremove –purge“
      before starting the script again. This should give you a complete new start.

      • RpiNewbie

        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.

  • Eric

    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?

  • Navneet

    Works like a charm, Respect!

  • ligurius

    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 192.168.0.3/owncloud or 127.0.0.1/owncloud i do get :

    Error – http://192.168.0.3/owncloud
    The page ‘http://192.168.0.3/owncloud’ 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 :).

    • Talmar

      I got the same problem here and surely have no idea how to solve it. Please help

  • Mats Sandvoll

    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?

    • Mats Sandvoll

      I found a solution. I had to delete the config.php and do the setup all over.

      Thanks again for a great script!

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

    Thanks,
    Gio

  • also when i sign in as admin the page is blank and stays blank but if i sign in a a user it works fine.

  • I sometimes get error 502 bad gateway or 404.

  • RpiNewbie

    anybody tried the upgrade to OC 4.6.5 with the script?

    • RpiNewbie

      I meant 4.5.6 of course…

      • RpiNewbie

        I just tried it…seems to go fine.
        Suggestion: add an option in the menu to upgrade OwncloudPie script itself? (I am not sure I have the latest version).

      • An option for an update of the script itself sounds like a good idea to me!

  • Richard

    Nice script, but why does it install/update so much irrelevant junk? running a apt-get upgrade seems a bit OTT

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

  • 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 “url.ofmyserver.com”. 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.

    • Thanks for that! I have created an issue of that at the Github repository.
      Update: I have fixed and enhanced this function now.

      • David

        thanks!

  • daniel

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

    • 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

  • 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

    • 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 https://github.com/owncloud/apps/issues/332 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.

  • Mats Sandvoll

    Hi,

    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.

  • Christoffer Hauthorn Boisen

    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.

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

  • CCORE

    what ports on the router do I need to open? (if any?)

    • You need to open only port 443, which is the default for SSL encrypted connections.

  • hack2009

    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 url.ofmyserver.com/owncloud

  • Andrew

    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?

    Thanks!

    • I do not have any experience with Raspbmc or XBMC’s web interface in combination with this script. It would be interesting to get feedback about that here!

    • António

      Only if you change the web interface port to something other than 80.

      • Andrew

        How do I change the web interface port? On raspbmc or owncloud?

  • Hi,

    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 “http://goo.gl/1BOfJ” ?

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

    Great script anyway, thank you for it !

  • 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 my.servername.com part of the script, I’m at a loss. I want to use my domain name with gandi.net but haven’t a clue what exactly I do or what in fact I need to ask. I currently use gandi.net 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 gandi.net? Do I have to use something like dysdns.com? Simple step by step instructions for a nob would be appreciated. Thanks in advance.

    • I am using dyndns.org and configured my router accordingly. my.servername.com 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

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

    Thanks!

    • 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

    HI,
    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

    Hi,
    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.
    Bernd

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

    Thanks!

  • 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 = pajserver.x64.me” (from dnsdynamic.org). Used it within the script (first prompt) and in making the certificate.
    The pi-server is at private ip 192.168.1.98 so my router is set to forward the https port 443 to that ip. No problem to reach the server at “https://pajserver.x64.me/owncloud” 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

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

    cd

    git clone git://github.com/petrockblog/OwncloudPie.git

    It fails saying that OwncloudPie already exists.

    Any pointers would be greatly appreciated.

    Thanks.

    • 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: 10.0.0.100, server: 10.0.0.104, request: “GET /owncloud/ HTTP/1.1”, host: “10.0.0.104”

    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 ?

    Regards
    Gerd

    • Gerry

      SOLVED:
      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 192.168.1.181 (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!
    Michael

    • 1) The security of your installation depends on all kinds of things. To see what the script does you could have a look at https://github.com/petrockblog/OwncloudPie/blob/master/owncloudpie_setup.sh. 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?

    Thanks

    • 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 (http://doc.owncloud.org/server/5.0/admin_manual/configuration/configuration_database.html) 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?
    Thanks

    • 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

      Detlef,
      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.
      Cheers

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

    Regards!

  • Ian

    Hi,

    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 0.0.0.0:443 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 https://github.com/petrockblog/OwncloudPie/issues!

  • 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

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