This post explains how to setup Dropbox like personal cloud using Raspberry Pi. Personal cloud will help to reduce recurring costs compared to subscription based cloud storage solution.
- A Raspberry Pi Board (B+/2) and its setup.
- A 32 GB Pendrive or an external Hard Disk.
- An Internet connection for the Raspberry Pi.
The initial step in this process is we need to give the Pi a fix IP address we do this by editing the network interfaces file using the “Lx Terminal” and any text editor (here I used “nano”).
$ sudo nano /etc/network/interfaces
Once open we need to make the file look like this (your IP address might be different)
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
When asked for the permission give “yes” by typing “y” and pressing “enter” in the LxTerminal.
Step 3: Configure php & Apache
After installing all the dependencies, now we have download the packages & need to configure it.
To start this we need to install PHP-Apc. For that type the following in Terminal.
$ sudo pecl install apc
After that is done we need to look for the 20-apcu.ini
$ sudo nano /etc/php5/cgi/conf.d/20-apcu.ini
In to that file we need to add the following
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=apcu.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
To show that you are performing actions at root level, the terminal will display root@…#
Enter the following commands at root level :
- “wget http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_7.0/Release.key ” (to get the ownCloud release key)
- “ apt-key add – < Release.key ” (to update the apt-get with the ownCloud repository.
- “ sudo echo ‘deb http://download.opensuse.org/repositories/isv:/ownCloud:/community/Debian_7.0/ /’ >> /etc/apt/sources.list.d/owncloud.list ” (to create the file owncloud.list with the repository details)
- update the sources with “ apt-get update “
- Install ownCloud with “ apt-get install owncloud “
You will need to enter a new password twice for root during the mysql package installation.
Once all the packages are installed, your Pi is running the latest version of ownCloud. From a web browser on your network, go to the ip address of yourpi/owncloud (eg. projpi.dyndns.com/owncloud or on your intranet via 192.168.x.xxx/owncloud).
Your personal cloud is ready now.
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.
Personal cloud is best option for data security reasons. 2 or more personal clouds can be merged for more reliability of data safety.