Raising a simple DAV server on Linux
In use, I got quite a few devices - three laptops alone, and also a computer at work and a smartphone. At some point, I realized that it’s inconvenient to store the address book like this in the scatter, and I would also like to keep the calendar somehow uniform. It is very inconvenient to synchronize such a number of devices with each other. This is where the time has come to figure out how to get out of this. I decided to look towards caldav and carddav servers.
I had the simplest requirements for them - taking records from either LDAP or IMAP and the presence of a web interface for viewing the calendar and address book.
Three such implementations came under consideration:
1. Baikal - did not fit. I did not like the fact that it was necessary to maintain a separate database of accounts.
2. Radicale is a good thing, but it was not possible to fasten the webmord to it, although the site says that CalDavZap works with it. Maybe I didn’t really try ... Yes, and somehow I didn’t like the documentation for it. Also did not fit.
3. Davical - But this one has earned. What exactly the way I wanted. Therefore, we consider its installation and configuration:
Installation and Davical setup
as a server distro used Ubuntu ServerPack 12.04
Set the required set of packages:
# the apt-the get the install the install the postgresql apache2 php5 php5-pgsqll davical php5-curl php5-imap
After installation you need to make a small adjustment postrgesql. Open /etc/postgresql/9.1/main/pg_hba.conf
Commenting the line
local all postgres peer
And add two other
local davical davical_app trust
local davical davical_dba trust
Then restart postgresql
# service postgresql restart
Next you need to run a script that will create the necessary database
# su postgres -c / usr / share / davical / dba / create- database.sh
The output would be something like this:
Supported locales updated.
Updated view: dav_principal.sql applied.
CalDAV functions updated.
RRULE functions updated.
Database permissions updated.
NOTE
====
* You will need to edit the PostgreSQL pg_hba.conf to allow the
'davical_dba' database user access to the 'davical' database.
* You will need to edit the PostgreSQL pg_hba.conf to allow the
'davical_app' database user access to the 'davical' database.
* The password for the 'admin' user has been set to 'co / e9Ap3'
Thanks for trying DAViCal! Check in / usr / share / doc / davical / examples / for
some configuration examples. For help, visit #davical on irc.oftc.net.
We look at it carefully. There will be admin login and password in the davical web interface.
Create the configuration file /etc/davical/config.php
$ c-> authenticate_hook ['call'] = 'IMAP_PAM_check';
$ c-> authenticate_hook ['config'] = array (
'imap_url' => '{davical.local: 993 / imap / tls / novalidate-cert}',
);
$ c-> domain_name = 'davical.local';
$ c-> sysaddr = 'davical';
$ c-> system_name = 'DAViCal CalDAV Server';
$ c-> admin_email = 'admin@davical.local';
$ c-> pg_connect [] = 'dbname = davical user = davical_app';
$ c-> default_locale = "uk_UA";
$ c-> use_old_sync_response_tag = true;
?>
Notice the imap_url line . Judging by their davical.dhits.nl wiki , there are several possible options:
{localhost: 143 / imap /}
{localhost: 143 / imap / tls /}
{example.com:993/imap/ssl/}
{example.com: 143 / imap / tls / novalidate-cert}
So - all this works (at least for me) only if at the end of the line DO NOT put “/”.
In general, everyone writes this line with the parameters with which he needs.
The server itself is already configured, but so far nothing is working for us. We make web interfaces.
CalDavZap - installation and configuration.
Download the archive program from the page http://www.inf-it.com/open-source/clients/caldavzap/
and unpack it in / var / www
Open a configuration file and the right line in it globalNetworkCheckSettings
var globalNetworkCheckSettings = {href: 'http: //davical.local/caldav.php/', hrefLabel: null, additionalResources: [], forceReadOnly: null, showHeader: true, settingsAccount: true, timeOut: 30000, lockTimeOut: 10000, delegation: false, backgroundCalendars: [], ignoreAlarms: false}
Now we need to configure authorization in CalDavZap.
To do this, make the following settings:
In the file auth / config.inc in two places in the field href you need to register the name of our server. What does the rest of the way do not touch. That is, we should get such lines:
'href' => 'http: //davical.local/caldav.php/'.$_SERVER [' PHP_AUTH_USER '].' / ',
' Href '=>' http: / /davical.local/caldav.php/resource/ ',
auth / plugins / generic_conf.inc change the value in one line
$ pluginconfig ['base_url'] = 'http: //davical.local;
Configuring Apache The
last step is to configure the web server.
Create the file / etc / apache2 / sites-available / davical and write to it
DocumentRoot / usr / share / davical / htdocs
DirectoryIndex index.html index.php
ServerName davical.local
Alias / images / / usr / share / davical / htdocs / images /
Alias / cal / var / www / caldavzap /
AllowOverride None
Order allow, deny
Allow from all
php_value the include_path / usr / this content share / awl / inc
php_value magic_quotes_gpc is 0
php_value register_globals 0
php_value the error_reporting «E_ALL & ~ E_NOTICE"
php_value default_charset «utf-8"
Create a link to the file in / etc / apache2 / sites-enabled
/ and restart Apache
now two
davical.local web interfaces have become available to us - the web interface of Davical itself, where you can either make system-wide settings if you have admin rights, or create additional calendars or address books for yourself if you are a regular user.
I recommend that you immediately go here as admin and change the password that we remembered at the very beginning when installing Davical
davical.local / cal- the web interface of our calendar
Lastly, two useful links for connecting resources to external clients, for example, Evolution or Outlook
davical.local / caldav.php / USERNAME / addresses - connecting the address book
davical.local / caldav.php / USERNAME / calendar - connecting a calendar.
Do not forget to replace the domain name and USERNAME with real ones in these links
I had the simplest requirements for them - taking records from either LDAP or IMAP and the presence of a web interface for viewing the calendar and address book.
Three such implementations came under consideration:
1. Baikal - did not fit. I did not like the fact that it was necessary to maintain a separate database of accounts.
2. Radicale is a good thing, but it was not possible to fasten the webmord to it, although the site says that CalDavZap works with it. Maybe I didn’t really try ... Yes, and somehow I didn’t like the documentation for it. Also did not fit.
3. Davical - But this one has earned. What exactly the way I wanted. Therefore, we consider its installation and configuration:
Installation and Davical setup
as a server distro used Ubuntu ServerPack 12.04
Set the required set of packages:
# the apt-the get the install the install the postgresql apache2 php5 php5-pgsqll davical php5-curl php5-imap
After installation you need to make a small adjustment postrgesql. Open /etc/postgresql/9.1/main/pg_hba.conf
Commenting the line
local all postgres peer
And add two other
local davical davical_app trust
local davical davical_dba trust
Then restart postgresql
# service postgresql restart
Next you need to run a script that will create the necessary database
# su postgres -c / usr / share / davical / dba / create- database.sh
The output would be something like this:
Supported locales updated.
Updated view: dav_principal.sql applied.
CalDAV functions updated.
RRULE functions updated.
Database permissions updated.
NOTE
====
* You will need to edit the PostgreSQL pg_hba.conf to allow the
'davical_dba' database user access to the 'davical' database.
* You will need to edit the PostgreSQL pg_hba.conf to allow the
'davical_app' database user access to the 'davical' database.
* The password for the 'admin' user has been set to 'co / e9Ap3'
Thanks for trying DAViCal! Check in / usr / share / doc / davical / examples / for
some configuration examples. For help, visit #davical on irc.oftc.net.
We look at it carefully. There will be admin login and password in the davical web interface.
Create the configuration file /etc/davical/config.php
$ c-> authenticate_hook ['call'] = 'IMAP_PAM_check';
$ c-> authenticate_hook ['config'] = array (
'imap_url' => '{davical.local: 993 / imap / tls / novalidate-cert}',
);
$ c-> domain_name = 'davical.local';
$ c-> sysaddr = 'davical';
$ c-> system_name = 'DAViCal CalDAV Server';
$ c-> admin_email = 'admin@davical.local';
$ c-> pg_connect [] = 'dbname = davical user = davical_app';
$ c-> default_locale = "uk_UA";
$ c-> use_old_sync_response_tag = true;
?>
Notice the imap_url line . Judging by their davical.dhits.nl wiki , there are several possible options:
{localhost: 143 / imap /}
{localhost: 143 / imap / tls /}
{example.com:993/imap/ssl/}
{example.com: 143 / imap / tls / novalidate-cert}
So - all this works (at least for me) only if at the end of the line DO NOT put “/”.
In general, everyone writes this line with the parameters with which he needs.
The server itself is already configured, but so far nothing is working for us. We make web interfaces.
CalDavZap - installation and configuration.
Download the archive program from the page http://www.inf-it.com/open-source/clients/caldavzap/
and unpack it in / var / www
Open a configuration file and the right line in it globalNetworkCheckSettings
var globalNetworkCheckSettings = {href: 'http: //davical.local/caldav.php/', hrefLabel: null, additionalResources: [], forceReadOnly: null, showHeader: true, settingsAccount: true, timeOut: 30000, lockTimeOut: 10000, delegation: false, backgroundCalendars: [], ignoreAlarms: false}
Now we need to configure authorization in CalDavZap.
To do this, make the following settings:
In the file auth / config.inc in two places in the field href you need to register the name of our server. What does the rest of the way do not touch. That is, we should get such lines:
'href' => 'http: //davical.local/caldav.php/'.$_SERVER [' PHP_AUTH_USER '].' / ',
' Href '=>' http: / /davical.local/caldav.php/resource/ ',
auth / plugins / generic_conf.inc change the value in one line
$ pluginconfig ['base_url'] = 'http: //davical.local;
Configuring Apache The
last step is to configure the web server.
Create the file / etc / apache2 / sites-available / davical and write to it
DocumentRoot / usr / share / davical / htdocs
DirectoryIndex index.html index.php
ServerName davical.local
Alias / images / / usr / share / davical / htdocs / images /
Alias / cal / var / www / caldavzap /
AllowOverride None
Order allow, deny
Allow from all
php_value the include_path / usr / this content share / awl / inc
php_value magic_quotes_gpc is 0
php_value register_globals 0
php_value the error_reporting «E_ALL & ~ E_NOTICE"
php_value default_charset «utf-8"
Create a link to the file in / etc / apache2 / sites-enabled
/ and restart Apache
now two
davical.local web interfaces have become available to us - the web interface of Davical itself, where you can either make system-wide settings if you have admin rights, or create additional calendars or address books for yourself if you are a regular user.
I recommend that you immediately go here as admin and change the password that we remembered at the very beginning when installing Davical
davical.local / cal- the web interface of our calendar
Lastly, two useful links for connecting resources to external clients, for example, Evolution or Outlook
davical.local / caldav.php / USERNAME / addresses - connecting the address book
davical.local / caldav.php / USERNAME / calendar - connecting a calendar.
Do not forget to replace the domain name and USERNAME with real ones in these links