Instructables

Raspberry Pi Owncloud (dropbox clone)

Picture of Raspberry Pi Owncloud (dropbox clone)
What I'm going to show you is how to build a your own personal dropbox like service using a raspberry pi and some software called OwnCloud. ownCloud gives you freedom and control over your own data. It's a personal cloud which runs on your own server.

If you don't want to go through the steps for downloading and setup up the software you can download the image I have setup from here. While I have done everything I can to check this is working it should be understood that you use at your own risk. If you do download the image you can skip to step 5. 




 
Remove these adsRemove these ads by Signing Up

Step 1: What you need

Picture of What you need
IMGP8155.JPG
IMGP8151.JPG
IMGP8157.JPG
A Raspberry Pi
An Usb External Harddisk or a USB Drive
An Enclosure for the Raspberry Pi and Hard Disk
Wireless network card (optional)




Step 2: Setting up the network download the software

Picture of setting up the network download the software
So first off we need to give the Pi a fix IP address we do this by editting the network interfaces file

$ sudo nano /etc/network/interfaces

Once open we need to make the file look like this (your IP address might be different)

auto eth0
iface eth0 inet static
       address 192.168.1.118
       gateway 192.168.1.1
       netmask 255.255.255.0
       network 192.168.1.0
       broadcast 192.168.1.255

The file then needs to be saved by pressing ctrl o and ctrl  x to exit

once exited the networking need to be restarted

$ sudo /etc/init.d/networking restart

After that is done we need to update the Pi and download the software. This will take a little while to complete

$ sudo apt-get update

We are going to install Apache with SSL, PHP5, PHP APC which will load pages faster

$ sudo apt-get install apache2 php5 php5-json php5-gd php5-sqlite curl libcurl3 libcurl4-openssl-dev php5-curl php5-gd php5-cgi php-pear php5-dev build-essential libpcre3-dev php5 libapache2-mod-php5 php-apc gparted

Step 3: Configuor php & Apache

Picture of Configuor php & Apache
Screen Shot 2012-10-27 at 16.18.07.png
Screen Shot 2012-10-27 at 16.18.32.png
Screen Shot 2012-10-27 at 16.18.53.png
Screen Shot 2012-10-27 at 16.19.49.png
Screen Shot 2012-10-27 at 16.20.49.png
Now we have download the software we need to configor it.

First off we need to install PHP apc

$ sudo pecl install apc
 
After that is done we need to create the apc.ini

$ sudo nano /etc/php5/cgi/conf.d/apc.ini

In to that file we need to add the following

extension=apc.so
apc.enabled=1
apc.shm_size=30

Once added the file needs saving

Next up we have to change the PHP.ini to change the max upload file so we can add large file and add the APC externsion to PHP

$ sudo nano /etc/php5/apache2/php.ini

In this file we need to find upload_max_filesize and then change the value to 1024M which will allow files of upto 1GB to be uploaded

The we need to find post_max_size and then chaged the value to 1200m which will allow files to upto 1 gb to be uploaded

We need to find externsion= section and add in the extension=apc.so

After we have done that save and exit

next up we need to config apache and enable SSL

$ sudo nano /etc/apache2/sites-enabled/000-default

inside the file we need to change Allow over ride to All from none 

Next up we need to setup SSL

$ sudo a2enmod rewrite
$ sudo a2enmod headers


After the follow command you will be asked to provide information

sudo openssl genrsa -des3 -out server.key 1024; sudo openssl rsa -in server.key -out server.key.insecure;sudo openssl req -new -key server.key -out server.csr;sudo openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt;sudo cp server.crt /etc/ssl/certs;sudo cp server.key /etc/ssl/private;sudo a2enmod ssl;sudo a2ensite default-ssl

Once all that is done the apache need restarting

$ sudo service apache2 restart

Step 4: Download and install own cloud

Picture of download and install own cloud
Now we have Apache and PHP setup we need to download own cloud

$ wget http://mirrors.owncloud.org/releases/owncloud-4.5.1.tar.bz2

once download it needs unziping

$ sudo tar -xjf owncloud-4.5.1.tar.bz2

And then copying in to the web root

$ sudo cp -r owncloud /var/www

After it's been copied we need to give the webserver permission to access the owncloud directory

$ sudo chown -R www-data:www-data /var/www/owncloud/

We also need to edit the .htaccess file to change the max upload file these values need to changed to the same values as you set in you php.ini

$ sudo nano /var/www/owncloud/.htaccess

Step 5: Setup own cloud

Picture of setup own cloud
Screen Shot 2012-10-27 at 18.25.06.png
Screen Shot 2012-10-27 at 18.25.25.png
The easy way to setup the external drive is to use gparted on the Pi

$ startx

and the from inside the  GUI open a ternmail and type

$ sudo gprarted

from here you can partion and format the drive

Once done give the web-server permission 

$ sudo chown -R www-data:www-data /media/owncloud

All that needs to be done now is to setup owncloud

in a web browser type in https://IPADDRESS/owncloud

Choose a user name and password by typing then in to the user name and password box

click advanced and changed the data location to the place of your external drive in my case it's /media/owncloud

The click finish and you are done.

You should now be able to upload files. To play video files you'll need to enable the video player app.

To setup external access to your device I would suggest using DyDns or Noip.

Step 6: Placing it in the encloser

Picture of Placing it in the encloser
IMGP8172.JPG
IMGP8171.JPG
IMGP8170.JPG
IMGP8163.JPG
IMGP8161.JPG
Now the software is setup the Pi just needs placing in to the box. I would drill some hole in the box to allow a little air flow.

And that's it done.
HackaCracka2 months ago

Hi.

I really like the sound of this project, it seems like a great way of using dropbox, without leaving my files in someone else's care. Can anyone tell me if i would be able to use this with a smartphone (specifically an iPhone) to store photos and such like, much as i do with dropbox at the moment.

OwnCloud does have an iPhone app as well as an Android. I know that the one for Android works very nicely and even has an instant upload feature.

Enjoy.

https://itunes.apple.com/us/app/owncloud/id543672169?mt=8

malakesher2 months ago

When I create the admin account on owncloud and click finish set up the page say "Your web server is not yet properly setup to allow files synchronisation because the WebDAV interface seems to be broken." any idea what I did wrong?

I ran into this problem the other night while building a Pi ownCloud box. Not knowing what this image looks like on the inside, my advice should be taken with a grain of salt, but what you can do (on a Debian-base such as Raspbian) is simply apt-get (or aptitude) install owncloud. This will give you a working, if old, version of owncloud. You can also go to the ownCloud web site link way below and add the repository to your sources.list and install the latest version. I can vouch for the Debian version working on the Pi as I finished it last night 2/11/2014 and it's working fine.

Best of luck.

http://software.opensuse.org/download/package?project=isv:ownCloud:community&package=owncloud

francofool3 months ago
It's not often I make a new account to leave a comment, but I felt I had to with this tutorial. Although I cheated by using the image you supplied, I really enjoyed the way you explained everything, as I am just sprouting out of my raspberry pi noob stage. Thanks for showing me how to get this up and running because now I have a 1T cloud at my disposal which is so awesome.

To anyone else who is trying to keep the windows files system on their hard drive, I eventually just gave up on mounting it that way and did what the guide told me to do. I reformatted so 500GB were in NTFS and 500GB were in ext4. I went through several rewrites trying to keep it in windows and it just was not working. But reformatting and mounting the ext4 partition did the trick for me.

Thanks again for the help, you did a great job
vladcoolv3 months ago
i will try it
bugmeidareyou4 months ago
The current location seems to be:
wget http://download.owncloud.org/community/owncloud-latest.tar.bz2
ypelster4 months ago
Hi. I've downloaded the image and used win32diskimager to write it to SD card.
Now I've inserted the card into PI, and plugged on (in that order) Ethernet and power.
As I'm running headless and used to work with remote desktop connection up to now, I cannot see why, but I do not seem to have an Ethernet Connection. The controlling LEDs are off and I cannot see PI in my router as I used to. Any hints or ideas ?
lau1406 ypelster4 months ago
have you tried a different ethernet port on your router?
ypelster lau14064 months ago
yes, I've tried that. I have even borrowed a monitor, and pi doesn't seem to boot at all - I've attached HDMI cable, usb keyboard and usb mouse, then power. No signs of life from pi. On a different SD Card I have set up a system with NOOBS which runs just fine. Any Ideas ?
lau1406 ypelster4 months ago
You can try it without the image, doing steps 1 to 5 in stead of using the image.
ridopc4 months ago
Thanks for the tutorial! I have used and modified to make it one in Italian!
shywolf915 months ago
Could this be used outside my local network?
chizpa shywolf914 months ago
yes, just enter your public ip instead of your local ip (local: 192.168.x.x), global ip varies unless you have static ip or are using no-ip.

Be sure to forward port 22 for SSH access and port 80 for HTTP access.

Here's a link (if You want to know your global ip right now):
http://www.whatsmyip.org/
senavi4 months ago
hi,
i am going to setup this with a sata hdd. i am currently using dropbox and it is the best cloud which i have used. Is there any specific differences between dropbox and owncloud?
Thank you.
ps0ram5 months ago
very good idea and tech http://esyncsecurity.com
Fabi2801 year ago
What's the average speed for a file transfer?
Wouldn't using nginx speed it a bit up?
hackitbuildit (author)  Fabi2801 year ago
The file transfer speed is about 5-10 seconds to upload a 10MB mp3 file and about 3 Minutes to upload a 350MB video file.

Using nginx might speed it a bit but it seems to be going at an acceptable speed and I've been using apache for about 12 years so am just more use to it.
A very, very, good guide. A few spelling mistakes, but with an existing Pi I was up in 20 minutes. I didn't notice any point about changing the default .htaccess in /etc/apache2/apache2.conf to allow overrides, then the if needed the .htaccess in the default directories. However, small, stuff easily solved.

NOTE: The stupid captcha (why are we doing this?) won't show on FF in safemode so I went this route.
I'm also curious about the pi's performance. Did you test this on the new 512 MB Pi or the older 256 MB?
hackitbuildit (author)  unholythree1 year ago
Its with the 256MB Pi the performance is good. The thing to point out is I'm the only user of it which means it doesn't have to multi task at any point.
A very, very, good guide. A few spelling mistakes, but with an existing Pi I was up in 20 minutes. I didn't notice any point about changing the default .htaccess in /etc/apache2/apache2.conf to allow overrides, then the if needed the .htaccess in the default directories. However, small, stuff easily solved.
hey, great tutorial! Thank you so much!

I just installed transmission on my pi, because it has a nice webui for adding torrents.

Now I have a remote cloud storage/torrent seedbox that I can add torrents to from my iphone. It wasn't that hard, I just ended up:
- copying (-p to keep permissions/ownership) the whole /var/www/owncloud/username/data to a USB thumb drive.
- changing transmission user to "pi" (superuser) and making it part of the www-data group.
- changing permissions of progress, torrentwatch and /data/files folders to 770 (so the "pi" user can write to them from www-data group)
-opened some ports, did a test run, put a slash after /transmission/web url and....voila!

I'll post a tutorial about how to modify to add transmission later if anyone is interested...or even if they're not xD.

Thanks again for tut.
TXTCLA557 months ago
Hi, I used your image file to set mine up. However I dont have my external drive just yet, is there a way I can test this part out without the drive?
You can follow this guide to try out what you are asking here:
http://www.techjawab.com/2013/09/how-to-setup-your-own-cloud-on.html
abhishek23866 months ago
If you already have a Raspberry Pi setup and don't want to replace the setup with a new image, rather want to install ownCloud over it then follow this guide here http://www.techjawab.com/2013/09/how-to-setup-your-own-cloud-on.html
javl8 months ago
It would be nice if you could explain some things a bit more, like:

"In to that file we need to add the following
extension=apc.so
apc.enabled=1
apc.shm_size=30"

What are these values? It is always good to know what it is you're doing, instead of just following the steps blindly.
ard10n9 months ago
Barracuda
greatpanda11 months ago
FYI, your command line text in step 5 should read sudo gparted, not sudo gprarted.
hot-chili1 year ago
In response to adriancuervo:

99.9% of the general population  has no idea what open source is or cares about the ideology. They are not developers and they just want something that works. My neighbors and friends have no clue about what open source is when I bring it up in a discussion, and they all seem to concur about  going with a product  supported by a company.

BTW, although Real Time Logic could close the project, the software would still be available on the Internet for eternity. Just because software is old and not maintained does not mean it's not useful. I still prefer XP over Windows 8. In any event, I find it extremely unlikely that Real Time Logic would close the project.   Just because something is open source does not mean that it could not be shut down or maintained.

Owncloud is extremely slow on the Raspberry Pi. You should check out the following benchmarking, which shows how BarracudaDrive outperforms all major servers such as Apache and Nginx by a large margin.

http://barracudadrive.com/blog/2013/03/Apache-Nginx-Lighttpd-Monkey-and-BarracudaDrive-Speed-Test
hot-chili1 year ago
BarracudaDrive is much lighter, faster, and includes more features:
http://store.raspberrypi.com/projects/barracudadrive
Maybe, I did't check the features, but the point is: it's not Open Source. In other words, if in 2014 Real Time Logic closes this project, they kills you :) Open Source is the way in computer development.
GR0B1 year ago
For a newer versions of owncloud use "4.5.7" instead of "4.5.1"

wget http://mirrors.owncloud.org/releases/owncloud-4.5.7.tar.bz2
sudo tar -xjf owncloud-4.5.7.tar.bz2
village761 year ago
Hi, thanks for this, got it up and running nicely. But at the end of your project you say that it would be possible to access the Rpi remotely using noip. Would this allow me to use the Rpi from a remote computer as if I was sat in front of it? Or would this just be another way of access owncloud?

Following these instructions (http://www.stuffaboutcode.com/2012/06/raspberry-pi-access-from-internet-using.html) I've set up the no-ip account, got a host and set the client running on the Rpi (which has a fixed internal IP address) but all I'm seeing when I put in http address in the browser (http://myname.no-ip.org) is the home page of my router. I see from other posts I need to set up port forwarding but I'm a bit new at this and can't work out which port I need to forward. I guess I'm then forwarding that port to the fixed IP address of my RPi. Once I've done this, what shoud I expect to see? Grateful for your views
etossin1 year ago
I know it’s a lot to ask, but could you please upload a Raspberry Pi Image with Owncloud V.5.00 installed?

Or give instructions on how to update from version 4.51?

Thanks in advance!
jshaw221 year ago
I loved this guide but I kept struggling to get the permissions set and the thing firing on my USB drive. In the end, I used the apt-get package and it configured owncloud and permissions perfectly. Another bonus- upgrades. Just in case it helps someone reading this...

From http://software.opensuse.org/download/package?project=isv:ownCloud:community&package=owncloud

For Debian 6.0 run the following as root:

echo 'deb http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_6.0/ /' >> /etc/apt/sources.list.d/owncloud.list
apt-get update
apt-get install owncloud

You can add the repository key to apt like this:

wget http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_6.0/Release.key
apt-key add - < Release.key

Cheers! Thanks for the guide.
dcdevito1 year ago
@philpage85:

make sure /media/owncloud is mounted. From the command prompt type:

mount

And see (mine was /dev/sdb1) the usb drive mounted (you'll see /media/owncloud). If not simply type:

mount /dev/sdb1 /media/owncloud
philpage851 year ago
Hi I am hoping somebody can help?

I get to step 5 and enter

$ sudo chown -R www-data:www-data /media/owncloud

and I get

chown: cannot access '/media/owncloud': no such file or directory?

I am a noob to all this so any help would be grateful.

many thanks

Phil
dcdevito1 year ago
I'm getting a "failed to write to disk" error when trying to upload videos, ranging from 150MB to 400MB in size. I'm trying to upload them individually but still get the error.

I am able to upload tons of pics with no issue. I see in php.ini the max upload size is set to 1200MB - is that too large perhaps? I also saw the temp directory location commented out so I un-commented it and created a tmp directory in /media/owncloud/tmp (and added it to the path in the .ini) - however, it still fails.

Any suggestions? Cheers
bigme1 year ago
Haven't done much with our pi since getting this summer, this looks like a great idea. Of course if I get it set up my kids will think of another good use for the pi so maybe I should just order an additional pi before I get started.
Thanks for the great write up
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!