6
THURSDAY, OCTOBER 25, 2012 ownCloud on a Raspberry Pi This is a project that I have wanted to do for quite a while now. I finally got a free day this previous weekend, so I thought I would dedicate a little time to playing with the Raspberry Pi. The Raspberry Pi, for those not in the know, is a $35 ARM powered computer that is about the size of an Altoids Tin. I only had a day for my project and decided that setting up ownCloud would be interesting. ownCloud is an alternative to many different cloud services, such as file storage (Dropbox, Google Drive, SkyDrive, etc.), calendars (Google Calendar, etc.), music player (Google Music), personal picture viewer (Picasa, flickr,etc), and others. It has quite a few interesting features and is very actively developed. The Raspberry Pi is surprisingly easy to set up with Raspbian, and I was off and running in no time. I would go through the details, but I followed the Raspberry Pi Wiki article on SD card setup. I was able to use SSH to login after the first boot, so I did not even have to plug it into my TV. I did not do anything special with the configuration of my Pi, but I plan on activating the turbo setting in the firmware, so I can get the processor speed up to 1Ghz. In order to run ownCloud, you need a webserver and PHP. Apache can be a bit big for the Pi which only has 256MB of RAM (they now come with 512MB), so I chose to install nginx and PHP-FPM. aptitude install nginx php5-fpm php5-sqlite php5-gd Then, create a file in /etc/nginx/sites-available/. I called mine owncloud.vhost: SETTING UP THE RASPBERRY PI SETTING UP NGINX AND PHP 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 # redirect http to https. #server { # listen 80; # server_name owncloud.example.org; # rewrite ^ https://$server_name$request_uri? permanent; # enforce https #} # owncloud (ssl/tls) server { #listen 443 ssl; listen 80; #ssl_certificate /etc/nginx/certs/server.crt; #ssl_certificate_key /etc/nginx/certs/server.key; #server_name localhost; root /usr/share/nginx/www/owncloud; index index.php; client_max_body_size 1000M; # set maximum upload size # deny direct access location ~ ^/(data|config|\.ht|db_structure\.xml|README) { deny all; } # default try order location / { try_files $uri $uri/ @webdav; } # owncloud WebDAV I am Nick, and these are my projects. ABOUT ME Random Dragon*Con University Projects Steampunk Engineering Helicopter rPi CATEGORIES Apr 2013 (1) Oct 2012 (3) Sep 2012 (2) May 2009 (1) Nov 2007 (1) Aug 2007 (2) Apr 2007 (3) BLOG ARCHIVE ? Nick's Projects: ownCloud on a Raspberry Pi http://projects.nicholaslessley.com/2012/10/owncloud-on-raspberry-pi.html 1 of 6 3/31/2014 1:05 AM

OwnCloud on a Raspberry Pi

  • Upload
    r521999

  • View
    35

  • Download
    1

Embed Size (px)

DESCRIPTION

RaspberryPi OwnCloud Server

Citation preview

  • THURSDAY, OCTOBER 25, 2012

    ownCloud on a Raspberry Pi

    This is a project that I have wanted to do for quite a while now. I finally got a free day this previous

    weekend, so I thought I would dedicate a little time to playing with the Raspberry Pi. The Raspberry Pi,

    for those not in the know, is a $35 ARM powered computer that is about the size of an Altoids Tin. I

    only had a day for my project and decided that setting up ownCloud would be interesting. ownCloud is

    an alternative to many different cloud services, such as file storage (Dropbox, Google Drive, SkyDrive,

    etc.), calendars (Google Calendar, etc.), music player (Google Music), personal picture viewer (Picasa,

    flickr,etc), and others. It has quite a few interesting features and is very actively developed.

    The Raspberry Pi is surprisingly easy to set up with Raspbian, and I was off and running in no time. I

    would go through the details, but I followed the Raspberry Pi Wiki article on SD card setup. I was able

    to use SSH to login after the first boot, so I did not even have to plug it into my TV. I did not do

    anything special with the configuration of my Pi, but I plan on activating the turbo setting in the

    firmware, so I can get the processor speed up to 1Ghz.

    In order to run ownCloud, you need a webserver and PHP. Apache can be a bit big for the Pi which only

    has 256MB of RAM (they now come with 512MB), so I chose to install nginx and PHP-FPM.

    aptitude install nginx php5-fpm php5-sqlite php5-gd

    Then, create a file in /etc/nginx/sites-available/. I called mine owncloud.vhost:

    SETTING UP THE RASPBERRY PI

    SETTING UP NGINX AND PHP

    123456789

    1011121314151617181920212223242526272829

    # redirect http to https.#server {# listen 80;# server_name owncloud.example.org;# rewrite ^ https://$server_name$request_uri? permanent; # enforce https#} # owncloud (ssl/tls)server { #listen 443 ssl; listen 80; #ssl_certificate /etc/nginx/certs/server.crt; #ssl_certificate_key /etc/nginx/certs/server.key; #server_name localhost; root /usr/share/nginx/www/owncloud; index index.php; client_max_body_size 1000M; # set maximum upload size # deny direct access location ~ ^/(data|config|\.ht|db_structure\.xml|README) { deny all; } # default try order location / { try_files $uri $uri/ @webdav; } # owncloud WebDAV

    I am Nick, and these are

    my projects.

    ABOUT ME

    RandomDragon*ConUniversity ProjectsSteampunkEngineering Helicopter

    rPi

    CATEGORIES

    Apr 2013 (1)

    Oct 2012 (3)

    Sep 2012 (2)

    May 2009 (1)

    Nov 2007 (1)

    Aug 2007 (2)

    Apr 2007 (3)

    BLOG ARCHIVE

    ?

    Nick's Projects: ownCloud on a Raspberry Pi http://projects.nicholaslessley.com/2012/10/owncloud-on-raspberry-pi.html

    1 of 6 3/31/2014 1:05 AM

  • at 1:46 PM

    Categories: Random, rPi

    I actually got the majority of this file from ownCloud.org. Then create a soft link to /etc/nginx

    /sites-enabled:

    ln -s /etc/nginx/sites-available/owncloud.vhost /etc/nginx/sites-enabled/

    Note: I removed the default server in sites-enabled.

    I then modified /etc/php5/fpm/php.ini to include the following:

    I downloaded the gzipped tar of ownCloud 4.5 from ownCloud.org, then decompressed it and copied it

    to /usr/share/nginx/www/owncloud.

    Then,

    sudo chown -R www-data:www-data /usr/share/nginx/www/owncloud

    You should now be able to start nginx and php-fpm, then using your web browser to go to the IP

    address of your Pi, and BOOM! ownCloud!

    123456

    extension=sqlite.soextension=zip.soextension=json.soextension=xmlrpc.soextension=curl.soextension=gd.so

    INSTALLING OWNCLOUD

    Replies

    23 comments:

    ill13 November 3, 2012 at 7:31 PM

    Thanks! I've been messing around with 6 different ways of installing ownCloud with Apache and now,

    nginx [Apache being too heavy for the RPi]. Your nginx/php install has been the most straight forward

    and easy.

    Reply

    Nicolai January 4, 2013 at 9:09 PM

    Probably due to lack of expertise I had a few problems.

    One was, that the ln -s /etc/nginx/sites-available /etc/nginx/sites-enabled creates a link named sites-

    available in sites-enabled and nginx does not like that. Hence I made links the following way ln -s

    /etc/nginx/sites-available/* /etc/nginx/sites-enabled

    Another Problem is, that I do not know how to bring nginx not serve default but owncloud.vhost

    So I moved owncloud.vhost to default.

    You do not have by any chance a clue what I did wrong or where to look for further information?

    I did read http://blog.martinfjordvald.com/2010/07/nginx-primer/ and

    http://blog.martinfjordvald.com/2010/07/nginx-primer/ but did not succeed in finding my failure.

    Nonetheless, this is a good HowTo, it helped me who never set up such a thing before a lot. And I tried

    and failed following others. Thank you!

    Reply

    Nicholas Lessley January 9, 2013 at 7:28 AM

    Sorry for the confusion.

    ?

    Nick's Projects: ownCloud on a Raspberry Pi http://projects.nicholaslessley.com/2012/10/owncloud-on-raspberry-pi.html

    2 of 6 3/31/2014 1:05 AM

  • Reply

    Replies

    Reply

    Replies

    Reply

    I have updated the link command to be more specific. You have to link the individual sites

    from one directory to the other. Also, I don't have default in my sites-enabled.

    Nicolai January 6, 2013 at 3:29 PM

    There are two small mistakes in your owncloud.vhost. Both off the "fastcgi_params HTTPS on;" should

    be "fastcgi_param HTTPS on;".

    Reply

    Nicholas Lessley January 9, 2013 at 7:39 AM

    Wonderful catch! I have updated the post!

    JBilert January 28, 2013 at 2:58 PM

    Hey, I also just followed your script and everything went quite smooth - so thanks for your work.

    When i enter the raspi's ip into my browser though i get stuck at a page saying "Welcome to ngnix!" Do

    you have an idea where I might have gone wrong?

    Reply

    Anonymous February 8, 2013 at 10:11 AM

    maybe enter your raspberries ip addres/owncloud ?

    otherwise the browser is going to the index.html in the nginx www folder

    Nicolai February 9, 2013 at 12:28 PM

    I think it is just the default-file. Remove it and you should be fine.

    Anonymous March 16, 2013 at 8:09 AM

    Hey,

    I also installed owncloud and got it working (4.8) but am not able to get the send link functionality

    going. How do we need to configure owncloud on the raspi? Tried smtp, php and sendmail but each one

    give errors.. so the mail is not send.

    Reply

    Nicolai March 25, 2013 at 8:08 PM

    I do not think that this is raspi-specific. It is probably a better idea to ask in the owncloud-related-

    forums.

    Reply

    Christoph April 22, 2013 at 1:12 PM

    Hey,

    I tryed to follow you're tutorial. But when I start the nginx server I get the following error message:

    nginx: [emerg] unknown directive " " in /etc/nginx/sites-enabled/default:9

    Nick's Projects: ownCloud on a Raspberry Pi http://projects.nicholaslessley.com/2012/10/owncloud-on-raspberry-pi.html

    3 of 6 3/31/2014 1:05 AM

  • Replies

    Reply

    Replies

    I updated the /etc/nginx/sites-available/default file with your code above.

    Have you an idea why I get this error?

    Reply

    Anonymous June 2, 2013 at 1:11 AM

    @Christoph: Did you ever find a fix?

    Reply

    Unknown June 10, 2013 at 9:40 PM

    I am very interested in this project, and would be interested in making my ownCloud available

    anywhere, even outside my LAN using a dns provider like http://dyn.com/dns/

    How exactly would I link the domain I receive from them to the IP address of my owncloud? Thanks for

    the awesome tutorial, it was perfect in helping me get set up.

    Reply

    Nicolai June 16, 2013 at 4:15 AM

    if your raspberry is directly connected to the modem install the no-ip-client (or the one of a

    similar service).

    if your raspberry sits behind a router (very likely) your router need to run a client. most

    routers have one integrated in their firmware.

    look in the configuration website (192.168.1.1 or something similar) and set it up there.

    if you sit behind a router you need to foward the ports you want to be reachable from

    outside. this should be under a point called "port forwarding" or "NAT".

    if your aim is mainly file sync, then you could have a look at seafile as well, which is easier to

    install and configure and also a lot faster.

    Anonymous July 16, 2013 at 4:31 PM

    First of all, thanks very much for the instructions. I find them very useful!

    I have one problem. Once I login for the first time into Owncloud and after setting the Administrator

    user and password, Owncloud get stuck with the following order "upgrading filesystem cache".

    The syncronization of files is working, but I cannot access Owncloud via http. I have seen that many

    people has the same problem but I still could not find a solution.

    Can you please help me! I had to install the version 4.5.13. This version works but is much slower than

    OC5.

    Thanks!

    Reply

    Anonymous July 17, 2013 at 12:46 PM

    Hi! It's me again!!!!

    Just want to say that I've been testing the version 4.5.13 and it's really fast!!! I'm surprised

    about the performance of the raspi with ngnix!!!

    Still cannot install the version 5.0.9 (latest now) but the 4.5.13 does also the job!

    Thanks!

    Nick's Projects: ownCloud on a Raspberry Pi http://projects.nicholaslessley.com/2012/10/owncloud-on-raspberry-pi.html

    4 of 6 3/31/2014 1:05 AM

  • Reply

    Replies

    Reply

    Anonymous August 10, 2013 at 8:07 AM

    hi,

    thanks for the how-to, but i also have some problems. nginx is not happy with the config file. it says

    "unknown directive " listen" in the owncloud.vhost file ?!

    it also says that the configuration file nginx.conf test failed. (one alert that he can't open the error log file

    due to permission issue and a warning that the "user" directive only makes sense if the master process

    runs with super user privileges.

    Any help is welcome.

    thanks

    d

    Reply

    Anonymous August 10, 2013 at 8:36 AM

    Me again. found the problem. Since i used a copy and pasted the conf. lines in a wrong way the config

    file was defunct. rewrote it and now it works.

    d

    Reply

    Anonymous December 11, 2013 at 8:28 AM

    Do you know whether it is possible to have Owncloud automatically update when a new release is

    available, or at least notify me when I need to take action?

    Reply

    Willem January 27, 2014 at 2:33 PM

    Is the owncloud reachable all over the world. So if i'm in a other country i can go to a website to reach

    my data i have home?

    Reply

    Willem January 27, 2014 at 2:34 PM

    is the cloud reachable over the internet? not only local?

    Reply

    Anonymous February 26, 2014 at 5:24 AM

    just enable port forwarding on your router! (I suggest port 443) and then setup a dynamic

    dns, such as NO-IP (you can have a nice free plan)

    Folkert March 10, 2014 at 11:03 AM

    Hi, when I acces "mysite-url/owncloud/", the file index.php is downloaded instead of parsed. Is this a

    configuration error?

    Reply

    Nick's Projects: ownCloud on a Raspberry Pi http://projects.nicholaslessley.com/2012/10/owncloud-on-raspberry-pi.html

    5 of 6 3/31/2014 1:05 AM

  • Newer Post Older PostHome

    Subscribe to: Post Comments (Atom)

    Comment as:

    Publish

    Template images by Ollustrator. Powered by Blogger.

    Nick's Projects: ownCloud on a Raspberry Pi http://projects.nicholaslessley.com/2012/10/owncloud-on-raspberry-pi.html

    6 of 6 3/31/2014 1:05 AM