Ubuntu/Hardy

From Davical
Jump to: navigation, search

The author of this page (see below) just managed to successfully install DAViCal 0.9.9 from Andrews Repository on a rented Virtual Server running Ubuntu Hardy Heron (8.04LTS) und Plesk. Since I found very few hints on the Web if this was possible and very nearly gave up, I decided to share the good news: YES, it is easy (if you know how), works great, and here are a few hopefully helpful notes to get you going quick on Hardy.

Note that web hosters (offering virtual, dedicated or managed Ubuntu servers) will often be running 8.04LTS because of the long-term-support and the lag-time for Plesk to support a new version plus the lag-time for the hosting provider to adopt the new version. I expect that soon they'll be offering 10.04LTS, but many of us will be (stuck) with 8.04.

Also note that most of the instructions on the net assume good unix admin behaviour, i.e. logging in as a non-privileged user and running privileged commands via "sudo". But habitual Plesk-Users at hosters will normally get login details for "root" from their hoster when renting the maschine and will use putty and log in directly as root, whenever Plesk does not suffice. Thus I have assumed a login as "root" below.

Installing Packages

  • for PostgreSQL 8.3
apt-get install postgresql
  • for DAViCal (latest version)
apt-key advanced --keyserver pgp.net.nz --recv-keys F6E0FA5CF0307507BB23A512EAFCFEBF8FEB8EBF
echo "deb http://debian.mcmillan.net.nz/debian lenny awm" | sudo tee /etc/apt/sources.list.d/davical.list
sudo apt-get update 
sudo apt-get install davical
Note: Port 11371 must be open in the firewall to allow the keyserver - I did not need to do anything.

Preparing PostgreSQL

Just follow the instructions on the Jaunty page or here: Corvent Documentation on DAViCal.

Preparing Apache

See also: Apache Config in this Wiki.

On a Plesk Host you'll almost certainly have Apache2 and PHP5 pre-installed. Note that while one must often be careful about where one makes manual modifications - which will not get clobbered when Plesk re-writes the files it manages itself - there is no problem here when following the instructions at other locations, which say you should add a virtual host to /etc/apache2/sites-available. Plesk adds its virtual hosts via config files beginning "zz" in the /etc/apache2/conf.d directory.

Note that /usr/share/davical/htdocs contains a static website in PHP5, which is the Online Admin Interface. The Apache-Server does not need write-access here - the writing of "Principals" and all their associated data goes to the PostGresSQL-DB. So just:

cd /etc/apache2/sites-available
cat >davical.conf
... (your vhost config)
Ctrl-D
chmod 644 davical.conf
a2ensite davical.conf // enables the new site
/etc/init.d/apache2 reload // restarts apache

That was pretty painless... except, how should the vhost config look like? Again I borrowed from the other excellent resources and put that together with how Plesk otherwise configures a vhost:

<VirtualHost 12.34.56.789:80>
  ServerName   davical.domain.tld:80
  ServerAdmin  "info@yourmail.tld"
  ErrorLog /var/log/apache2/davical_error.log
  LogLevel warn
  CustomLog /var/log/apache2/davical_access.log combined
  DocumentRoot /usr/share/davical/htdocs
  DirectoryIndex index.php index.html
  Alias /images/ /usr/share/davical/htdocs/images/
  <Directory /usr/share/davical/htdocs/>
    AllowOverride None
    Order allow,deny
    Allow from all
  </Directory>
  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>

Clients will need to supply an address like this:

http://davical.domain.tld/caldav.php/UserName/home

Tip:

http://davical.domain.tld/caldav.php/User-Name/home
currently does not work, at least not between Lightning and DAViCal - just don't use a dash.

I then moved on to get it going on SSL. Again I got discouraged, after reading about DAViCal over mod_proxy and then about reverse proxies, since the various mod_proxies are not loaded as standard on a Plesk system, and things looked like getting messy. Then searching the web for "davical ssl" showed me this article on DAViCal via SSL which suddenly made things really easy again. That article shows how to avoid the reverse proxying by only defining an SSL vhost, and includes the rewriting rules to permit simpler URIs in the clients:

<VirtualHost 12.34.56.789:443>
 ServerName  davical.domain.tld:443
 ServerAdmin "info@yourmail.tld"
 ErrorLog /var/log/apache2/davical_error.log
 LogLevel warn
 CustomLog /var/log/apache2/davical_access.log combined
 ServerSignature On
 DocumentRoot /usr/share/davical/htdocs
 DirectoryIndex index.php index.html
 Alias /images/ /usr/share/davical/htdocs/images/
 <Directory /usr/share/davical/htdocs/>
   AllowOverride None
   Order allow,deny
   Allow from all
   php_admin_flag engine on
 </Directory>
 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"
 <IfModule mod_rewrite.c>
   RewriteEngine On
   # Not if it's the root URL.  You might want to comment this out if you
   # want to use an explicit /index.php for getting to the admin pages.
   RewriteCond %{REQUEST_URI} !^/$
   # Not if it explicitly specifies a .php program, stylesheet or image
   RewriteCond %{REQUEST_URI} !\.(php|css|js|png|gif|jpg)
   # Everything else gets rewritten to /caldav.php/...
   RewriteRule ^(.*)$ /caldav.php$1  [NC,L]
 </IfModule>
 SSLEngine on
 SSLVerifyClient none
 SSLCertificateFile /opt/psa/var/certificates/cert-YOURS
 SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
</VirtualHost>

Now comes the nifty trick: Create the SSL version as a separate virtual host:

cd /etc/apache2/sites-available
cat >davical-ssl.conf
... (the vhost config above)
Ctrl-D
chmod 644 davical-ssl.conf
a2ensite davical-ssl.conf  // enables the new site
/etc/init.d/apache2 reload // restarts apache

Now, you have both SSL and Non-SSL ways to get to DAViCal, without any reverse proxy hassle. Clients will need to supply an address like this for the SSL connection:

https://davical.domain.tld/UserName/home

Hope this helps someone! --Tim Reeves 10:54, 26 July 2010 (UTC)