2 <!-- ============= Installation ============================== -->
4 <chapter id="sec_install">
5 <title>Installation</title>
8 &appname; is a quite complex piece of software, we thus recommend
9 you to either install al precompiled version or use the LiveCD.
10 If you are running Debian GNU/Linux (or one of its derivatives
11 like Ubuntu), you can install matita typing
12 <programlisting><![CDATA[ aptitude install matita matita-standard-library ]]></programlisting>
13 If you are running MacOSX or Windows, give the LiveCD a try before
14 trying to compile &appname; from its sources.
17 <sect1 id="inst_livecd">
18 <title>Using the LiveCD</title>
21 In the following, we will assume you have installed
22 <ulink type="http" url="http://www.virtualbox.org">virtualbox</ulink>
23 for your platform and downloaded the .iso image of the LiveCD
26 <sect2 id="make_vmachine">
27 <title>Creating the virtual machine</title>
29 Click on the New button, a wizard will popup, you should ask to
30 its questions as follows
33 The name should be something like &appname;, but can
34 be any meaningful string.
37 The OS type should be Debian
40 The base memory size can be 256 mega bytes, but you may
41 want to increase it if you are going to work with huge
45 The boot hard disk should be no hard disk. It may complain
46 that this choice is not common, but it is right, since you
47 will run a LiveCD you do not need to emulate an hard drive.
50 Now that you are done with the creation of the virtual machine,
51 you need to insert the LiveCD in the virtual cd reader unit.
53 <figure><title>The brand new virtual machine</title>
56 <imagedata fileref="figures/vbox1.png" format="PNG" srccredit="Enrico Tassi"/>
58 <textobject><phrase>The breand new virtual machine</phrase></textobject>
62 Click on CD/DVD-ROM (that should display something like: Not mouted).
63 Then click on mount CD/DVD drive and select the ISO image
64 option. The combo-box should display no available image, you need to
65 add the ISO image you downloaded from the &appname; website clicking on
66 the button near the combo-box.
67 to start the virtual machine.
69 <figure><title>Mounting an ISO image</title>
72 <imagedata fileref="figures/vbox2.png" format="PNG" srccredit="Enrico Tassi"/>
74 <textobject><phrase>Mounting an ISO image</phrase></textobject>
78 In the newely opened window click
79 the Add button, choose the file you downloaded
80 (usually matita-version.iso) and select that entry.
82 <figure><title>Choosing the ISO image</title>
85 <imagedata fileref="figures/vbox3.png" format="PNG" srccredit="Enrico Tassi"/>
87 <textobject><phrase>Choosing the ISO image</phrase></textobject>
92 to start the virtual machine.
96 <title>Sharing files with the real PC</title>
102 <sect1 id="inst_from_src">
103 <title>Installing from sources</title>
105 <para>Install &appname; from the sources is hard, you have been warned!
108 <sect2 id="get_source_code">
109 <title>Getting the source code</title>
111 <para>You can get the &appname; source code in two ways:
114 <listitem> <para> go to the <ulink type="http"
115 url="http://matita.cs.unibo.it/download.shtml">download
116 page</ulink> and get the <ulink type="http"
117 url="http://matita.cs.unibo.it/sources/matita-latest.tar.gz"
118 >latest released source tarball</ulink>;</para> </listitem>
120 <listitem> <para> get the development sources from <ulink type="http"
121 url="http://helm.cs.unibo.it/websvn/listing.php?repname=helm&path=%2F&sc=0">our
122 SVN repository</ulink>. You will need the
123 <application>components/</application> and
124 <application>matita/</application> directories from the
125 <filename>trunk/helm/software/</filename> directory, plus the
126 <filename>configure</filename> and <filename>Makefile*</filename>
127 stuff from the same directory. </para>
129 <para>In this case you will need to run
130 <command>autoconf</command> before proceding with the building
131 instructions below.</para> </listitem>
138 <sect2 id="build_requirements">
139 <title>Requirements</title>
141 <para>In order to build &appname; from sources you will need some
142 tools and libraries. They are listed below.
145 <title>Note for Debian (and derivatives) users</title>
147 <para>If you are running a
149 url="http://www.debian.org">Debian GNU/Linux</ulink>
151 or any of its derivative like <ulink type="http"
152 url="http://ubuntu.com">Ubuntu</ulink>,
153 you can use APT to install all the required tools and
154 libraries since they are all part of the Debian archive.
157 apt-get install ocaml ocaml-findlib libgdome2-ocaml-dev liblablgtk2-ocaml-dev liblablgtkmathview-ocaml-dev liblablgtksourceview-ocaml-dev libsqlite3-ocaml-dev libocamlnet-ocaml-dev libzip-ocaml-dev libhttp-ocaml-dev ocaml-ulex08 libexpat-ocaml-dev libmysql-ocaml-dev camlp5
160 An official debian package is going to be added to the
167 <title>Required tools and libraries</title>
171 <application> <ulink type="http"
172 url="http://caml.inria.fr">OCaml</ulink> </application>
175 <para> the Objective Caml compiler, version 3.09 or above </para>
181 <application> <ulink type="http"
182 url="http://www.ocaml-programming.de/packages/">Findlib</ulink>
186 <para> OCaml package manager, version 1.1.1 or above</para>
192 <application> <ulink type="http"
193 url="http://www.xs4all.nl/~mmzeeman/ocaml/">OCaml
194 Expat</ulink> </application>
197 <para>OCaml bindings for the <application><ulink type="http"
198 url="http://expat.sourceforge.net/">expat</ulink>
199 library</application> </para>
205 <application> <ulink type="http"
206 url="http://gmetadom.sourceforge.net/">GMetaDOM</ulink>
210 <para>OCaml bindings for the <application><ulink type="http"
211 url="http://gdome2.cs.unibo.it/">Gdome 2</ulink>
212 library</application></para>
218 <application> <ulink type="http"
219 url="http://www.bononia.it/~zack/ocaml-http.en.html">OCaml
220 HTTP</ulink> </application>
223 <para> OCaml library to write HTTP daemons (and clients) </para>
229 <application> <ulink type="http"
230 url="http://wwwfun.kurims.kyoto-u.ac.jp/soft/lsl/lablgtk.html">LablGTK</ulink>
234 <para> OCaml bindings for the <application> <ulink type="http"
235 url="http://www.gtk.org"> GTK+</ulink> library
236 </application>, version 2.6.0 or above </para>
242 <application> <ulink type="http"
243 url="http://helm.cs.unibo.it/mml-widget/">GtkMathView</ulink>
247 <application> <ulink type="http"
248 url="http://helm.cs.unibo.it/mml-widget/">LablGtkMathView</ulink>
252 <para> GTK+ widget to render <ulink type="http"
253 url="http://www.w3.org/Math/">MathML</ulink> documents and its
254 OCaml bindings </para>
260 <application> <ulink type="http"
261 url="http://gtksourceview.sourceforge.net/">GtkSourceView</ulink>
265 <application> <ulink type="http"
266 url="http://helm.cs.unibo.it/software/lablgtksourceview/">LablGtkSourceView</ulink>
270 <para> extension for the GTK+ text widget (adding the typical
271 features of source code editors) and its OCaml bindings </para>
276 <term> &MYSQL; </term>
278 <application> <ulink type="http"
279 url="http://raevnos.pennmush.org/code/ocaml-mysql/">OCaml
280 MySQL</ulink> </application>
283 <para> SQL database and OCaml bindings for its client-side library
285 <para> The SQL database itself is not strictly needed to run
286 &appname;, but the client libraries are.</para>
291 <term> &Sqlite; </term>
295 url="http://ocaml.info/home/ocaml_sources.html">
297 </ulink> </application>
300 <para> Sqlite database and OCaml bindings
307 <application> <ulink type="http"
308 url="http://ocamlnet.sourceforge.net/">Ocamlnet</ulink>
312 <para> collection of OCaml libraries to deal with
313 application-level Internet protocols and conventions </para>
319 <application> <ulink type="http"
320 url="http://www.cduce.org/download.html">ulex</ulink>
324 <para> Unicode lexer generator for OCaml </para>
330 <application> <ulink type="http"
331 url="http://cristal.inria.fr/~xleroy/software.html">CamlZip</ulink>
335 <para> OCaml library to access <filename>.gz</filename> files
340 </variablelist> </para>
344 <sect2 id="database_setup">
345 <title>(optional) &MYSQL; setup</title>
347 <para> To fully exploit &appname; indexing and search capabilities
348 on a huge metadata set you may
349 need a working &MYSQL; database. Detalied instructions on how to do
350 it can be found in the <ulink type="http"
351 url="http://dev.mysql.com/doc/">MySQL documentation</ulink>. Here you
352 can find a quick howto. </para>
354 <para> In order to create a database you need administrator permissions on
355 your MySQL installation, usually the root account has them. Once you
356 have the permissions, a new database can be created executing
357 <userinput>mysqladmin create matita</userinput>
358 (<emphasis>matita</emphasis> is the default database name, you can
359 change it using the <parameter>db.user</parameter> key of the
360 configuration file). </para>
362 <para> Then you need to grant the necessary access permissions to the
363 database user of &appname;, typing <userinput>echo "grant all privileges
364 on matita.* to helm;" | mysql matita</userinput> should do the trick
365 (<emphasis>helm</emphasis> is the default user name used by &appname; to
366 access the database, you can change it using the
367 <parameter>db.user</parameter> key of the configuration file).
371 <para> This way you create a database named <emphasis>matita</emphasis>
372 on which anyone claiming to be the <emphasis>helm</emphasis> user can
373 do everything (like adding dummy data or destroying the contained
374 one). It is strongly suggested to apply more fine grained permissions,
375 how to do it is out of the scope of this manual.</para>
380 <sect2 id="build_instructions">
381 <title>Compiling and installing</title>
383 <para> Once you get the source code the installations steps should be
384 quite familiar.</para>
386 <para> First of all you need to configure the build process executing
387 <userinput>./configure</userinput>. This will check that all needed
388 tools and library are installed and prepare the sources for compilation
389 and installation. </para>
391 <para> Quite a few (optional) arguments may be passed to the
392 <application>configure</application> command line to change build time
393 parameters. They are listed below, together with their
394 default values: </para>
397 <title> <application>configure</application> command line
402 <userinput>--with-runtime-dir=<replaceable>dir</replaceable></userinput>
406 (<emphasis>Default:</emphasis>
407 <filename>/usr/local/matita</filename>) Runtime base directory
408 where all &appname; stuff (executables, configuration files,
409 standard library, ...) will be installed
416 <userinput>--with-dbhost=<replaceable>host</replaceable></userinput>
420 (<emphasis>Default:</emphasis> localhost) Default SQL server
421 hostname. Will be used while building the standard library
422 during the installation and to create the default &appname;
423 configuration. May be changed later in configuration file.
430 <userinput>--enable-debug</userinput>
434 (<emphasis>Default:</emphasis> disabled) Enable debugging code.
435 Not for the casual user.
441 <para> Then you will manage the build and install process using
442 <application><ulink type="http"
443 url="http://www.gnu.org/software/make/">make</ulink></application>
444 as usual. Below are reported the targets you have to invoke in sequence
445 to build and install:
449 <title><application>make</application> targets</title>
452 <term><userinput>world</userinput></term>
454 <para>builds components needed by &appname; and &appname; itself
455 (in bytecode or native code depending
456 on the availability of the OCaml native code compiler) </para>
461 <term><userinput>install</userinput></term>
463 <para>installs &appname; related tools, standard library and the
464 needed runtime stuff in the proper places on the filesystem.
466 <para>As a part of the installation process the &appname;
467 standard library will be compiled, thus testing that the just
468 built <application>matitac</application> compiler works
470 <para>For this step you will need a working SQL database (for
471 indexing the standard library while you are compiling it). See
472 <ulink type="http" url="#database_setup">Database setup</ulink>
473 for instructions on how to set it up.
484 <sect1 id="matita.conf.xml">
485 <title>Configuring &appname;</title>
487 The configuration file is divided in four sections. The user and
488 matita ones are self explicative and does not need user
489 intervention. Here we report a sample snippet for these two
490 sections. The remaining db and getter sections will be explained in
494 <section name="user">
495 <key name="home">$(HOME)</key>
496 <key name="name">$(USER)</key>
498 <section name="matita">
499 <key name="basedir">$(user.home)/.matita</key>
500 <key name="rt_base_dir">/usr/share/matita/</key>
501 <key name="owner">$(user.name)</key>
506 &appname; needs to store/fetch data and metadata. Data is essentially
507 composed of XML files, metadata is a set of tuples for a relational
508 model. Data and metadata can produced by the user or be already
509 available. Both kind of data/metadata can be local and/or remote.
512 The db section tells &appname; where to store and retrieve metadata,
513 while the getter section describes where XML files have to be
514 found. The following picture describes the suggested configuration.
515 Dashed arrows are determined by the configuration file.
517 <figure><title>Configuring the Databases</title>
520 <imagedata fileref="figures/database.png" format="PNG" srccredit="Enrico Tassi"/>
522 <textobject><phrase>How to configure the databases.</phrase></textobject>
525 <para>The getter</para>
527 Consider the following snippet and the URI
528 <userinput>cic:/matita/foo/bar.con</userinput>. If &appname;
529 is asked to read that object it will resolve the object trough
530 the getter. Since the first two entries are equally specific
531 (longest match rule applies) first the path
532 <userinput>file://$(matita.rt_base_dir)/xml/standard-library/foo/bar.con</userinput>
533 and then <userinput>file://$(user.home)/.matita/xml/matita/foo/bar.con</userinput>
537 <section name="getter">
538 <key name="cache_dir">$(user.home)/.matita/getter/cache</key>
541 file://$(matita.rt_base_dir)/xml/standard-library/
546 file://$(user.home)/.matita/xml/matita/
550 http://mowgli.cs.unibo.it/xml/
556 if the same URI has to be written, the former prefix is skipped
557 since it is marked as readonly (<userinput>ro</userinput>).
558 Objects resolved using the third prefix are readonly too, and are
559 retrieved using the network. There is no limit to the number of
560 prefixes the user can define. The distinction between prefixes marked
561 as readonly and legacy is that, legacy ones are really read only, while
562 the ones marked with <userinput>ro</userinput> are considered for
563 writing when &appname; is started in system mode (used to publish user
564 developments in the library space).
568 The database subsystem has three fron ends: library, user and
569 legacy. The latter is the only optional one. Every query is done on
570 every frontend, making the duplicate free union of the results.
571 The user front end kepps metadata produced by the user, and is thus
572 heavily accessed in read/write mode, while the library and legacy
573 fron ends are read only. Every front end can be connected to
574 backend, the storage actually.
575 Consider the following snippet.
579 <key name="metadata">mysql://mowgli.cs.unibo.it matita helm none legacy</key>
580 <key name="metadata">file://$(matita.rt_base_dir) metadata.db helm helm library</key>
581 <key name="metadata">file://$(matita.basedir) user.db helm helm user</key>
585 Here the usr database is a file (thus locally accessed trough the
586 Sqlite library) placed in the user's home directory. The library one is
587 placed in the &appname; runtime directory. The legacy fron end is
588 connected to a remote &MYSQL; based storage. Every metadata key
589 takes a path to the storage, the name of the database, the user name,
590 a password (or <userinput>none</userinput>) and the name of the front
591 end to which it is attached.