Caldav

From Gentoo Linux Wiki
Jump to: navigation, search
Please format this article according to the Style Guidelines and Wikification suggestions, then remove this notice {{Wikify}} from the article.

Reason(s): General layout issues (use headings, use pre / templates for code blocks)

From the official homepage of DAViCal:

DAViCal is a server for calendar sharing. It is an implementation of the CalDAV protocol which is designed for storing calendaring resources (in iCalendar format) on a remote shared server. An increasing number of calendar clients support the maintenance of shared remote calendars through CalDAV including Mozilla Calendar (Sunbird/Lightning), Evolution, Mulberry, Chandler, and various other closed-source products such as Apple's iCal and iPhone.

Contents

[edit] Installation

[edit] Prerequisites

  • Apache: 1.3.x or 2.x.x
  • PHP compiled with nls, xml, pcre, apache2 and postgres use flags.
  • PostgreSQL: 8.1 or greater
  • Sunrise Overlay

[edit] Install

At first, unmask the software in your package.keywords.

File: /etc/portage/package.keywords
...
dev-php/awl
www-apps/davical

Install from sunrise Overlay. Package is called "davical".

emerge davical


if emerge error ('ImportError: No module named WebappConfig.config')

python-updater
emerge webapp-config

[edit] Start Configurations

[edit] Database Stuff

Once all the package installations are done you start by making the DAViCal database in PostgreSQL. To this purpose you create 2 functional accounts in postgreSQL. Assuming you have root or sudo rights;

su postgres -c "createuser davical_app" su postgres -c "createuser davical_dba"

You will get asked about superusers, roles and databases, but "just say NO" to all questions, this functional ID needs only minimum rights.

Please note that in the main DAViCAL site installation page the user create at this step is "general". This account name is for older versions. DO NOT CREATE A USER NAMED "general."

Once these 2 functional IDs are created go to /var/lib/postgresql/"version"/data/ and open the file pg_hba.conf with an editor of choice. (You may want to back up the file before editing, just in case.) Add the following 3 lines to the file:

File: /var/lib/postgresql/"version"/data/pg_hba.conf
local all all trust  ###(Should already be there.)###
local davical davical_dba trust
local davical davical_app trust

Then restart your postgreSQL server

/etc/init.d/postgresql restart

Now you can run the script to create the DAViCal database. This is done as follows:

su postgres -c /usr/share/webapps/davical/0.9.6.3/sqlscripts/create-database.sh
Note: You must create the functional IDs then give them access rights in postgreSQL by editing the pg_hba.conf and restarting the database daemon before running the database creation script or you will get a very annoying error: Template:Error


If the script ran correctly you should see something like this:

Code:
CREATE DATABASE
Supported locales updated.
CalDAV functions updated.
RRULE functions updated.
Database permissions updated.
NOTE
====
*  The password for the 'admin' user has been set to '*********'"

Thanks for trying DAViCal!  Check in /usr/share/doc/davical/examples/ for
some configuration examples.  For help, visit #davical on irc.oftc.net.

At the end of the script, the script will create and tell you the admin password. (I've blanked out the password above with '*********') Make note of it here, though it can be retrieved later on if you misplace or forget it.

Once the creation script has run correctly, go back to the pg_hba.conf file and remove the line

Code: /var/lib/postgresql/"version"/data/pg_hba.conf
local all all trust

and restart the database daemon. (This step is not strictly necessary for the installation, but do you really want just anybody with a local account free access to all the databases? Thought not.)

[edit] Apache Configuration

Davical should have already been installed in /var/www/localhost if you haven't enabled the vhosts use. If vhosts was set, you have to install it in the chosen vhost using webapp-config.

 webapp-config -d davical -I davical <davical-version> 

Be sure apache is php aware and vhost aware, if you are going to use vhost.

File: /etc/conf.d/apache2
APACHE_OPTS=" ... -D PHP5 ... -D DEFAULT_VHOST ..."

The basic apache configuration is rather straightforward:

File: /etc/apache2/vhosts.d/00_default_vhost.conf
...
php_value include_path .:/usr/share/php5:/usr/share/php:/usr/share/php5/awl
Alias /mycalendar /var/www/localhost/htdocs/davical
...

Typically this line is put in the <VirtualHost *:80> stanza.

The administration pages should now be available at http://your_host/mycalendar

[edit] DAViCal Configuration

Next step is to actually configure DAViCal. Go to "/etc/davical/". The gentoo install creates a base template for the default site. Edit the configuration file; it should have the naming convention XXXX-conf.php, where "XXXX" is the hostname of the server running DAViCal. If you have a domain you will need to change this convention to XXXX.XXX-conf.php, where .XXX is the TLD for your site. When you actually start using DAViCal, the URL you browse too should be "http://xxxx.xxx/davical/htdocs/". Make sure the server name you will be using in the URL match name of the configuration file.

The content of the configuration file should be as follows;

File: /etc/davical/XXXX-conf.php
<?php
$c->pg_connect[] = 'dbname=davical host=localhost user=davical_app';
$c->system_name = "Really Simple CalDAV Store";
$c->admin_email = 'admin@example.net';
//$c->default_locale = "en_NZ";
$c->domain_name = "calendar.example.net";
$c->enable_row_linking = true;

//  $c->sysabbr     = 'rscds';
//  $c->collections_always_exist = true;

?>
* The "domain_name" should be same XXXX string as the beginning of the file name.
* Note that the functional user "davical_app" is used here.
* Only the last line for the DB connection is important, the other lines are optional and can be commented out with a double slash.

[edit] Using DAViCal

At this point all configuration is completed, and DAViCal should be ready to use.

  1. In a browser go to "http://xxxx/cal/".
  2. You will find a login screen.
  3. Enter "admin" for username.
  4. Enter the password obtained after running the database creation script. 

Congratulations! You should now find yourself in the administration screen, with the ability to create new users. If you forgot the Admin Password

If at this point you are saying, "d*mn, where is that admin password I wrote down...", no sweat. Do the following;

su postgres psql davical -c 'select username, password from usr;'
Note: Only the initial "admin" password is stored in plain text. All subsequent users have their password stored in an encrypted state. If you change the admin password through the web interface it will also be encrypted from that point forward.

[edit] Fixing PostgreSQL connection problem

When connecting to PostgreSQL from Apache via UNIX socket, Apache has to be in postgres group.

Symptoms:

Code: /var/log/apache2/error.log
PHP Fatal error:  PDO connection error 'pgsql:dbname=davical':
SQLSTATE[08006] [7] could not connect to server: Permission denied
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.XXXX"?

Solution:

gpasswd -a apache postgres
Personal tools