There are many great file sharing and syncing service available such as Dropbox or Box.net and they all work great for accessing my files remotely, however I want something that I can use internally at home, just so I can access files such as music and documents across my machines. This is obviously not a document management system replacement that I talked about previously, rather a way for quick sharing.
Thankfully, with OwnCloud you can convert your RaspberryPi into an in-house (or even external) file syncing server in about 30 minutes. It’s that quick to build, really. So today I’ll share the steps with you.
Install Apache and PHP
If you haven’t yet, install Apache and PHP on your Raspberry Pi. These are the quick commands, for more details including adding the Pi user into the www-data group, see this article.
sudo apt-get install apache2-mpm-prefork
sudo apt-get install php5 php5-mysql php5-curl php5-gd
sudo apt-get install mysql-server
Prepare the Database for OwnCloud
After the Apache and PHP installation, create a database in your Raspberry Pi for OwnCloud. Simply use your terminal to do this.
mysql -u<your database username> -p<your database password>
Then create your database from the mysql command line.
create database owncloud;
Copy the OwnCloud Installer
The next step is visiting http://owncloud.org/install/ from the Raspberry Pi. Choose the web installer and save the installer php script on your root web server directory. This would most likely be /var/www.
Install OwnCloud from Your Web Browser
Simple follow the instructions on screen and the script will automatically create all the necessary files to run OwnCloud. After the installation has been completed, you will be presented with the setup screen. It’s always best practice to use data folder outside the /var/www directory of course so that your files are not accessible publicly, especially if you are port forwarding!
So choose a data folder on your SDCard or external drive. If you don’t know how to mount a device automatically, visit my Raspberry Pi backup article here (the mounting USB drive section), note that you will need a non vfat partition such as EXT3 or at least NTFS in order to support files and directories permissions such as 770 that OwnCloud requires. I’ll write about it in another opportunity when I have my external drive hooked to the Raspberry Pi.
Also make sure that any data folder that you have chosen as the permission set to read and write for www-data user, this is so that OwnCloud can write into that directory.
Download the Sync Client
Now that you have setup your Raspberry Pi OwnCloud server, download the OwnCloud clients and install them on your computers or mobile devices. Just follow the instructions on screen, don’t worry, it’s really easy :)
So that’s it. You now have your very own file sync service for use within your local network at home or work. Have fun!
file sync, owncloud, Raspberry Pi
Categorised in: Raspberry Pi