Raspberry Pi as an OwnCloud Server

On 2012/08/24, in Linux, RaspberryPi, by Greg Woods

First, see http://gregwoods.co.uk/2012/08/setting-up-the-raspberry-pi-the-basics/

Install Apache

sudo apt-get install apache2 php5 php5-gd php5-sqlite libcurl4-openssl-dev php5-curl php5-common php-xml-parser sqlite

Test the webserver works. Can browse to http://<your-ip-address>

Set up the USB disk for OwnCloud

  • Format the disk as NTFS
  • Plug it into the RaspberryPi
sudo mkdir /media/disk
  • Check user id with
 sudo nano /etc/passwd

user ‘pi’ probably has an id of 1000

  • Check disk device name with
sudo parted
   print all

shows disk is /dev/sda and partition number is 1  (in my case)

   quit
sudo nano /etc/fstab

Add an entry…

/dev/sda1 /media/disk ntfs permissions 0 0

save and quit nano

sudo mount /media/disk
sudo mkdir /media/disk/web
sudo chown -R www-data:www-data /media/disk/web

#a chmod doesn’t seem to be needed, it already has 0770 permissions

Install OwnCloud

sudo apt-get install sqlite
  • check latest release at http://download.owncloud.org/releases
sudo wget http://download.owncloud.org/releases/owncloud-4.0.7.tar.bz2
 sudo tar -xjf owncloud-4.0.6.tar.bz2
 sudo cp -r owncloud /var/www
 sudo chown -R www-data:www-data /var/www/owncloud

Upgrading OwnCloud

NOTE: I’ve only done this once, so I’ll ikely find a better way of doing it next time.
This method doesn’t preserve config – try preserving it next time.
Looks like it rescans the folders, possibly recreating the database
COnfig is in /var/www/owncloud/config
Maybe need to compare old and new config files after an upgrade

Probably best to disconnect all clients. Not sure if possible to do this from the server. Stopping apache would likely do it.

Delete the extracted owncloud files, and the owncloud installation

sudo rm -r ~/owncloud
sudo rm -r /var/www/owncloud

Then the same instructions as a new install

First Use / Setup of OwnCloud

  • http://<you-ip-address>/owncloud/
  • You MUST choose the advanced settings
  • Create admin user and password
  • location of data is:  /media/disk/web

ToDo

sudo apt-get install php-apc

to speed things up in php

 

Now go and download an OwnCloud client, and enjoy your local network DropBox-like functionality

 

 

6 Responses to Raspberry Pi as an OwnCloud Server

  1. Martin says:

    Hi there,

    why do you use “ntfs” for the external hard drive?

    bye, Martin

  2. admin says:

    Apologies for taking a long time to approve your comment. I must check my WordPress email settings!

    I use NTFS because my main PCs are Windows, and want to be able to access the disk easily, if for example, I need to get files onto the disk, or off the disk quickly (The raspi is very slow!)

    I aim to do another article or two about setting up Samba for file and print sharing.

  3. Modi says:

    How did you manage the Owncloud sync client to work.
    I always get a ssl handshake error, when i try to connect.

  4. Greg Woods says:

    I don’t remember having that error. I think you can now install OwnCloud using apt-get install owncloud. I’ll be trying that soon on a spare SD card. It should make installation and upgrades easier.

  5. Pawe? Szmajda says:

    Hey Greg,
    next time you upgrade OwnCloud don’t delete anything, just copy new files over the old ones, make sure owner and permissions are setup correctly and access your owncloud server via web browser. It’ll automatically run update scripts. That’s all.

  6. iBlog says:

    […] 8. Now it’s time to install owncloud. I used some commands as described here. […]

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>