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.
Setting Up the Raspberry Pi
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.
Setting Up nginx and PHP
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-gdThen, create a file in /etc/nginx/sites-available/. I called mine owncloud.vhost:
# 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 location @webdav { fastcgi_split_path_info ^(.+\.php)(/.*)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #fastcgi_param HTTPS on; include fastcgi_params; } # enable php location ~ \.php$ { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #fastcgi_param HTTPS on; include fastcgi_params; } }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:
extension=sqlite.so extension=zip.so extension=json.so extension=xmlrpc.so extension=curl.so extension=gd.so
Installing ownCloud
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!