Installation Experiences/Feb 2008: Ubuntu 6.10

Updated Installation Guide
There is a lot of information on the installation but I found doing a clean install of the latest 0.9.4 that some minor but crucial points had been changed or omitted. So here's my guide to doing a clean install.

My Build Environment

 * Ubuntu 6.10 Edgy Server
 * Apache2 (LAMP Installation of Ubuntu so default installed)
 * DAViCal 0.9.4
 * PHP5
 * PostgreSQL 8.1

Getting DAViCal
Getting DAViCal for Ubuntu should be easy as you can get and install it using "apt-get". But there where some hitches.


 * 1) You need to add "deb http://debian.mcmillan.net.nz/debian unstable awm" to your "/etc/apt/source.list". (As documented in the main installation guide)
 * 2) You need to edit your "/etc/apt/source.list" to include "edgy universe" as DAViCal depends on "libclass-dbi-pg-perl" and this is not included in "edgy main". (note: Ubuntu 7.10 does not seem to have this missing dependency)

Once these 2 things are done "apt-get install rscds" will run fine.

Other Packages
PHP5 and PostgreSQL install work fine "out of the box" with apt-get, but make sure to install PostgreSQL client as well as server.

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;

>sudo su >su postgres -c "createuser davical_app"

You will get asked about superusers, roles and databases, but "just say NO" to all questions, this functional ID needs only minimum rights. Repeat the process to create one more user, "davical_dba".

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 ". (note: I followed this exact procedure, but when running the create-database.sh below the missing general user does give errors (for example, line 73). Don't know how serious?)

Once these 2 functional IDs are created go to "/etc/postgresql/8.1/main/" 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 near or at the top;

local all all trust local davical davical_dba trust local davical davical_app trust

Then restart your postgreSQL server by;

>/etc/init.d/postgresql-8.1 restart

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

>su postgres -c /usr/share/rscds/dba/create-database.sh (previously I had ">su postgres -c /usr/share/davical/dba/create-database.sh" but that was a mistake due to me doing a cut'n'paste from an older document. Someone was kind enough to point that out in an edit.)

Please note that 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;

psql: FATAL: Ident authentication failed for user "davical_dba"

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

CREATE DATABASE new_db_revision - t (1 row) new_db_revision - t (1 row) Supported locales updated. CalDAV functions updated. DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist DBD::Pg::db do failed: ERROR: role "general" does not exist Database permissions updated. setval 10 (1 row) setval 1000 (1 row) setval 10 (1 row) The password for the 'admin' user has been set to '*********'

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.

You'll also notice a lot of 'role "general" does not exist' errors. These can be safely ignored.

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

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.)

If you want to test that your database creation was successful,

>sudo su >su postgres >psql davical davical=# \z

You should see about 30 tables all with some sort of access permission to "davical_dba". (Type "\q" to exit pqsl)

Apache Configuration
The DAViCal main site describes how to setup a virtual host but I was lazy and used the follow approach described in the Wiki "Installation Guide Update".

Go to /etc/apache2/sites-available/default and add the following line;

Alias /cal/ /usr/share/rscds/htdocs/

Once added restart your apache daemon by;

>/etc/init.d/apache2 restart

DAViCal Configuration
Next step is to actually configure DAViCal. Go to "/etc/davical/". Currently it should be an empty directory. Create a configuration file with the naming convention XXXX-conf.php, where "XXXX" is the hostname of the server running DAViCal. When you actually start using DAViCal, the URL you browse too should be "http://xxxx/cal/". 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;

admin_email = 'admin@example.net'; $c->system_name = "DAViCal CalDAV Server"; $c->pg_connect[] = 'dbname=davical port=5432 user=davical_app';


 * 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.
 * In the DAViCal main site installation page, the conf file has 2 entries for ports (the last line in the conf file), these is not necessary in a standard installation and you need only configure port 5432.
 * Apparently only the last line for the DB connection is important, the other lines are optional and can/are commented out with a double slash.

Creating a symbolic link to localhost-conf.php helps when you want to test or administer the installation from the server locally.

cd /etc/rscds/ ln -s XXXX-conf.php localhost-conf.php

AWL inclusion
If you have set up your Apache with a virtual host for DAViCal, then it seems the AWL stuff will be configured in the virtual host setup (see http://rscds.sourceforge.net/installation.php for details).

Since I just created a sub folder for DAViCal using an alias I once again turned to the solution offered by the Installation Guide Update

cd /usr/share/rscds/inc ln -s /usr/share/awl/inc/*.

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;

>sudo su >su postgres >psql davical -c 'select username, password from usr;'

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.

Still having problems
Like me you may still be having problems after following the instructions above. Therefore I decided to create this section for gottcha's and misc problems after installation:

1) If you find that your calendar program can't read the returned .ics file from davical check the end of the configuration file in /etc/davical or /etc/rscds. Make sure there is no newline after the php end tag (?>) at the end of the file (thanks to karora for sorting this one out for me).