Who doesn't use services like DropBox, Google Drive, OneDrive or similar? They are all services that specialize in keeping data on different devices in sync. This enables us to view photos from the iphone on the ipad or pc. In itself this is a useful thing, but on the other hand we also make our photos freely available to the companies that provide the relevant service.
I don't want that and prefer to be in control of my data and who has access to it. A complete cloud solution is provided by the OwnCloud Projekt free of charge, the clients are controlled by the https://owncloud.com/Firma OwnCloud.
A cloud at home is nice, the Raspberry is available but the SD card is pretty small. External storage is therefore required for the data within the cloud. You can either use a USB hard drive that you connect to the Raspberry (it should be a hard drive with automatic shutdown when inactive and without an external power supply, because we don't want to heat the living room), or a NAS hard drive. I chose the latter option.
We need a working Web Server as a prerequisite for this howto. Owncloud under Apache2 stores its data in the directory /var/www/owncloud/data, which we first put on an external drive. I created an NFS share on the NAS server, which I mounted in the file system before installing Owncloud. The entry in /etc/fstab is used for this purpose
mycloudex2ultra.fritz.box:/mnt/HD/HD_a2/owncloud /var/www/owncloud/data nfs rw,relatime,vers=3,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo =600,retrans=2,sec=sys,mountvers=3,mountport=32840,mountproto=udp,local_lock=none 0 0
Before using Owncloud for the first time (i.e. before installing Owncloud), the directory must be created
sudo mkdir -p /var/www/owncloud/data sudo chown -R www-data:www-data /var/www/owncloud/data
The command
sudo mount /var/www/owncloud/data
mounts the drive to the file system.
Since Owncloud needs a database and you can choose between MySQL and MariaDB, the database software has to be installed first. I chose MariaDB, which Oracle has announced will no longer make MySQL available as open source for free. The passwords for the databases created during the installation must be written down and kept safe.
sudo apt-get install mariadb-server
This completes the preparatory work and Owncloud can be installed.
I used owncloud version 10, which is not yet available in the standard Raspbian repository. To get the current version we need a new file named owncloud.list under /etc/apt/sources.list.d/ . The content looks like this:
deb http://download.owncloud.org/download/repositories/10.0.1/Debian_8.0/ /
The commands
sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade
update the package database and bring our system up to date.
The installation of Owncloud is unspectacular:
sudo apt-get install owncloud
Our owncloud server is now available at http://<dynDNS_Name/owncloud.