Zum Hauptinhalt springen

Raspberry Pi ownCloud

Raspberry Pi und ownCloud zusammen ermöglichen es mir, ganz einfach zu Hause meine eigene Cloud zu haben. Darauf kann ich Dateien, meine Kontakte, meinen Kalender und vieles mehr speichern. Um ein solches Setup auch anderen zu ermöglichen, veröffentliche ich hier meine dabei gemachten Notizen - ich hoffe sie nützen jemandem auch ownCloud auf einem Raspberry Pi 3 (oder neuer) zu installieren!

Kurzanleitung zum Installieren eines ownCloud-Servers auf einem Raspberry Pi

  1. Image installieren, z.B. vom Ubuntu Pi Flavour Maker

  2. Partition vergrössern

  3. Hostname anpassen: sudo vi /etc/hostname

  4. Neuen Benutzer erstellen: sudo adduser laurin1

  5. Neuen Benutzer sudo-Rechte geben: sudo adduser laurin1 sudo

  6. Passwort bei Sudo deaktivieren: sudo visudo und ergänzen mit laurin1 ALL=(ALL:ALL) NOPASSWD: ALL

  7. Remote Login ohne Passwort konfigurieren

    1. Auf meinem lokalen Computer einen neuen SSH-Key erstellen
    2. Wieder auf dem Raspberry Pi: mkdir .ssh
    3. vi .ssh/authorized_keys2 und ergänzen mit neu erstelltem id_rsa.pub
  8. Default-User entfernen: sudo deluser --remove-home ubuntu

  9. ownCloud installieren

wget -nv https://download.owncloud.org/download/repositories/stable/Ubuntu_16.04/Release.key -O Release.key sudo apt-key add - < Release.key rm Release.key sudo sh -c “echo ‘deb http://download.owncloud.org/download/repositories/stable/Ubuntu_16.04/ /’ » /etc/apt/sources.list.d/owncloud.list” sudo apt-get update sudo apt-get install owncloud


10. Benötigte Module vom Apache konfigurieren

   ```shell
sudo a2enmod ssl
sudo a2enmod headers
  1. SSL-Keys konfigurieren

  2. evtl. mit Let’s Encrypt

  3. oder mit StartSSL

    1. owncloud.mydomain.ch.crt und owncloud.mydomain.ch.key in /etc/apache2/ssl speichern
    2. Zugriff auf Keys einschränken: chmod -R 500 /etc/apache2/ssl
  4. Site erstellen: vi /etc/apache2/sites-available/owncloud.mydomain.ch.conf mit:

<IfModule mod_ssl.c>
<VirtualHost *:443>
     ServerAdmin webmaster@localhost
     ServerName owncloud.mydomain.ch

     DocumentRoot    /var/www/owncloud
     <Directory /var/www/owncloud/>
             AllowOverride All
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log

     # Possible values include: debug, info, notice, warn, error, crit,
     # alert, emerg.
     LogLevel warn

     CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined

     #   SSL Engine Switch:
     #   Enable/Disable SSL for this virtual host.
     SSLEngine on

     #   A self-signed (snakeoil) certificate can be created by installing
     #   the ssl-cert package. See
     #   /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
     #   If both key and certificate are stored in the same file, only the
     #   SSLCertificateFile directive is needed.
     SSLCertificateFile    /etc/apache2/ssl/owncloud.mydomain.ch.crt
     SSLCertificateKeyFile /etc/apache2/ssl/owncloud.mydomain.ch.key

     SSLProtocol All -SSLv2 -SSLv3
     SSLHonorCipherOrder On
     SSLCompression off
     # Add six month HSTS header for all users...
     Header add Strict-Transport-Security "max-age=15768000"
     # If you want to protect all subdomains , use the following header
     # ALL subdomains HAVE TO support https if you use this!
     # Strict -Transport -Security: max-age=15768000 ; includeSubDomains
     SSLCipherSuite 'EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH:+CAMELLIA256:+AES256:+CAMELLIA128:+AES128:+SSLv3:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:!SEED:!ECDSA:CAMELLIA256-SHA:AES256-SHA:CAMELLIA128-SHA:AES128-SHA'
</VirtualHost>
</IfModule>
  1. Site aktivieren: a2ensite owncloud.mydomain.ch.conf

  2. Datenbank installieren: apt-get install postgresql postgresql-client

  3. Datenbank erstellen:

  4. sudo su postgres

  5. createuser -P owncloud –> Passwort (z.B. WvZ43pg1LKZNSf85) merken!

  6. psql -c "CREATE DATABASE owncloud;"

  7. psql -c "GRANT ALL PRIVILEGES ON DATABASE owncloud to owncloud;"

  8. Nur falls die Datenbank von einem Backup wiederhergestellt werden soll: time pg_dump -c owncloud | ssh laurin1@raspberry -C "su postgres -c ""psql owncloud"""

  9. Konfiguration abschliessen

  10. ownCloud im Browser aufrufen

  11. oder Konfiguration direkt anpassen: vi /var/www/owncloud/config/config.php

'6235c4a4c3b51', 'passwordsalt' => '25636ba59c36a4903a25ab16a27cd2', 'datadirectory' => '/var/www/owncloud/data/', 'dbtype' => 'pgsql', 'version' => '8.2.2.2', 'dbname' => 'owncloud', 'dbhost' => '127.0.0.1', 'dbtableprefix' => 'oc_', 'dbuser' => 'owncloud', 'dbpassword' => 'WvZ43pg1LKZNSf85', 'installed' => true, 'forcessl' => true, 'theme' => '', 'maintenance' => false, 'memcache.local' => '\OC\Memcache\APCu', 'trusted_domains' => array ( 0 => 'owncloud.mydomain.ch', ), 'secret' => 'a8360bd59c36a4903a25ab16a27cd225636ba59c36a4903a25ab16a27cd225636ba59c36a4903a25ab16a275d225a36b', 'loglevel' => 2, 'trashbin_retention_obligation' => 'auto', ); ```