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