Don't warn on slow queries since this is a batch process.
[davical.git] / docs / website / installation.php
blob353d672e9a491afb78c5c937918adc5879ec05f0
1 <?php
2 $title = "Installation";
3 include("inc/page-header.php");
4 ?>
5 <h1>Before Starting</h1>
7 <h2>Debian Users</h2>
8 <p>Ideally you will be running a recent Debian (or Ubuntu) release and will
9 be able to add:</p>
10 <pre>
11 deb http://debian.mcmillan.net.nz/debian lenny awm
12 </pre>
13 <p>to your <code>/etc/apt/sources.list</code>. Once you have done that you
14 can use <code>apt-get</code> or <code>synaptic</code> or some other equivalent package
15 manager to fetch and install <code>DAViCal</code> and all the dependencies.</p>
17 <p>This repository is signed by Andrew McMillan's public key, which you can install so that
18 you don't get asked for confirmation all the time:</p>
20 <pre>
21 sudo apt-key advanced --keyserver pgp.net.nz --recv-keys F6E0FA5CF0307507BB23A512EAFCFEBF8FEB8EBF
22 </pre>
24 <p>Skip to the "Database Setup" part if you have done that already.</p>
27 <h2>Other Linux Users</h2>
28 <p>Please write something up about your experiences in the Wiki, adding distribution specific
29 notes to pages somewhere under here:
30 <a href="http://wiki.davical.org/w/Installation_Stuff">http://wiki.davical.org/w/Installation_Stuff</a></p>
32 <h3>RPM Packages of DAViCal</h3>
33 <p>We have created RPM packages of DAViCal and libawl-php from the .deb packages
34 using "alien". These are reported to work fine, so use them and then proceed to the
35 Pre-requisites section below. If you would like to work with us to create native
36 RPM packages please get in touch!</p>
38 <h3>SuSE Linux</h3>
39 <p>On SuSE Linux you may need to look in /var/lib/pgsql/data/ for the pg_hba.conf file.</p>
41 <h3>Gentoo</h3>
42 <p>Davical and the awl library ebuilds are available on the <a href="http://www.gentoo.org/proj/en/sunrise/">sunrise overlay</a>.
43 You'll have to add this overlay to your system:</p>
44 <pre>
45 emerge layman
46 layman -f -a sunrise
47 echo "source /usr/portage/local/layman/make.conf" &gt;&gt; /etc/make.conf
48 </pre>
50 <p>From there, you can keep the overlay in sync with the command:</p>
51 <pre>layman -s sunrise</pre>
53 <p>Davical can now be installed with a normal:</p>
54 <pre>emerge davical</pre>
56 <h3>Slackware, BSD and the rest</h3>
58 <p>You will need to download the latest versions of the <code>DAViCal</code> and <code>awl</code> packages
59 from the <a href="http://sourceforge.net/projects/davical/files/">sourceforge download page for DAViCal</a>.</p>
60 <p>You will need to untar these. Preferably you will untar them from within the "<code>/usr/share</code>" directory and everything
61 will be in it's expected location (well, except the docs, but it will at least be tidy and everything will be in one place).</p>
63 <p>We would like to hear from non-Debian users regarding things which might have been missed, or things you have
64 learned about the system, so please write about your installation experiences on the Wiki, or post a message
65 in the Sourceforge forums.</p>
67 <h2>Non-Linux Users</h2>
68 <p>We would really like to hear from you. As far as we can see there is no reason why this
69 can't all work on FreeBSD, Microsoft Windows, VMS, Mac OS or whatever else, as long as the
70 pre-requisites are able to be installed.</p>
71 <p>For Unix and unix-like operating systems the "Other Linux Users" instructions are likely
72 to be reasonably close to what you need. For other systems everything will need some
73 adjustment, and in particular some of the path name and shell expectations coded into
74 the database creation scripts are likely to need love.</p>
75 <p>We're available to answer questions, anyway :-)</p>
77 <h1>Pre-requisites</h1>
79 <p>DAViCal depends on a number of things. Firstly, it depends
80 on Andrew's Web Libraries (AWL) which is a set of useful
81 PHP functions and objects written by Andrew McMillan over
82 a number of years.</p>
84 <p>The following other software is also needed:</p>
85 <ul>
86 <li>A webserver which can run PHP (however most of this documentation assumes Apache 2.2 or later)</li>
87 <li>PHP: 5.1 or greater</li>
88 <li>PostgreSQL: 8.1 or greater</li>
89 </ul>
91 <p>The PostgreSQL database may be installed on a server other
92 than the web server, and that kind of situation is recommended
93 if you want to increase the security or scalability of your
94 installation.</p>
96 <p>Since the CalDAV store takes over a significant amount of path
97 hierarchy, it can be easier in it's own virtual
98 host. If you want it to operate within the web root of some
99 other application there are instructions on the Wiki about doing this,
100 as well as other fancy tricks such as configuring URL rewriting in
101 order to shorten the path.</p>
104 <h1>Database Setup</h1>
106 <h2>Connecting to the Database</h2>
108 <p>Before your database has been created, you should edit your pg_hba.conf
109 file (in /etc/postgresql/8.x/main/pg_hba.conf on Debian or derivatives) in
110 order to grant access to the database for the 'davical_dba' user that will
111 be created to 'own' the database and tables, and also for the 'davical_app'
112 user which will be created for the web application fo connect as.</p>
114 <p>In a simple installation, where you do not have untrusted
115 users on your database server, and your database is on the same
116 computer as the web server, the following lines (at the very <em>top</em>
117 of the pg_hba.conf file) should be enough:</p>
119 <pre>
120 local davical davical_app trust
121 local davical davical_dba trust
122 </pre>
124 <p>This means that anyone on the local computer (including the
125 web application) will have rights to connect to the DAViCal
126 database as the 'davical_app' or 'davical_dba' user. It will not allow remote access,
127 or access as any user other than 'davical_app' or 'davical_dba'.</p>
129 <p>If you want to connect to the database over TCP/IP from your webserver
130 on '192.168.59.231' (e.g. rather than unix sockets which will only work for
131 access from the local machine), the lines in the pg_hba.conf file should look
132 something like:</p>
134 <pre>
135 host davical davical_app 192.168.59.231/32 trust
136 host davical davical_dba 192.168.59.231/32 trust
137 </pre>
139 <p>If you want greater security, or if you want to have the
140 database on a different server, you should read the
141 <a href="http://www.postgresql.org/docs/8.4/interactive/client-authentication.html">PostgreSQL documentation on pg_hba.conf</a>
142 for the version you are using.</p>
144 <p>Once you have changed the pg_hba.conf file you will need to
145 reload or restart the PostgreSQL process for the change to come
146 into effect.</p>
148 <h2>Creating and Building the Database</h2>
150 <p>To create the database itself, run the script:</p>
151 <pre>
152 dba/create-database.sh
153 </pre>
154 <p>Note that this script calls the AWL database scripts as part
155 of itself and it expects them to be located in /usr/share/awl/dba
156 which might be a reasonable place, but it might not be where you
157 have put them.</p>
159 <p>This script expects to be running as a user who has rights to create a new database, so you
160 may need to do this as the "postgres" user, for example:</p>
161 <pre>
162 su postgres -c /usr/share/davical/dba/create-database.sh
163 </pre>
165 <h1>Apache Configuration</h1>
166 <h2>Relative to an existing DocumentRoot</h2>
168 <p>You can create a symlink from an existing web root directory to the
169 /usr/share/davical/htdocs directory, such as:</p>
171 <pre>
172 cd /my/apache/docroot
173 ln -s /usr/share/davical/htdocs davical
174 </pre>
176 You will need to change your global PHP configuration to include the
177 directory '/usr/share/awl/inc' in the 'include_path' setting, along with
178 any other directories already needed by other applications.
180 You will also need to ensure that 'magic_quotes_gpc' is off.
182 <h2>Using a Virtual Host</h2>
184 <p>Your Apache instance needs to be configured for Virtual Hosts. If
185 this is not already the case you may want to read some documentation
186 about that, and you most likely will want to ensure that any existing
187 site becomes the **default** virtual host, with DAViCal only being a
188 single virtual host.</p>
190 <p>I use a Virtual Host stanza like this:</p>
191 <pre>
192 # Virtual Host def for Debian packaged DAViCal
193 &lt;VirtualHost 123.4.56.78 &gt;
194 DocumentRoot /usr/share/davical/htdocs
195 DirectoryIndex index.php index.html
196 ServerName davical.example.net
197 ServerAlias calendar.example.net
198 Alias /images/ /usr/share/davical/htdocs/images/
199 &lt;Directory /usr/share/davical/htdocs/&gt;
200 AllowOverride None
201 Order allow,deny
202 Allow from all
203 &lt;/Directory&gt;
204 AcceptPathInfo On
206 # You probably don't need to enable any of these sorts of things other than in exceptional
207 # circumstances. Apart from the include path (which DAViCal will discover if it is anywhere
208 # 'normal') they are the default in newer PHP versions.
210 # php_value include_path /usr/share/awl/inc
211 # php_value magic_quotes_gpc 0
212 # php_value register_globals 0
213 # php_value error_reporting "E_ALL &amp; ~E_NOTICE"
214 # php_value default_charset "utf-8"
215 &lt;/VirtualHost&gt;
216 </pre>
218 <p>Replace 123.4.56.78 with your own IP address, of course (you can
219 use a name, but your webserver may fail on restart if DNS happens
220 to be borked at that time).</p>
222 <p>The various paths and names need to be changed to reflect your
223 own installation, although those are the recommended locations
224 for the various pieces of the code (and are standard if you
225 installed from a package.</p>
227 <p>Once your VHost is installed an working correctly, you should be
228 able to browse to that address and see a page telling you that
229 you need to configure DAViCal.</p>
231 <p>On Debian systems (or derivatives such as Ubuntu), when you are
232 using Apache 2, you should put this definition in the /etc/apache2/sites-available
233 directory and you can use the 'a2ensite' command to enable it.</p>
236 <h1>DAViCal Configuration</h1>
238 <p>The DAViCal configuration generally resides in /etc/davical/&lt;domain&gt;-conf.php
239 and is a regular PHP file which sets (or overrides) some specific variables.</p>
241 <pre>
242 &lt;?php
243 // $c-&gt;domain_name = "calendar.example.net";
244 // $c-&gt;sysabbr = 'DAViCal';
245 // $c-&gt;admin_email = 'admin@example.net';
246 // $c-&gt;system_name = "Example DAViCal Server";
247 // $c-&gt;enable_row_linking = true;
249 $c-&gt;pg_connect[] = 'dbname=davical port=5432 user=davical_app';
251 </pre>
253 <p>See the wiki for the full list of <a href="http://wiki.davical.org/w/Configuration_settings">DAViCal configuration settings</a>.</p>
255 <p>Multiple values may be specified for the PostgreSQL connect string,
256 so that you can (e.g.) use PGPool to cache the database connection
257 but fall back to a raw database connection if it is not running.</p>
259 <p>You should set the 'domain_name' and 'admin_email' as they are used
260 within the system for constructing URLs, and for notifying some
261 kinds of events.</p>
263 <p>If you are in a non-English locale, you can set the default_locale
264 configuration to one of the supported locales.</p>
266 <h1>Supported Locales</h1>
267 <p>At present the following locales are supported:</p>
268 <ul>
269 <li>English</li>
270 <li>German / Deutsch</li>
271 <li>Spanish / Español</li>
272 <li>French / Français</li>
273 <li>Russian / Русский</li>
274 <li>Netherlands / Nederlands</li>
275 <li>Polish / Polski</li>
276 <li>Hungarian / Magyar</li>
277 <li>Japanese / 日本語</li>
278 <li>Italian / Italiano</li>
279 <li>Swedish / Svenska</li>
281 </ul>
283 <p>If you want locale support you probably know more about configuring it than me, but
284 at this stage it should be noted that all translations are UTF-8, and pages are
285 served as UTF-8, so you will need to ensure that the UTF-8 versions of these locales
286 are supported on your system.</p>
289 <h1>Completed?</h1>
291 <p>If all is going well you should now be able to browse to the admin
292 pages and log in as 'admin' (the password is the bit after the '**'
293 in the 'password' field of the 'usr' table so:</p>
294 <pre>
295 psql davical -c 'select username, password from usr;'
296 </pre>
298 <p>should show you a list. Note that once you change a password it
299 won't be readable in this way - only the initial configuration
300 leaves passwords readable like this for security reasons.</p>
302 <p>Check the '/setup.php' page in your installation and if everything
303 is working then you should be ready to configure a client
304 to use your new DAViCal installation, and the docs for that are elsewhere.</p>
306 <p>If you had to do something else that is not covered here, or if you have any other notes
307 you want to add to help others through the installation process, please write something up
308 about your experiences in the Wiki, including distribution specific notes, to pages somewhere under here:
309 <a href="http://wiki.davical.org/w/Installation_Stuff">http://wiki.davical.org/w/Installation_Stuff</a></p>
312 <h1>Upgrades</h1>
314 <p>Whenever you upgrade the DAViCal application to a new version you will need to
315 run dba/update-davical-database which will apply any pending database patches, as well as
316 enabling new translations, loading database views and functions, and setting application
317 permissions to database tables.</p>
319 <p>When the database is created all the tables are owned by a 'davical_dba' user which
320 you will also want to add access for in your pg_hba.conf, although in that case you
321 may want to set the user to have a password, since it has full control over the DAViCal
322 database structure and content.</p>
324 <p>See <a href="http://wiki.davical.org/w/Update-davical-database">http://wiki.davical.org/w/Update-davical-database</a> for more information.</p>
326 <?php
327 include("inc/page-footer.php");