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
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
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
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.
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.
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)
ReplyDeleteFollow the steps mentioned in this guide for a hassle free installation.
DeleteForward both Port 80 (for http) and Port 443 (for https).
Hi, first, thank you for you well explained tutorial!
ReplyDeleteCurrent 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!
Hi Edward,
DeleteCan 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?
1 - I tried with both ways but the same thing happens.
Delete2 - 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
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.
DeleteI also have the problems mentioned!! Any ideas?
DeleteThanks! It's helped me out!
ReplyDeleteThe 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!
Please elaborate with the [Failed] message. Sounds like something is wrong from Step. 7 (Nginx configuration)
DeleteHey guys,
ReplyDeletethanks 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
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.
DeleteHey, i think that i found a solution.
DeleteI posted the answer as a comment.
Pretty good! Thanks Abhishek!
ReplyDeleteThe only issue is that HTTPS doesn't work at all. I forwarded the ports and did everything you mentioned. Any ideas?
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.
DeleteHello and thanks for the tutorial.
ReplyDeleteThe 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
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!
ReplyDeleteI 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.
ReplyDeleteI 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?
hi thanks for this tutorial i'm almost there.
ReplyDeletei 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?
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.
ReplyDeleteI even took my router out of the equation and same error. Any Ideas?
Just try after restarting your Raspberry Pi.
DeleteHello,
ReplyDeleteI 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
Have you added you external ip as a trusted domain?
ReplyDeleteNo, nothing as such...
DeleteHI, 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?
ReplyDeleteModel B+ is the latest of all currently available RasPi versions, Go for it.
DeleteThanks 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.
ReplyDeleteThanks again,
David W
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.
DeleteGreat tutorial,
ReplyDeletethe only issue I'm having is SSL.
I'm getting "Your connection is not private" in Chrome.
Check if your system date-time is correct
DeleteIt is because of the self-signed SSL certificate, he needs to just override the warning
DeleteI 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.
ReplyDeleteI can ping the domain and that's working, but nothing else.
what are the modifications to allow this to work with external ip?
ReplyDeleteIf 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.
DeleteTo 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
ReplyDeletephp-apc is being installed in this guide already.
DeleteHi i've followed your tutorial step by step...
ReplyDeleteOpening 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....
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.
DeleteHi,
ReplyDeleteif 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....
You need to unlink your default nginx site: unlink /etc/nginx/sites-enabled/default
DeleteThen restart nginx
What exactly does step 9 do, just trying to understand this a bit more.
ReplyDeleteI have completed this tutorial, but can you please explain how to access my cloud online?
ReplyDeleteThank you very much for this tuto.. everything works very well.
ReplyDeleteDo 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 ?
HI,
ReplyDeleteI 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!
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:
ReplyDelete"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?
try using same network ip as owncloud server
DeleteMy ddns does not point to owncloud /var/www/index.html but toward what?
ReplyDeleteThank 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
ReplyDeletesudo 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',
Hello!
ReplyDeleteWhat's the safest way to update to 7.0.4?
Thankyou for this guide. It's the only one I could get working properly with https, dyndns etc.
ReplyDeleteHi, after following the tutorial for mounting and auto-mounting, i get the error:
ReplyDeleteError 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?
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!
ReplyDeleteI 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....
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?
ReplyDeleteCheck SSL server here https://www.ssllabs.com/ssltest and follow recommendations to resolve some security issues not addressed in this guide.
ReplyDeletewhat packages would i need to do this install with mysql instead of sqlite
ReplyDeleteOwnCloud 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.
ReplyDeleteCan 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?
ReplyDeleteI 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.
ReplyDeleteI 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.
ReplyDeleteAn 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.
(make sure it matches with the details you have provided to create the certificate, else ownCloud won't work).
ReplyDeleteWhat 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?
Hi,
ReplyDeleteAfter the installation when trying to access owncloud (192.168.x.x/owncloud)
I get the error message "File Not Found"
Please Help me
Hi,
ReplyDeleteEverything 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.
Regarding the limit of 513 MB upload... I found the solution...
ReplyDeletejust edit those two lines:
php_value upload_max_filesize 3G
php_value post_max_size 3G
in: /var/www/owncloud/.user.ini
Thats it!
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 :-)
ReplyDeleteWhat do you install varnish if you don't use it ;)
ReplyDeleteExcellent tutorial, thanks very much!
ReplyDeleteI 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.
ReplyDeleteChris
Awesome tutorial. Thank you very much indeed.
ReplyDeleteGreat tutorial.
ReplyDeleteFor 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.