RaspberryPi Owncloud


Hold on, you will now create your own cloud based storage place!

First of all you have to add a new repository. The used information can be found on the ownCloud homepage, follow the download button to the packages (for auto updates) and choose Debian as operating system.

  • To trust the repository you should also install the key, but you don’t have to:
    >> wget http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_7.0/Release.key
    >> apt-key add - < Release.key
  • Now add the repository:
    >> echo 'deb http://download.opensuse.org/repositories/isv:/ownCloud:/community/Debian_7.0/ /' > /etc/apt/sources.list.d/owncloud.list 
    >> apt-get update
    >> apt-get install owncloud mysqlserver
  • If all has been successfully installed we need to change permissions and create a new database
    >> cd /var/www
    >> chown -R www-data:www:data owncloud
    >> mysql -u root -p
    >> Enter password: MSQLPASSWORD
    >> CREATE DATABASE owncloud;
    >> CREATE USER 'owncloud'@'localhost' IDENTIFIED BY 'userpassword';
    >> GRANT ALL PRIVILEGES ON owncloud.* TO owncloud@'localhost' IDENTIFIED BY 'userpassword'
    >> flush privileges;
    >> exit;
  • for directory browsing in the command shell I use the MidnightCommander. I also prefer the internal editor which can be found in the configuration menu.
    >> apt-get install mc
    >> mc
  • Adapt Apache settings:
    >> mc

    Browse to the /etc/php5/apach2/php.ini file, open it [F4]
    [F7, internal editor] and look for upload_max_filesize and post_max_size and enter in both cases 2048M (or the size you want to have)
    [F7] again and look for output_buffering, change the entries

    Default Value: Off
    Development Value: 4096
    Production Value: 4096
    >> service apache2 restart
  • Now open your webbrowser and type in the following URL (depends on the name of your RaspberryPi which has been set via the main RaspberryPi setup)http://raspberrypi/owncloud/
  • You should now see the owncloud configuration site, there you should follow the installation wizard.
  • Performance updates can be found here
    >> crontab -u www-data -e

    Then add this line to the file that has been opened:

    */15 * * * * php -f /var/www/owncloud/cron.php

    After that you have to go to the ‘Admin’ area in your ownCloud menu and select ‘Cron’ under the ‘Cron’ section. This will perform updates of the ownCloud server in the background of your webserver.

  • Congratulation! You have successfully installed ownCloud!


  • Security: encrypt your connection via OpenSSL:
    >> mkdir -p /etc/apach2/ssl
    >> openssl req -newkey rsa:4096 -sha512 -x509 -days 365 -nodes -keyout /etc/apache2/ssl/owncloud.key -out /etc/apache2/ssl/owncloud.crt
  • Follow the wizard but enter in the ‘Common’ area the hostname of your RaspberryPi, which is in my case the default name ‘raspberrypi’Adapt the Apache webserver:
    >> cd /etc/apache2/sites-available
    >> cp default-ssl owncloud
    >> mc

    Open the new created owncloud file [F4] and add the following lines under the ServerAdmin entry:

    ServerName raspberrypi
    <Directory /var/www/owncloud>
       options indexes FollowSymLinks MultiViews
       Order allow,deny
       Allow from all
       Satisfy Any

    Look for the following entries [F7] and adapt them to the created files:

    SSLCertificateFile /etc/apache2/ssl/owncloud.crt
    SSLCertificateKeyFile /etc/apache2/ssl/owncloud.key

    Now activate the Apache modules:

    >> a2enmod ssl
    >> a2enmod rewrite
    >> a2enmod headers
    >> a2enmod dav_fs
    >> a2ensite owncloud
    >> service apache2 restart

    Adapt /etc/hosts by adding the following entry:  raspberrypi
  • DynDNS adaptions: Same as before but now you have to set your dynamic DNS address in the ‘Common’ area of the openssl wizard. Change also the added entry in the /etc/hosts file!

Leave a Reply