Friday, May 25, 2012

DAViCal Installation on Ubuntu Server (12.04 LTS)


Step1:
Installed Ubuntu Server and update it to latest
added to source list
vim /etc/apt/sources.list
deb http://debian.mcmillan.net.nz/debian lenny awm
then added the key
apt-key advanced --keyserver pgp.net.nz --recv-keys F6E0FA5CF0307507BB23A512EAFCFEBF8FEB8EBF
apt-get install update
apt-get install apache2
apt-get install davical

Configuring Database (Postgresql)

now added the Postgresql sersver to connect the machines
vim /etc/postgresql/9.1/main/pg_hba.conf

Connecting to the Database
Before your database has been created, you should edit your pg_hba.conf file (in /etc/postgresql/8.x/main/pg_hba.conf on Debian or derivatives) in order to grant access to the database for the 'davical_dba' user that will be created to 'own' the database and tables, and also for the 'davical_app' user which will be created for the web application fo connect as.

In a simple installation, where you do not have untrusted users on your database server, and your database is on the same computer as the web server, the following lines (at the very top of the pg_hba.conf file) should be enough:

local   davical    davical_app   trust
local   davical    davical_dba   trust
This means that anyone on the local computer (including the web application) will have rights to connect to the DAViCal database as the 'davical_app' or 'davical_dba' user. It will not allow remote access, or access as any user other than 'davical_app' or 'davical_dba'.

If you want to connect to the database over TCP/IP from your webserver on '192.168.59.231' (e.g. rather than unix sockets which will only work for access from the local machine), the lines in the pg_hba.conf file should look something like:

host davical davical_app 192.168.59.231/32 trust
host davical davical_dba 192.168.59.231/32 trust

Creating and Building the Database
To create the database itself, run the script:

This script expects to be running as a user who has rights to create a new database, so you may need to do this as the "postgres" user, for example:

su postgres -c /usr/share/davical/dba/create-database.sh

#####
su postgres -c /usr/share/davical/dba/create-database.sh
could not change directory to "/root"
could not change directory to "/root"
could not change directory to "/root"
could not change directory to "/root"
could not change directory to "/root"
could not change directory to "/root"
could not change directory to "/root"

could not change directory to "/root"

Supported locales updated.
Updated view: dav_principal.sql applied.
CalDAV functions updated.
RRULE functions updated.
Database permissions updated.
could not change directory to "/root"
could not change directory to "/root"
NOTE
====
*  The password for the 'admin' user has been set to 'ioMLrYKQ'
#########


Now configuring Apache:

cd /etc/apache2/sites-available/
make copy of default website
cp default mydavicalsite

vim mydavicalsite
<VirtualHost 192.168.1.195:80 >
  DocumentRoot /usr/share/davical/htdocs
  DirectoryIndex index.php index.html
  ServerName madrid.hcitec.com
  Alias /images/ /usr/share/davical/htdocs/images/
  <Directory /usr/share/davical/htdocs/>
      AllowOverride None
      Order allow,deny
      Allow from all
  </Directory>
  AcceptPathInfo On
  php_value include_path /usr/share/awl/inc
  php_value magic_quotes_gpc 0
  php_value register_globals 0
  php_value error_reporting "E_ALL & ~E_NOTICE"
  php_value default_charset "utf-8"
</VirtualHost>

sudo ln -s /etc/apache2/sites-available/mydavicalsite /etc/apache2/sites-enabled/mydavicalsite

/etc/init.d/apache2 restart

Recived error while restarting apache2
Invalid command 'php_value'
Then I did
sudo apt-get install libapache2-mod-php5

service apache2 restart
Now it give information about the product installation

DAViCal Configuration
The DAViCal configuration generally resides in /etc/davical/config.php and is a regular PHP file which sets (or overrides) some specific variables. if not then create this file and paste the below in the file

<?php
//  $c->domain_name  = 'davical.example.com';
//  $c->sysabbr     = 'davical';
//  $c->system_name = 'DAViCal CalDAV Server';

  $c->admin_email  = 'admin@example.com';
  $c->pg_connect[] = 'dbname=davical user=davical_app';
OR
<?php
  $c->admin_email = 'vaseemk@hcitec.com';
  $c->system_name = "DAViCal CalDAV Server";
  $c->enable_row_linking = true;
  $c->default_locale = 'en_US.UTF-8';

  $c->pg_connect[] = 'dbname=davical port=5432 user=davical_app';

Now you can get DAViCal running on your server
http://yourserver/
and log in

  Resources:
  http://www.davical.org/installation.php
  http://wiki.davical.org/w/Debian
  http://ubuntuguide.org/wiki/DAViCal_tips

No comments:

Post a Comment