How to make a Dropbox clone out of your Raspberry Pi (using OwnCloud)

Self-hosting your own web services is getting increasingly popular lately. Hosting these on a Raspberry Pi is a great fit, due to it's low power usage and availability of software. Here is a tutorial on how to host ownCloud on your Raspberry Pi.

OwnCloud is a software which allows you to sync effortlessly files between multiple users and computers. If Dropbox is a familiar service, ownCloud is pretty much the same but self-hosted. It has desktop and mobile apps, web client, encryption etc.

This tutorial assumes that you have installed Raspbian on your SD card and it will boot up.

What you need

  • Raspberry Pi (Model B, Model B+ or 2 Model B)
  • Network access (throught Ethernet or Wifi)
  • External HDD or USB memory (optional)

Install LAMP

Let's start by installing a basic web stack (Apache, SQLite and PHP). In your terminal write:

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 libpcre3-dev php5 libapache2-mod-php5

After installation, some configuration is advised. Edit the PHP configuration file /etc/php5/apache2/php.ini (remember, as sudo).

Find the following rows and change the values accordingly:

upload_max_filesize = 1024M
post_max_size = 1024M

This will allow us to upload up to 1GB files.

You can also enable SSL encryption to the website. For it, edit the file /etc/apache2/sites-enabled/000-default.

Change "AllowOverride None" to "AllowOverride All"

Enable Apache Headers and Rewrite modules.

sudo a2enmod rewrite
sudo a2enmod headers

Generate self-signed SSL certificate and enable it in Apache:

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

Restart Apache and we should be done.

sudo service apache2 restart

Install ownCloud

Download latest version of ownCloud.


Unzip it

tar -xjf owncloud-latest.tar.bz2

Copy the files to web root

sudo cp -r owncloud /var/www

Change the ownership to webserver

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

Also edit the .htaccess file in ownCloud's folder, set the max upload file values to be the same as in your Apache configuration.


You should now have ownCloud installed and working. Go to http://yourip/owncloud (https://yourip/owncloud if you used SSL) to access the setup wizard for ownCloud.


You can attach an external USB drive to your Raspberry Pi and have it work as a data location for ownCloud. To do that, partition the disk first with partition editing software, for example gparted. Format it in any file system you like (for example ext4) and make sure to check the folder it is mounted in. Also remember to change the ownership of that folder to www-data, so that ownCloud can write in it. 

So that you don't have to remember your IP address to access ownCloud, you can use dynamic DNS services such as dns4e for getting a simple domain name for your server. has a simple tutorial on how to set this up.


Add new review

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.