]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/help/C/sec_install.xml
Update online helper entries
[helm.git] / matita / matita / help / C / sec_install.xml
1
2 <!-- ============= Installation ============================== -->
3
4 <chapter id="sec_install">
5   <title>Installation</title>
6
7   <para>
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.
15   </para>
16   
17   <sect1 id="inst_livecd">
18     <title>Using the LiveCD</title>
19
20     <para>
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
24     </para>
25
26     <sect2 id="make_vmachine">
27             <title>Creating the virtual machine</title>
28     <para>
29             Click on the New button, a wizard will popup, you should ask to
30             its questions as follows
31       <orderedlist>
32               <listitem><para> 
33                 The name should be something like &appname;, but can
34                 be any meaningful string.
35               </para></listitem>
36               <listitem><para> 
37                 The OS type should be Debian
38               </para></listitem>
39               <listitem><para> 
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
42                 formalizations.
43              </para></listitem>
44           <listitem><para> 
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.
48           </para></listitem>
49       </orderedlist>
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.
52       </para>
53    <figure><title>The brand new virtual machine</title>
54      <mediaobject>
55        <imageobject>
56          <imagedata fileref="figures/vbox1.png" format="PNG" srccredit="Enrico Tassi"/>
57        </imageobject>
58        <textobject><phrase>The breand new virtual machine</phrase></textobject>
59      </mediaobject>
60    </figure>
61    <para>
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. 
68     </para>
69    <figure><title>Mounting an ISO image</title>
70      <mediaobject>
71        <imageobject>
72          <imagedata fileref="figures/vbox2.png" format="PNG" srccredit="Enrico Tassi"/>
73        </imageobject>
74        <textobject><phrase>Mounting an ISO image</phrase></textobject>
75      </mediaobject>
76    </figure>
77    <para>
78       In the newely opened window click 
79       the Add button
80     </para>
81    <figure><title>Choosing the ISO image</title>
82      <mediaobject>
83        <imageobject>
84          <imagedata fileref="figures/vbox3.png" format="PNG" srccredit="Enrico Tassi"/>
85        </imageobject>
86        <textobject><phrase>Choosing the ISO image</phrase></textobject>
87      </mediaobject>
88    </figure>
89    <para>
90       A new windows will pop-up: choose the file you downloaded
91       (usually matita-version.iso) and click open.
92     </para>
93    <figure><title>Choosing the ISO image</title>
94      <mediaobject>
95        <imageobject>
96          <imagedata fileref="figures/vbox35.png" format="PNG" srccredit="Enrico Tassi"/>
97        </imageobject>
98        <textobject><phrase>Choosing the ISO image</phrase></textobject>
99      </mediaobject>
100    </figure>
101    <para>
102            Now select the new entry you just added as the CD image
103            you want to insert in the virtual CD drive.
104            You are now ready to start the virtual machine. 
105     </para>
106     </sect2>
107     <sect2>
108        <title>Sharing files with the real PC</title>
109           <para>
110                   The virtual machine &appname; will run on, has its own file 
111                   system, that is completely separated from the one of your 
112                   real PC (thus your files are not available in the
113                   emulated environment) and moreover it is a non-presistent
114                   file system (thus you data is lost every time you
115                   turn off the virtual machine).
116           </para>
117           <para>
118                   Virtualbox allows you to share a real folder (beloging
119                   to your real PC) with the emulated computer. Since this 
120                   folder is persistent, you are encouraged to put
121                   your work there, so that it is not lost when the virtual 
122                   machine is powered off.
123           </para>
124           <para>
125                   The first step to set up a shared folder is to click
126                   on the shared folder configuration entry
127                   of the virtual machine.
128           </para>
129           <figure><title>Set up a shared folder</title>
130             <mediaobject>
131               <imageobject>
132                       <imagedata fileref="figures/vbox4.png" 
133                               format="PNG" srccredit="Enrico Tassi"/>
134               </imageobject>
135               <textobject><phrase>Shared folder</phrase></textobject>
136             </mediaobject>
137           </figure>
138           <para>
139                   Then you shuld add a shared folder clicking on the 
140                   plus icon on the right
141           </para>
142           <figure><title>Choosing the folder to share</title>
143             <mediaobject>
144               <imageobject>
145                       <imagedata fileref="figures/vbox5.png" 
146                               format="PNG" srccredit="Enrico Tassi"/>
147               </imageobject>
148               <textobject><phrase>Shared folder</phrase></textobject>
149             </mediaobject>
150           </figure>
151           <para>
152                   Then you have to specify the real PC folder you want to share
153                   and name it. A reasonable folder to share is /home on 
154                   a standard Unix system, while /Users on MaxOSX.
155                   The name you give to the share is important, you should
156                   remember it.
157           </para>
158           <figure><title>Naming the shared folder</title>
159             <mediaobject>
160               <imageobject>
161                       <imagedata fileref="figures/vbox6.png" 
162                               format="PNG" srccredit="Enrico Tassi"/>
163               </imageobject>
164               <textobject><phrase>Shared folder</phrase></textobject>
165             </mediaobject>
166           </figure>
167           <para>
168                   Once your virtual machine is up and running, you can
169                   mount (that meand have access to) the shared folder 
170                   by clicking on the Mount VirtualBox share icon, and typing
171                   the name of the share.
172           </para>
173           <figure><title>Using it from the virtual machine</title>
174             <mediaobject>
175               <imageobject>
176                       <imagedata fileref="figures/vbox7.png" 
177                               format="PNG" srccredit="Enrico Tassi"/>
178               </imageobject>
179               <textobject><phrase>Shared folder at work</phrase></textobject>
180             </mediaobject>
181           </figure>
182           <para>
183                   A window will then pop-up, and its content will be the
184                   the content of the real PC folder.
185           </para>
186     </sect2>
187
188   </sect1>
189
190   <sect1 id="inst_from_src">
191     <title>Installing from sources</title>
192
193     <para>Install &appname; from the sources is hard, you have been warned!
194     </para>
195
196     <sect2 id="get_source_code">
197       <title>Getting the source code</title>
198
199       <para>You can get the &appname; source code in two ways:
200         <orderedlist>
201
202           <listitem> <para> go to the <ulink type="http"
203                 url="http://matita.cs.unibo.it/download.shtml">download
204                 page</ulink> and get the <ulink type="http"
205                 url="http://matita.cs.unibo.it/sources/matita-latest.tar.gz"
206                 >latest released source tarball</ulink>;</para> </listitem>
207
208           <listitem> <para> get the development sources from <ulink type="http"
209                 url="http://helm.cs.unibo.it/websvn/listing.php?repname=helm&amp;path=%2F&amp;sc=0">our
210                 SVN repository</ulink>. You will need the
211               <application>components/</application> and
212               <application>matita/</application> directories from the
213               <filename>trunk/helm/software/</filename> directory, plus the
214               <filename>configure</filename> and <filename>Makefile*</filename>
215               stuff from the same directory.  </para>
216
217               <para>In this case you will need to run
218                 <command>autoconf</command> before proceding with the building
219                 instructions below.</para> </listitem>
220
221         </orderedlist>
222       </para>
223       
224     </sect2>
225
226     <sect2 id="build_requirements">
227       <title>Requirements</title>
228
229       <para>In order to build &appname; from sources you will need some
230         tools and libraries. They are listed below.
231
232         <note>
233           <title>Note for Debian (and derivatives) users</title>
234
235           <para>If you are running a 
236                   <ulink type="http"
237                           url="http://www.debian.org">Debian GNU/Linux</ulink>
238                   distribution,
239                   or any of its derivative like <ulink type="http"
240                           url="http://ubuntu.com">Ubuntu</ulink>, 
241                   you can use APT to install all the required tools and
242                   libraries since they are all part of the Debian archive. 
243           </para>         
244           <para>          
245                   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
246           </para>         
247           <para>          
248                   An official debian package is going to be added to the
249                   archive too.
250           </para>
251
252         </note>
253
254         <variablelist>
255           <title>Required tools and libraries</title>
256
257           <varlistentry>
258             <term>
259               <application> <ulink type="http"
260                   url="http://caml.inria.fr">OCaml</ulink> </application>
261             </term>
262             <listitem>
263               <para> the Objective Caml compiler, version 3.09 or above </para>
264             </listitem>
265           </varlistentry>
266
267           <varlistentry>
268             <term>
269               <application> <ulink type="http"
270                   url="http://www.ocaml-programming.de/packages/">Findlib</ulink>
271               </application>
272             </term>
273             <listitem>
274               <para> OCaml package manager, version 1.1.1 or above</para>
275             </listitem>
276           </varlistentry>
277
278           <varlistentry>
279             <term>
280               <application> <ulink type="http"
281                   url="http://www.xs4all.nl/~mmzeeman/ocaml/">OCaml
282                   Expat</ulink> </application>
283             </term>
284             <listitem>
285               <para>OCaml bindings for the <application><ulink type="http"
286                     url="http://expat.sourceforge.net/">expat</ulink>
287                   library</application> </para>
288             </listitem>
289           </varlistentry>
290
291           <!--
292           <varlistentry>
293             <term>
294               <application> <ulink type="http"
295                   url="http://gmetadom.sourceforge.net/">GMetaDOM</ulink>
296               </application>
297             </term>
298             <listitem>
299               <para>OCaml bindings for the <application><ulink type="http"
300                     url="http://gdome2.cs.unibo.it/">Gdome 2</ulink>
301                   library</application></para>
302             </listitem>
303           </varlistentry>
304           -->
305
306           <!--
307           <varlistentry>
308             <term>
309               <application> <ulink type="http"
310                   url="http://www.bononia.it/~zack/ocaml-http.en.html">OCaml
311                   HTTP</ulink> </application>
312             </term>
313             <listitem>
314               <para> OCaml library to write HTTP daemons (and clients) </para>
315             </listitem>
316           </varlistentry>
317           -->
318
319           <varlistentry>
320             <term>
321               <application> <ulink type="http"
322                   url="http://wwwfun.kurims.kyoto-u.ac.jp/soft/lsl/lablgtk.html">LablGTK</ulink>
323               </application>
324             </term>
325             <listitem>
326               <para> OCaml bindings for the <application> <ulink type="http"
327                     url="http://www.gtk.org"> GTK+</ulink> library
328               </application>, version 2.6.0 or above </para>
329             </listitem>
330           </varlistentry>
331
332           <!--
333           <varlistentry>
334             <term>
335               <application> <ulink type="http"
336                   url="http://helm.cs.unibo.it/mml-widget/">GtkMathView</ulink>
337               </application>
338             </term>
339             <term>
340               <application> <ulink type="http"
341                   url="http://helm.cs.unibo.it/mml-widget/">LablGtkMathView</ulink>
342               </application>
343             </term>
344             <listitem>
345               <para> GTK+ widget to render <ulink type="http"
346                   url="http://www.w3.org/Math/">MathML</ulink> documents and its
347                 OCaml bindings </para>
348             </listitem>
349           </varlistentry>
350           -->
351
352           <varlistentry>
353             <term>
354               <application> <ulink type="http"
355                   url="http://gtksourceview.sourceforge.net/">GtkSourceView</ulink>
356               </application>
357             </term>
358             <term>
359               <application> <ulink type="http"
360                   url="http://helm.cs.unibo.it/software/lablgtksourceview/">LablGtkSourceView</ulink>
361               </application>
362             </term>
363             <listitem>
364               <para> extension for the GTK+ text widget (adding the typical
365                 features of source code editors) and its OCaml bindings </para>
366             </listitem>
367           </varlistentry>
368
369           <!--
370           <varlistentry>
371             <term> &MYSQL; </term>
372             <term>
373               <application> <ulink type="http"
374                   url="http://raevnos.pennmush.org/code/ocaml-mysql/">OCaml
375                   MySQL</ulink> </application>
376             </term>
377             <listitem>
378               <para> SQL database and OCaml bindings for its client-side library
379               </para>
380               <para> The SQL database itself is not strictly needed to run
381                 &appname;, but the client libraries are.</para>
382             </listitem>
383           </varlistentry>
384
385           <varlistentry>
386             <term> &Sqlite; </term>
387             <term>
388                     <application> 
389                           <ulink type="http"
390                               url="http://ocaml.info/home/ocaml_sources.html">
391                 OCaml Sqlite3
392               </ulink> </application>
393             </term>
394             <listitem>
395               <para> Sqlite database and OCaml bindings
396               </para>
397             </listitem>
398           </varlistentry>
399           -->
400
401           <varlistentry>
402             <term>
403               <application> <ulink type="http"
404                   url="http://ocamlnet.sourceforge.net/">Ocamlnet</ulink>
405               </application>
406             </term>
407             <listitem>
408               <para> collection of OCaml libraries to deal with
409                 application-level Internet protocols and conventions </para>
410             </listitem>
411           </varlistentry>
412
413           <varlistentry>
414             <term>
415               <application> <ulink type="http"
416                   url="http://www.cduce.org/download.html">ulex</ulink>
417               </application>
418             </term>
419             <listitem>
420               <para> Unicode lexer generator for OCaml </para>
421             </listitem>
422           </varlistentry>
423
424           <varlistentry>
425             <term>
426               <application> <ulink type="http"
427                   url="http://cristal.inria.fr/~xleroy/software.html">CamlZip</ulink>
428               </application>
429             </term>
430             <listitem>
431               <para> OCaml library to access <filename>.gz</filename> files
432               </para>
433             </listitem>
434           </varlistentry>
435
436         </variablelist> </para>
437
438     </sect2>
439
440     <!--
441     <sect2 id="database_setup">
442       <title>(optional) &MYSQL; setup</title>
443
444       <para> To fully exploit &appname; indexing and search capabilities 
445         on a huge metadata set you may
446         need a working &MYSQL; database. Detalied instructions on how to do
447         it can be found in the <ulink type="http"
448           url="http://dev.mysql.com/doc/">MySQL documentation</ulink>. Here you
449         can find a quick howto. </para>
450
451       <para> In order to create a database you need administrator permissions on
452         your MySQL installation, usually the root account has them. Once you
453         have the permissions, a new database can be created executing
454         <userinput>mysqladmin create matita</userinput>
455         (<emphasis>matita</emphasis> is the default database name, you can
456         change it using the <parameter>db.user</parameter> key of the
457         configuration file). </para>
458
459       <para> Then you need to grant the necessary access permissions to the
460         database user of &appname;, typing <userinput>echo "grant all privileges
461           on matita.* to helm;" | mysql matita</userinput> should do the trick
462         (<emphasis>helm</emphasis> is the default user name used by &appname; to
463         access the database, you can change it using the
464         <parameter>db.user</parameter> key of the configuration file).
465       </para>
466
467       <note>
468         <para> This way you create a database named <emphasis>matita</emphasis>
469           on which anyone claiming to be the <emphasis>helm</emphasis> user can
470           do everything (like adding dummy data or destroying the contained
471           one). It is strongly suggested to apply more fine grained permissions,
472           how to do it is out of the scope of this manual.</para>
473       </note>
474       
475     </sect2>
476     -->
477
478     <sect2 id="build_instructions">
479       <title>Compiling and installing</title>
480
481       <para> Once you get the source code the installations steps should be
482         quite familiar.</para>
483
484       <para> First of all you need to configure the build process executing
485         <userinput>./configure</userinput>. This will check that all needed
486         tools and library are installed and prepare the sources for compilation
487         and installation. </para>
488         
489       <para> Quite a few (optional) arguments may be passed to the
490         <application>configure</application> command line to change build time
491         parameters. They are listed below, together with their
492         default values: </para>
493
494         <variablelist>
495           <title> <application>configure</application> command line
496             arguments</title>
497
498           <varlistentry>
499             <term>
500               <userinput>--with-runtime-dir=<replaceable>dir</replaceable></userinput>
501             </term>
502             <listitem>
503               <para>
504                 (<emphasis>Default:</emphasis>
505                 <filename>/usr/local/matita</filename>) Runtime base directory
506                 where all &appname; stuff (executables, configuration files,
507                 standard library, ...) will be installed
508               </para>
509             </listitem>
510           </varlistentry>
511
512           <!--
513           <varlistentry>
514             <term>
515               <userinput>- - with-dbhost=<replaceable>host</replaceable></userinput>
516             </term>
517             <listitem>
518               <para>
519                 (<emphasis>Default:</emphasis> localhost) Default SQL server
520                 hostname. Will be used while building the standard library
521                 during the installation and to create the default &appname;
522                 configuration. May be changed later in configuration file.
523               </para>
524             </listitem>
525           </varlistentry>
526           -->
527
528           <varlistentry>
529             <term>
530               <userinput>--enable-debug</userinput>
531             </term>
532             <listitem>
533               <para>
534                 (<emphasis>Default:</emphasis> disabled) Enable debugging code.
535                 Not for the casual user.
536               </para>
537             </listitem>
538           </varlistentry>
539         </variablelist>
540
541       <para> Then you will manage the build and install process using
542         <application><ulink type="http"
543             url="http://www.gnu.org/software/make/">make</ulink></application>
544         as usual. Below are reported the targets you have to invoke in sequence
545         to build and install:
546       </para>
547
548         <variablelist>
549           <title><application>make</application> targets</title>
550
551           <varlistentry>
552             <term><userinput>world</userinput></term>
553             <listitem>
554               <para>builds components needed by &appname; and &appname; itself
555                 (in bytecode or native code depending
556                 on the availability of the OCaml native code compiler) </para>
557             </listitem>
558           </varlistentry>
559
560           <varlistentry>
561             <term><userinput>install</userinput></term>
562             <listitem>
563               <para>installs &appname; related tools, standard library and the
564                 needed runtime stuff in the proper places on the filesystem.
565               </para>
566               <!--
567               <para>As a part of the installation process the &appname;
568                 standard library will be compiled, thus testing that the just
569                 built <application>matitac</application> compiler works
570                 properly.</para>
571               <para>For this step you will need a working SQL database (for
572                 indexing the standard library while you are compiling it). See
573                 <ulink type="http" url="#database_setup">Database setup</ulink>
574                 for instructions on how to set it up.
575               </para>-->
576             </listitem>
577           </varlistentry>
578
579         </variablelist>
580       
581     </sect2>
582
583   </sect1>
584
585   <!--
586   <sect1 id="matita.conf.xml">
587     <title>Configuring &appname;</title>
588     <para>
589             The configuration file is divided in four sections. The user and
590             matita ones are self explicative and does not need user
591             intervention. Here we report a sample snippet for these two
592             sections. The remaining db and getter sections will be explained in
593             details later.
594            <programlisting>
595 <![CDATA[
596   <section name="user">
597     <key name="home">$(HOME)</key>
598     <key name="name">$(USER)</key>
599   </section>
600   <section name="matita">
601     <key name="basedir">$(user.home)/.matita</key>
602     <key name="rt_base_dir">/usr/share/matita/</key>
603     <key name="owner">$(user.name)</key>
604   </section>
605 ]]></programlisting>
606     </para>
607    <para>
608            &appname; needs to store/fetch data and metadata. Data is essentially
609            composed of XML files, metadata is a set of tuples for a relational
610            model. Data and metadata can produced by the user or be already
611            available. Both kind of data/metadata can be local and/or remote.
612    </para>
613    <para>
614            The db section tells &appname; where to store and retrieve metadata,
615            while the getter section describes where XML files have to be
616            found. The following picture describes the suggested configuration.
617            Dashed arrows are determined by the configuration file.
618    </para>
619    <figure><title>Configuring the Databases</title>
620      <mediaobject>
621        <imageobject>
622          <imagedata fileref="figures/database.png" format="PNG" srccredit="Enrico Tassi"/>
623        </imageobject>
624        <textobject><phrase>How to configure the databases.</phrase></textobject>
625      </mediaobject>
626    </figure>
627    <para>The getter</para>
628    <para>
629            Consider the following snippet and the URI
630            <userinput>cic:/matita/foo/bar.con</userinput>. If &appname;
631            is asked to read that object it will resolve the object trough
632            the getter. Since the first two entries are equally specific
633            (longest match rule applies) first the path
634            <userinput>file://$(matita.rt_base_dir)/xml/standard-library/foo/bar.con</userinput>
635            and then <userinput>file://$(user.home)/.matita/xml/matita/foo/bar.con</userinput>
636            are inspected.
637            <programlisting>
638 <![CDATA[
639   <section name="getter">
640     <key name="cache_dir">$(user.home)/.matita/getter/cache</key>
641     <key name="prefix">
642       cic:/matita/
643       file://$(matita.rt_base_dir)/xml/standard-library/
644       ro
645     </key>
646     <key name="prefix">
647       cic:/matita/
648       file://$(user.home)/.matita/xml/matita/
649     </key>
650     <key name="prefix">
651       cic:/Coq/
652       http://mowgli.cs.unibo.it/xml/
653       legacy
654     </key>
655   </section>
656 ]]>     
657         </programlisting> 
658         if the same URI has to be written, the former prefix is skipped
659         since it is marked as readonly (<userinput>ro</userinput>).
660         Objects resolved using the third prefix are readonly too, and are
661         retrieved using the network. There is no limit to the number of
662         prefixes the user can define. The distinction between prefixes marked
663         as readonly and legacy is that, legacy ones are really read only, while
664         the ones marked with <userinput>ro</userinput> are considered for
665         writing when &appname; is started in system mode (used to publish user
666         developments in the library space).
667    </para>
668           <para>The db</para>
669         <para>
670            The database subsystem has three fron ends: library, user and
671            legacy.  The latter is the only optional one. Every query is done on
672            every frontend, making the duplicate free union of the results.
673            The user front end kepps metadata produced by the user, and is thus
674            heavily accessed in read/write mode, while the library and legacy
675            fron ends are read only. Every front end can be connected to
676            backend, the storage actually. 
677            Consider the following snippet.
678            <programlisting>
679 <![CDATA[
680   <section name="db">
681     <key name="metadata">mysql://mowgli.cs.unibo.it matita helm none legacy</key>
682     <key name="metadata">file://$(matita.rt_base_dir) metadata.db helm helm library</key>
683     <key name="metadata">file://$(matita.basedir) user.db helm helm user</key>
684   </section>
685 ]]>     
686         </programlisting> 
687         Here the usr database is a file (thus locally accessed trough the
688         Sqlite library) placed in the user's home directory. The library one is
689         placed in the &appname; runtime directory. The legacy fron end is
690         connected to a remote &MYSQL; based storage. Every metadata key 
691         takes a path to the storage, the name of the database, the user name,
692         a password (or <userinput>none</userinput>) and the name of the front 
693         end to which it is attached.
694    </para>
695   </sect1>
696   -->
697
698 </chapter>
699