doc/book/en/C011-installation.en.txt
author Emile Anclin <emile.anclin@logilab.fr>
Wed, 01 Apr 2009 15:15:06 +0200
changeset 1198 9df49357b0eb
parent 1195 79c1abc64304
child 1202 3a5d622f166f
permissions -rw-r--r--
doubts in english: sphinx reads the comments and they appear on cwo

.. -*- coding: utf-8 -*-

.. _CubicWebInstallation:

Installation
============

Installation of `Cubicweb` and its dependencies
-----------------------------------------------

`CubicWeb` is packaged for Debian and Ubuntu, but can be installed from source
using a tarball or the Mercurial version control system.

Debian and Ubuntu packages
```````````````````````````
Depending on the distribution you are using, add the appropriate line to your list
of sources (for example by editing ``/etc/apt/sources.list``).

For Debian Lenny::

  deb http://ftp.logilab.org/dists/ lenny/

For Debian Sid::

  deb http://ftp.logilab.org/dists/ sid/

For Ubuntu Hardy::

  deb http://ftp.logilab.org/dists/ hardy/


You can now install the required packages with the following command::

  apt-get update 
  apt-get install cubicweb
  apt-get install cubicweb-dev


This is it!

Install from source
```````````````````

You can download the archive containing the sources from our `ftp site`_ at::

  http://ftp.logilab.org/pub/cubicweb/

.. _`ftp site`: http://ftp.logilab.org/pub/cubicweb/

or keep up to date with on-going development by using Mercurial and its forest
extension::

  hg fclone http://www.logilab.org/hg/forests/cubicweb

See :ref:`MercurialPresentation` for more details about Mercurial.

Postgres installation
`````````````````````

Please refer to the `Postgresql project online documentation`_.

.. _`Postgresql project online documentation`: http://www.postgresql.org/

You need to install the three following packages: `postgres-8.3`,
`postgres-contrib-8.3` and `postgresql-plpython-8.3`.


Then you can install:

* `pyro` if you wish the repository to be accessible through Pyro
  or if the client and the server are not running on the same machine
  (in which case the packages will have to be installed on both
  machines)

* `python-ldap` if you plan to use a LDAP source on the server

.. _ConfigurationEnv:

Environment configuration
-------------------------

If you installed `CubicWeb` by cloning the Mercurial forest, then you
will need to update the environment variable PYTHONPATH by adding  
the path to the forest ``cubicweb``:

Add the following lines to either `.bashrc` or `.bash_profile` to configure
your development environment ::
  
  export PYTHONPATH=/full/path/to/cubicweb-forest

If you installed the debian packages, no configuration is required.
Your new cubes will be placed in `/usr/share/cubicweb/cubes` and
your applications will be placed in `/etc/cubicweb.d`.

To use other directories you will have to configure the
following environment variables as follows::

    export CW_CUBES_PATH=~/lib/cubes
    export CW_REGISTRY=~/etc/cubicweb.d/
    export CW_INSTANCE_DATA=$CW_REGISTRY
    export CW_RUNTIME=/tmp

.. note::
    The values given above are our suggestions but of course
    can be different.

.. _ConfigurationPostgres:

Postgres configuration
----------------------

.. note::
    If you already have an existing cluster and postgres server
    running you do not require to execute the initilization step
    of your Postgres database.

* First you have to initialize the database Postgres with the command ``initdb``.
  ::

    $ initdb -D /path/to/pgsql

  Once initialized, you can launch the database server Postgres 
  with the command::
  
    $ postgres -D /path/to/psql

  If you cannot execute this command due to permission issues, please
  make sure that your username has write access on the database.
  ::
 
    $ chown username /path/to/pgsql

* Create a superuser for `CubicWeb` instance::
    
    $ su
    $ su - postgres
    $ createuser -s username

  Initialize the password of the superuser you just created for your
  database::
    
    $ su 
    $ su - postgres
    $ psql

  And then execute de following query::
    
    ALTER USER username WITH PASSWORD `password`

  This login/password will be requested when you will create an
  instance with `cubicweb-ctl create` to initialize the database of
  your application.

.. FIXME Are these steps really necessary? It seemed to work without.

* installation of plain-text index extension ::

    cat /usr/share/postgresql/8.3/contrib/tsearch2.sql | psql -U username template1

* installation of plpythonu language by default ::

    createlang -U pgadmin plpythonu template1


Pyro configuration
------------------

If you use Pyro, it is required to have a name server Pyro running on your
network (by default it is identified by a broadcast request).

To do so, you need to :

* launch the server manually before starting cubicweb with `pyro-ns`

* launch the server manually before starting cubicweb as a server with
  `pyro-nsd start`

* edit the file ``/etc/default/pyro-nsd`` so that the name server pyro
  will be launched automatically when the machine fire up