Owncloud: Difference between revisions

From miki
Jump to navigation Jump to search
Line 154: Line 154:
* Click '''Add new profile'''. For Owncloud, we enter the following settings:
* Click '''Add new profile'''. For Owncloud, we enter the following settings:
:* Select profile type '''Generic CalDAV/CardDAV'''.
:* Select profile type '''Generic CalDAV/CardDAV'''.
:* DAV Url: something like '''<code>https://owncloud.immie.org/owncloud/remote.php/dav/addressbooks/users/XYZ/default/</code>'''.
:* Enter DAV Url, something like '''<code>https://owncloud.immie.org/owncloud/remote.php/dav/addressbooks/users/XYZ/default/</code>'''.
:* Enter username and password.
:* Enter username and password.
:* Select '''Synchronize items immediately after change'''.
:* Select '''Synchronize items immediately after change'''.

Revision as of 06:55, 10 June 2016

References

Tools:

Also on GitHub.
  • CardDAV-Sync — Another CardDAV sync app for Android (free / paid).

Install

Install packages

From Owncloud page, on Ubuntu:

wget -nv https://download.owncloud.org/download/repositories/stable/xUbuntu_14.04/Release.key -O Release.key
apt-key add - < Release.key
sh -c "echo 'deb http://download.owncloud.org/download/repositories/stable/xUbuntu_14.04/ /' >> /etc/apt/sources.list.d/owncloud.list"
apt-get update
apt-get install owncloud

On Debian 8:

wget -nv https://download.owncloud.org/download/repositories/9.0/Debian_8.0/Release.key -O Release.key
apt-key add - < Release.key
sh -c "echo 'deb http://download.owncloud.org/download/repositories/9.0/Debian_8.0/ /' >> /etc/apt/sources.list.d/owncloud.list"
apt-get update
apt-get install owncloud

Note:

  • Installing owncloud-files was not enough. Not sure what are the missing dependencies.

Optional:

  • Install php5-imagick to get image preview (but beware of recent vulnerabilities. See Linux security).

Configuration

When installed, Owncloud is available at URL http://localhost/owncloud/. This is configured in apache2 file /etc/apache2/conf-available/owncloud.conf:

Alias /owncloud "/var/www/owncloud/"
<Directory "/var/www/owncloud">
Options +FollowSymLinks
AllowOverride All

<IfModule mod_dav.c>
Dav off
</IfModule>

SetEnv HOME /var/www/owncloud
SetEnv HTTP_HOME /var/www/owncloud
</Directory>

<Directory "/var/www/owncloud/data/">
# just in case if .htaccess gets disabled
Require all denied
</Directory>

Note that owncloud files /var/www/owncloud are outside the regular http root (i.e. /var/www/html).


Before completing the installation, we first setup a virtual access to allow accessing Owncloud via HTTPS. This is also recommended for remote installs. For this create the file /etc/apache2/sites-available/owncloud.immie.org.conf, with content:

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

DocumentRoot /var/www/html

# Owncloud configuration: see conf-available/owncloud.conf

SSLCertificateFile      /etc/ssl/certs/ssl-cert-owncloud.immie.org.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-owncloud.immie.org.key

# ...

</VirtualHost>
</IfModule>

We only list the most relevant settings. Basically we only setup the server name and give the SSL certificates. For now, we leave File:/owncloud as a global alias.

Enable the site:

a2ensite owncloud.immie.org
service apache2 reload

We also need to create a new MySQL user and database for owncloud. This way owncloud will not use MySQL root access.

MYSQL_HISTFILE=/dev/null mysql --user=root -p mysql          # You'll need MySQL root user password
CREATE DATABASE owncloud_immie;
GRANT ALL PRIVILEGES ON owncloud_immie.* TO owncloud_immie@localhost IDENTIFIED BY '********************';
quit

Of course, replace ******************** with your own password.

Proceed to the URL https://owncloud.immie.org/owncloud:

  • Enter a new admin account user name and password.
  • Click on Storage & database
  • Keep data folder as is (/var/www/owncloud/data). Make sure it is outside web server root.
  • Select MySQL / MariaDB.
  • Enter MySQL user name, password, database name. Keep localhost for the DB server name.
  • Click Finish setup.

Hardening

See Linux Security.

Contacts App

Contacts is an application that must be installed via the admin account.

Sync with Thunderbird

To synchronize with Thunderbird, you first need to get the DAV URL on Owncloud:

  • Open your Owncloud account, and go to Contacts application.
  • In the bottom left corner, click Settings
  • Then click on the chain link icon labelled show URL, and copy the URL.
The URL is something like https://owncloud.immie.org/owncloud/remote.php/dav/addressbooks/users/xyz/default/.

Then, in Thunderbird, click on Address Book to show up the address book window.

  • Click on File → New → Remote Address Book.
  • Enter a name.
  • Enter URL copied above.
  • Select other options as desired (for instance sync period).

Sync with Android

I use the (non-free) application DAVDroid.

To ease setup of the DAVDroid account with Owncloud [1], I configure the well-known URL in Apache. This require that the server responds to addresses

To setup these addresses, add to /etc/apache2/sites-available/owncloud.immie.org.conf:

Redirect 301 /.well-known/carddav /owncloud/remote.php/dav
Redirect 301 /.well-known/caldav /owncloud/remote.php/dav

Now, in DAVDroid, setup the account with:

Sync with Outlook

Use Outlook CalDav Synchronizer to synchronize Outlook contacts with Owncloud.

  • In Outlook, go to People pane, and create a new contact folder, for instance named Owncloud.
  • Open menu CalDav Synchronizer → Synchronization profiles.
  • Click Add new profile. For Owncloud, we enter the following settings: