Social Icons

How to setup ownCloud 7 on Raspberry Pi





This is the second installment of the guide to install ownCloud on Raspberry Pi. Our earlier guide was for ownCloud 5.0.20 (Enterprise Edition) and can be found here.

There has been certain changes with the latest version of ownCloud 7, and this guide should be able to help you to sail through smooth. Without much ado about what is ownCloud (which you already know) let's dive deep into tech details.

Following software / packages we will be using for this setup, ideal for a personal cloud on Raspberry Pi:
  • ownCloud 7
  • Nginx
  • OpenSSL
  • php 5
  • Raspbian Wheezy
1. Tuning up the Raspberry Pi
Following changes needs to be made under Raspberry Pi configuration
sudo raspi-config

a. Expand the root filesystem to have enough space for the cloud
    Select "Expand Filesystem"

b. Change locale to en_US.UTF8
    Select "Internationalisation  Options"

c. Memory split, allocate 16M to video graphics (if you are not using X-server)
    Select "Advanced Options" --> "Memory Split"

d. Overclock to Modest or Medium (Optional Step)
    Select "Overclock" (You might have to reboot if asked)

2. Updating the package lists on Raspberry Pi
  sudo apt-get update
    sudo apt-get upgrade

3. Creating users (Raspbian might already have is user & group)
    sudo groupadd www-data
    sudo usermod -a -G www-data www-data

4. Installing the packages
    sudo apt-get install nginx openssl ssl-cert php5-cli php5-sqlite php5-gd php5-common php5-cgi sqlite3 php-pear php-apc curl libapr1 libtool curl libcurl4-openssl-dev php-xml-parser php5 php5-dev php5-gd php5-fpm memcached php5-memcache varnish


5. Make sure php5-curl is not installed
    sudo apt-get --purge remove php5-curl

6. Creating your SSL certificates for 2 years
    sudo openssl req $@ -new -x509 -days 730 -nodes -out /etc/nginx/cert.pem -keyout /etc/nginx/cert.key

   
sudo chmod 600 /etc/nginx/cert.pem
   
sudo chmod 600 /etc/nginx/cert.key

7. Configuring Ngnix web server
    sudo nano /etc/nginx/sites-available/default

    Copy and replace the entire content below:
    Note: You'll have to replace technet.example.com with the local IP of your Raspberry Pi or the domain name (make sure it matches with the details you have provided to create the certificate, else ownCloud won't work). If you have planned instead to use any Dynamic DNS domain, then use your  domain name instead of the local IP address. You can follow our guide for setting up a Dynamic DNS domain.

8. Configuring max upload limit in php
    sudo nano /etc/php5/fpm/php.ini

    Tip: Use ctrl+w to search below lines and update:
    upload_max_filesize = 1000M
    post_max_size = 1000M

9. Configuring PHP 
    sudo nano /etc/php5/fpm/pool.d/www.conf
    Change the following line from:
    listen = /var/run/php5-fpm.sock
    to 
    listen = 127.0.0.1:9000

    sudo nano /etc/dphys-swapfile
    Change the following line from:
    CONF_SWAPSIZE=100
    to 
    CONF_SWAPSIZE=512

10. Restart web server and Php
    sudo /etc/init.d/php5-fpm restart
    sudo /etc/init.d/nginx restart

11. Install ownCloud (version 7.0.1 used here)
    sudo mkdir -p /var/www/owncloud
    sudo wget https://download.owncloud.org/community/owncloud-7.0.1.tar.bz2
    sudo tar xvf owncloud-7.0.1.tar.bz2
    sudo mv owncloud/ /var/www/
    sudo chown -R www-data:www-data /var/www
    rm -rf owncloud owncloud-7.0.1.tar.bz2

12. Setup admin account
     While setting up the admin account you should provide the path to your data folder. You can ideally set this to your NAS drive or external drive which you may have mounted. Owncloud will complain and not proceed with admin account if the data directory path is not readable & writable by the user www-data. Also it should not be readable by "others". You can refer to our guide here for setting up appropriate permission before proceeding to create the admin account.
     Now in the browser, login to the ip address of Raspberry Pi or if you have configured your domain name then use that and set up the admin account.
    https://yourdomain.com    or    https://192.168.XXX.XX


That's all... Celebrate the fun... Fly high on clouds... and if you liked this guide, got benefited or feel worth reading kindly do share with your network, and share your comments.

69 comments:

  1. Thanks. I have been trying to do this using an older tutorial and it just wasn't as helpful as yours! Do you recommend installing owncloud via their packages or just doing the one time download? Also, what ports should be forwarded for nginx? (doing remote access with no-ip)

    ReplyDelete
    Replies
    1. Follow the steps mentioned in this guide for a hassle free installation.
      Forward both Port 80 (for http) and Port 443 (for https).

      Delete
  2. Hi, first, thank you for you well explained tutorial!

    Current now I am having a strange problem: when you are browsing trought the menus of owncloud page, it take ages to pass to next page when you click for exemple on a folder inside it...

    I tested with Chrome, Firefox, IE, but all of them behaves the same way.

    I am using an external hard disk and I used your another article of how to set it.

    Could you help me?

    Thanks!

    ReplyDelete
    Replies
    1. Hi Edward,
      Can you answer me the following:
      1. Are you trying to access it from LAN or Internet while you face slowness?
      2. Did you perform modest overclocking?
      3. Do you have X-mode (GUI) On ?
      4. What is the video memory allocated to your raspberry pi?

      Delete
    2. 1 - I tried with both ways but the same thing happens.
      2 - Yes is in modest overclock
      3 - How can I check this? I am just using the terminal by SSH current now and always when I boot the raspberry it stays in terminal mode.
      4 - 16MB for the GPU

      Delete
    3. This is bit strange, as with similar settings and config I am having a fairly running environment. You should probably cross check if any other process is consuming cpu cycles or memory.

      Delete
    4. I also have the problems mentioned!! Any ideas?

      Delete
  3. Thanks! It's helped me out!

    The only concern is that HTTPS isn't working even after port forwarding. Any idea of what the reason might be? There's a [Failed] message when it loads niginx at boot too.

    Cheers!

    ReplyDelete
    Replies
    1. Please elaborate with the [Failed] message. Sounds like something is wrong from Step. 7 (Nginx configuration)

      Delete
  4. Hey guys,
    thanks for making this tutorial - I'm a newbie to RasPi and...
    I have two questions:

    when I input this line:


    sudo /etc/init.d/nginx restart

    I get the following response...

    Restarting nginx: nginx: [emerg] unknown directive " " in /etc/nginx/sites-enabled/default:6
    nginx: configuration file /etc/nginx/nginx.conf test failed

    Any idea what I am doing wrong?

    Everything else seemed to go ok, but when I input the IP address of my Raspberry Pi nothing happens - the page doesn't load... as a result I can't get into the owncloud admin side of things...

    Any help would be greatly appreciated - am really looking forward to getting this up and running!

    thanks, Paul

    ReplyDelete
    Replies
    1. There is some syntax issue in the /etc/nginx/sites-enabled/default config file for nginx. Follow Step. 7 carefully once again, sounds like some minor issue. Edit the file carefully, save and restart daemon, it should be ok.

      Delete
    2. Hey, i think that i found a solution.

      I posted the answer as a comment.

      Delete
  5. Pretty good! Thanks Abhishek!
    The only issue is that HTTPS doesn't work at all. I forwarded the ports and did everything you mentioned. Any ideas?

    ReplyDelete
    Replies
    1. Please do tell me if you are seeing any error messages. Are you able to login via http instead of https (ideally http should automatically get routed to https as per our nginx configuration shown here in step 7). Cross check once again step 7.

      Delete
  6. Hello and thanks for the tutorial.

    The installation on my Pi B+ got OK...
    I overclocked to "medium" and installed OwnCloud 7.0.2 (last version as of today).

    but when trying to log in from another machine on my lan, after accepting the ssl certificate, I got a "504" error.

    Did I missed something ?

    Does anyone can help ?

    Thanks
    Francois

    ReplyDelete
  7. Thanks for a very useful tutorial. When I heard 7.0.2 was out I went to the owncloud site and discovered a link on owncloud.org/install that lets me add a repository containing up-to-date owncloud goodness which gets updated with the rest of the system. I substituted that for step 11. So far it appears to be working fine. - Again, thanks!

    ReplyDelete
  8. I have been having an issue for the last couple of days. Initially, this went off successful. Then, managed to crash the pi trying to mount an ext 4 drive to an exact location. Upon manually rebooting (unplugged), logging into owncloud has been very disadvantageous. Can only do so via the lan address/owncloud and not via the http5 connection I once established before the pi crashed.

    I retraced this guide over repeatedly. Deleted the owncloud directory/new install. Created new ssl certs. No avail.

    I'm no linux guru but maybe deleting my ssl certs and refresh it that way instead of creating a new cert without deleting the old ones?

    Also, almost on a unrelated. If I somehow find my self successful restoring the pi to default without a wipe of the sd card ( all the time I invested into getting tightvnc, mumble, and ssh will seem to be a waste. ) How would I turn my Owncloud storage public for friends or trusted ip addresses?

    ReplyDelete
  9. hi thanks for this tutorial i'm almost there.

    i only stuck on step 11.
    i type the following line:
    sudo mv owncloud/ /var/www/

    getting the following error:
    sudo: unable to resolve host pi
    mv: can't get status of owncloud/: file or map doesn't excist

    when i check with dir /var/www/ i see the owncloud map.

    what is wrong?

    ReplyDelete
  10. Great Tutorial! I followed it and it works using the local IP but when I try using the external IP I get a ERR_CONNECTION_REFUSED error. I have my ports forwarded, I used the same url in the config as the SSL cert. But still get the error.

    I even took my router out of the equation and same error. Any Ideas?

    ReplyDelete
    Replies
    1. Just try after restarting your Raspberry Pi.

      Delete
  11. Hello,

    I have always the same error when i want to connect from extern with no-ip:
    ssl_error_rx_record_too_long in firefox

    With local IP https is working...

    I followed all your tutorial. It was working behave to select en_US.UTF8. i can select only en_GB.UTF8.

    Could you help me? thanks


    ReplyDelete
  12. Have you added you external ip as a trusted domain?

    ReplyDelete
  13. HI, I am new to Rpi and was wanting to try something like this. Before buying my Pi I want to know if the model will matter, I was going to purchase the Model B+, will this matter or should I get another?

    ReplyDelete
    Replies
    1. Model B+ is the latest of all currently available RasPi versions, Go for it.

      Delete
  14. Thanks for this great and really easy to follow tutorial. You say "Make sure php5-curl is not installed". Just wondering why as this is needed for linking in external storage such as S3 or Dropbox.
    Thanks again,
    David W

    ReplyDelete
    Replies
    1. Well I found that having php5-curl installed creates a problem and owncloud doesn't starts up. Sorry, but I didn't get much time to dig deep into it.

      Delete
  15. Great tutorial,
    the only issue I'm having is SSL.
    I'm getting "Your connection is not private" in Chrome.

    ReplyDelete
    Replies
    1. Check if your system date-time is correct

      Delete
    2. It is because of the self-signed SSL certificate, he needs to just override the warning

      Delete
  16. I have followed all of the steps in the various parts, but when I type in "mydomain.org" nothing happens and I get a problem loading page error.

    I can ping the domain and that's working, but nothing else.

    ReplyDelete
  17. what are the modifications to allow this to work with external ip?

    ReplyDelete
    Replies
    1. If you are behind a router then you will have to do related port forwarding from the router to your system. In this guide I have explained using the domain name as "technet.example.com" you should replace it with your external ip accordingly.

      Delete
  18. To improve performance, try installing APC (apt-get install php-apc) after or during step 4. Installation defaults should work, but you edit them by running sudo nano /etc/php5/conf.d/20-apc.ini

    ReplyDelete
    Replies
    1. php-apc is being installed in this guide already.

      Delete
  19. Hi i've followed your tutorial step by step...
    Opening owncloud in my browser i obtain just a plain text about php page. That's a screenshot... http://i.imgur.com/o5DphzC.jpg
    Do you have any idea what is happening. Thanks....

    ReplyDelete
    Replies
    1. It's strange to have this if all steps have completed successfully. Most likely the php is not installed on your system thus the php is not being interpreted by your web-server.

      Delete
  20. Hi,
    if i connect to my raspberry in my home network i only get the message "welcome to nginx"... Nothing more....
    But if i connect to it via https everything works fine....

    Do you know the solution to this problem?

    Thanks....

    ReplyDelete
    Replies
    1. You need to unlink your default nginx site: unlink /etc/nginx/sites-enabled/default
      Then restart nginx

      Delete
  21. What exactly does step 9 do, just trying to understand this a bit more.

    ReplyDelete
  22. I have completed this tutorial, but can you please explain how to access my cloud online?

    ReplyDelete
  23. Thank you very much for this tuto.. everything works very well.
    Do you think that it can be a little faster using the OC option (in config/config.php) :
    'asset-pipeline.enabled' => true

    to read & send compressed JS & CSS files ?

    ReplyDelete
  24. HI,
    I have a little problem accessing my OwnCloud to set up the admin account. Im just getting the message "welcome to nginx!". I went through your tutorial step by step only changing the 7.0.1 version for the 7.0.3 newer version.
    Thanks for your help!

    ReplyDelete
  25. I am trying to use my phone as a hotspot and ssh in but I am getting this error message when trying to connect to my cloud:

    "You are accessing the server from an untrusted domain. Please contact your administrator. If you are an administrator of this instance, configure the "trusted_domain" setting in config/config.php. An example configuration is provided in config/config.sample.php."

    Any ideas on how to fix this?

    ReplyDelete
    Replies
    1. try using same network ip as owncloud server

      Delete
  26. My ddns does not point to owncloud /var/www/index.html but toward what?

    ReplyDelete
  27. Thank you for this tutorial. It works fine for a local connection. I was having problems connecting from outside my network through dyndns. I suggest one more edit to the above tutorial. First change the download version to owncloud-7.0.4.tar.bz2, also you need to edit your config

    sudo nano /var/www/owncloud/config/config.php

    In the array you need to add the outside address to the trusted domain array.

    $CONFIG = array (
    'instanceid' => 'xxxxxxxxxxxx',
    'passwordsalt' => 'xxxxxxxxxxxxxxxxxxxxxxxxx',
    'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx$
    'trusted_domains' =>
    array (
    0 => '174.16.0.131', *local address here*
    1 => 'xxxxxxxx.dyndns-free.com', *remote address here*
    2 => 'owncloud',



    ReplyDelete
  28. Hello!
    What's the safest way to update to 7.0.4?

    ReplyDelete
  29. Thankyou for this guide. It's the only one I could get working properly with https, dyndns etc.

    ReplyDelete
  30. Howdy. Thanks for the tutorial.
    Quick question though, it looks like you've installed varnish, but not configured it to work with nginx... It's still on the default port and nginx is listening on 80/443... Was this an oversight, or is there some backend interaction between the two packages?

    ReplyDelete
  31. Hi, after following the tutorial for mounting and auto-mounting, i get the error:

    Error while trying to create admin user: An exception occurred while executing 'CREATE TABLE "oc_appconfig" ("appid" VARCHAR(32) DEFAULT '' NOT NULL, "configkey" VARCHAR(64) DEFAULT '' NOT NULL, "configvalue" CLOB DEFAULT NULL, PRIMARY KEY("appid", "configkey"))': SQLSTATE[HY000]: General error: 14 unable to open database file

    I cant find anything online about this error on a Raspberry Pi. Does anyone have any ideas?

    ReplyDelete
  32. Hi, excellent tutorial thanks very much. I have my owncloud all setup and working on my pi, via ddns.net link and port forwarding etc. Excellent!
    I do have one question reference to an earlier comment. Dropbox, with curl.php removed I don't have the option in external storage. Can anyone help with this???
    Many Thanks....

    ReplyDelete
  33. When I try and access my raspberry pi with its IP I get a redirect back to technet.example.com!! But I have replaced technet.example.com with raspberrypi in both places!! I have also restarted nginx but no luck?

    ReplyDelete
  34. Check SSL server here https://www.ssllabs.com/ssltest and follow recommendations to resolve some security issues not addressed in this guide.

    ReplyDelete
  35. what packages would i need to do this install with mysql instead of sqlite

    ReplyDelete
  36. OwnCloud complains that curl is uninstalled, can you explain why you have it removed in step 5? Also how would I go about installing and using MySQL instead of SQLlite? My desktop client gets a lot of errors when syncing large files to OwnCloud and OwnCloud suggests I use it too.

    ReplyDelete
  37. Can you tell me why in step 5 you remove curl? OwnCloud warns me that it's not installed. Also why do you use sqllite vs mysql or mariadb?

    ReplyDelete
  38. I followed this tut step by step, but I can't access my owncloud via https over the Internet. I changed owncloud 7 to 8.0.2.

    ReplyDelete
  39. I had no problem using Owncloud 8.0.2 stable with php curl. Works fine.If you check your Admin-section in Owncloud 8, you'll probably get a warning like "default-charset" is not set.

    An easy way to activate the UTF-8 charset is by applying the following command:

    sudo nano /etc/php5/fpm/php.ini

    Search for "default-charset" - There you should see an entry that begins with ";" and then follows something that says that the entry was left empty. Just erase the ";" in front of the line where it says "set default-charset..." and reboot. That's it.

    ReplyDelete
  40. (make sure it matches with the details you have provided to create the certificate, else ownCloud won't work).

    What you mean ownCloud won't work if the details you have provided to create certificate? if i left the certificate blank/empty then it won't work?

    ReplyDelete
  41. Hi,

    After the installation when trying to access owncloud (192.168.x.x/owncloud)
    I get the error message "File Not Found"

    Please Help me

    ReplyDelete
  42. Hi,
    Everything works fine after I followed your tutorial but OwnCloud allows max 513 MB upload, how can I change that to be 2G or somethnig like that? My Drive is a 1 TB nfts formated.

    ReplyDelete
  43. Regarding the limit of 513 MB upload... I found the solution...
    just edit those two lines:

    php_value upload_max_filesize 3G
    php_value post_max_size 3G

    in: /var/www/owncloud/.user.ini

    Thats it!



    ReplyDelete
  44. Awesome tutorial. Thanks. Found this useful for installing owncloud 8 on the raspberry pi http://projpi.com/diy-home-projects-with-a-raspberry-pi/pi-owncloud-drop-box-clone/ Took me about an hour to setup the whole thing :-)

    ReplyDelete
  45. What do you install varnish if you don't use it ;)

    ReplyDelete
  46. Excellent tutorial, thanks very much!

    ReplyDelete
  47. I know this has been around for a while. Not sure if there is still some activity here, especially with Owncloud 8 out. I'm trying to setup Owncloud on my Pi. However, I need to use other port numbers for http/https. Any thoughts on how to easily implement this minor change? Thanks in advance.
    Chris

    ReplyDelete
  48. Awesome tutorial. Thank you very much indeed.

    ReplyDelete
  49. Great tutorial.
    For the past couple years I've been working on my own implementation of a private cloud solution. It's easy to install, secure, simple and lightweight. I've set up a demo at demo.simpledrive.org.

    There's also a Sync Client available for Windows as well as an Android-App in the Play Store (free).

    Check it out and let me know what you think.

    ReplyDelete