source: main/trunk/docs/admin/ht_1_install_server.rst @ 1059

Revision 1059, 11.8 KB checked in by pcosquer, 7 years ago (diff)

docs: admin: highlight psql session

How to install openPLM server

This document describes how to install an openPLM server.

Requirements

This HowTo is based on:

  • Ubuntu 10.04 LTS server edition (also tested on Debian Squeeze)
  • Apache Server version: Apache/2.2.14 (Ubuntu)
  • PostgreSQL 8.4.4
  • Python 2.6.X
  • Django 1.2.X
  • Celery 2.3.X
  • Haystack 1.2.X
  • Xapian 1.2.X
  • Lepl 5.0
  • South 0.7.3

Note

Django framework can run with SQLite 3 and MySQL databases and with other web servers. We welcome all feedbacks about these combinations. For more information, you can visit : Django website

Install necessary packages

First, you must install some dependencies:

  1. apt-get install swig build-essential pkg-config gettext
  2. apt-get install apache2 libapache2-mod-wsgi
  3. apt-get install python-pip python-dev python-imaging python-kjbuckets python-pypdf ipython
  4. pip install odfpy
  5. apt-get install graphviz graphviz-dev
  6. pip install 'pygraphviz>=1.1'
  7. apt-get install python-xapian rabbitmq-server
  8. apt-get install python-django python-docutils
  9. pip install 'south>=0.7'
  10. pip install celery
  11. pip install django-celery
  12. pip install 'django-haystack<2'
  13. apt-get install postgresql python-psycopg2
  14. pip install lepl
  15. apt-get install python-pisa

To enable plain text search on files, you need to install the following dependencies:

  1. apt-get install poppler-utils html2text odt2txt antiword catdoc
  2. pip install openxmllib

Get code using Subversion

  • apt-get install subversion
  • mkdir /var/django

All files used for a new django site will be stored in this directory.

  • cd /var/django
  • svn co svn://openplm.org/openPLM

The directory ./openPLM is created and all codes are downloaded.

  • cd /var/django/openPLM

Configure PostgreSQL

  • mkdir /var/postgres

  • chown postgres:postgres /var/postgres/

  • find / -name initdb

    /usr/lib/postgresql/8.4/bin/initdb
    
  • locale-gen fr_FR.UTF-8 (replace fr_FR.UTF-8 with your locale)

  • su postgres

  • /usr/lib/postgresql/8.4/bin/initdb --encoding=UTF-8 --locale=fr_FR.UTF-8 --pgdata=/var/postgres/

  • /usr/lib/postgresql/8.4/bin/postgres -D /var/postgres & (it is not a problem if postgres is already running, you do not have to restart it)

  • psql:

    Error: Failed to load processor psql
    No macro or processor named 'psql' found
  • exit

Change the secret key

  • cd /var/django/openPLM/trunk/openPLM/
  • python change_secret_key.py

Create the database

Edit the file :file:`/var/django/openPLM/trunk/openPLM/settings.py` and set the database password ('MyPassword') It must be the one set with the command create role django with password 'MyPassword' login; Here the DATABASE_USER is django, not the Django admin created by ./manage.py syncdb --all.

System Message: ERROR/3 (<string>, line 110); backlink

Unknown interpreted text role "file".

For example:

System Message: ERROR/3 (<string>, line 118)

Error in "code-block" directive: unknown option: "emphasize-lines".

.. code-block:: python
    :emphasize-lines: 7
    # settings.py
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.postgresql_psycopg2', # or 'postgresql', 'mysql', 'sqlite3', 'oracle'.
            'NAME': 'openplm',               # Or path to database file if using sqlite3.
            'USER': 'django',                # Not used with sqlite3.
            'PASSWORD': 'MyPassword',        # Not used with sqlite3.
            'HOST': 'localhost',             # Set to empty string for localhost. Not used with sqlite3.
            'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
        }
    }

Then execute the following commands:

  • cd /var/django/openPLM/trunk/openPLM/
  • ./manage.py syncdb --all
  • ./manage.py migrate --all --fake

Note

You have to create the superadmin user for Django and a special user named 'company'. The company can access all contents from openPLM and should sponsor other users. The admin is here to administrate openPLM via its admin interface.

Compile message files

Run the following commands:

  1. make
  2. ./manage.py compilemessages.

Configure where the files are saved

Create directory where the uploaded files will be stored:

  • mkdir /var/openPLM

Change rights:

  • chown www-data:www-data /var/openPLM

Change rights for the directory where thumbnails will be stored:

  • chown www-data:www-data /var/django/openPLM/trunk/openPLM/media/thumbnails

Configure the search engine

Although haystack supports several search engines, openPLM needs xapian. You may change the setting HAYSTACK_XAPIAN_PATH if you want to put the indexes in another directory.

Once haystack is configured, you must rebuild the index:

  • ./manage.py rebuild_index
  • chown www-data:www-data -R /var/openPLM/xapian_index/

Configure Celery

openPLM uses Celery to manage asynchronous tasks. Celery needs a broker, you can choose any broker supported by celery but rabbitmq is recommanded.

To configure rabbitmq, you must create an user and a vhost (as root):

  • service rabbitmq-server start
  • rabbitmqctl add_user openplm 'secret' (change this password, use single quotes to put special characters or spaces)
  • rabbitmqctl add_vhost openplm
  • rabbitmqctl set_permissions -p openplm openplm ".*" ".*" ".*"

Then you must modify the BROKER_* settings in the :file:`settings.py`, if you follow this tutorial, you only have to change BROKER_PASSWORD.

System Message: ERROR/3 (<string>, line 203); backlink

Unknown interpreted text role "file".

For example:

System Message: ERROR/3 (<string>, line 208)

Error in "code-block" directive: unknown option: "emphasize-lines".

.. code-block:: python
    :emphasize-lines: 5
    # settings.py
    BROKER_HOST = "localhost"
    BROKER_PORT = 5672
    BROKER_USER = "openplm"
    BROKER_PASSWORD = "secret"
    BROKER_VHOST = "openplm"

:command:`celeryd`, celery's daemon must be run. openPLM ships with an init script:

System Message: ERROR/3 (<string>, line 219); backlink

Unknown interpreted text role "command".
  • cp /var/django/openPLM/trunk/openPLM/etc/init.d/celeryd /etc/init.d/celeryd
  • cp /var/django/openPLM/trunk/openPLM/etc/default/celeryd /etc/default/celeryd
  • chmod +x /etc/init.d/celeryd
  • mkdir /var/log/celery
  • mkdir /var/run/celery
  • chown www-data:www-data /var/log/celery /var/run/celery

To launch :command:`celeryd`, run /etc/init.d/celeryd start.

System Message: ERROR/3 (<string>, line 228); backlink

Unknown interpreted text role "command".

Check required modules

  • ./check_modules.py

    /usr/local/lib/python2.6/dist-packages/pyPdf-1.12-py2.6.egg/pyPdf/pdf.py:52: DeprecationWarning: the sets module is deprecated
    from sets import ImmutableSet
    All is ok
    

Configure Apache server

Edit you Apache configuration file (:file:`/etc/apache2/httpd.conf`) and add the following lines:

System Message: ERROR/3 (<string>, line 243); backlink

Unknown interpreted text role "file".
Error: Failed to load processor apache
No macro or processor named 'apache' found

Restart Apache server

  • service apache2 restart

First steps in openPLM

Open your web browser and go to:

http://your_site_address/admin/

Note

Here your_site_adress is given as example but you have to use your own site adress

Enter superadmin login and password:

images/admin_login.png

If you see an IOError (socket closed), checks your settings, in particular the stuff related to Celery and RabbitMQ.

You can add new user and edit them going to Home>Auth>User:

images/admin_user.png

Do not forget to edit Home>Plmapp>User profiles in order to give correct rights for openPLM application :

images/admin_userprofile.png

Note

For more information about the Django Admin tool .

Then you must create a new Site (use the admin interface) and set the SITE_ID variable in the :file:`settings.py` file.

System Message: ERROR/3 (<string>, line 288); backlink

Unknown interpreted text role "file".

You are now ready for your first login:

http://localhost/
images/openplm_connexion.png

Requiring HTTPS connections

If your (apache) server support HTTPS, you can force HTTPS connections by setting the :const:`FORCE_HTTPS` and :const:`SESSION_COOKIE_SECURE` to True in the :file:`settings.py` file.

System Message: ERROR/3 (<string>, line 300); backlink

Unknown interpreted text role "const".

System Message: ERROR/3 (<string>, line 300); backlink

Unknown interpreted text role "const".

System Message: ERROR/3 (<string>, line 300); backlink

Unknown interpreted text role "file".

Each HTTP connection will be redirected to an HTTPS connection.

A possible apache configuration would be (the rewrite and ssl modules must be enabled)

Error: Failed to load processor apache
No macro or processor named 'apache' found

Configuring E-mails

There are several variables that can be set in the :file:`settings.py` to configure how mails are sent. See the Django documentation for more details.

System Message: ERROR/3 (<string>, line 346); backlink

Unknown interpreted text role "file".

OpenPLM adds another variable EMAIL_OPENPLM which is the e-mail address set in the from field of each e-mail. Usually, this is a no-reply@ address.

Troubleshootings

Admin pages are ugly

openPLM ships with a simlink (:file:`/path/to/openPLM/media/admin`) that may be broken on your system.

System Message: ERROR/3 (<string>, line 361); backlink

Unknown interpreted text role "file".

To fix this link, run the following command: ln -s `python -c 'import django; print django.__path__[0]'`/contrib/admin/media /var/django/openPLM/trunk/openPLM/media/admin

Connection refused

This error is thrown if Celery is mis-configured and can not connect to RabbitMQ.

See :ref:`celery` for more details, make sure that RabbitMQ is running and do not forget to edit the BROKER_* variables in the :file:`settings.py` file.

System Message: ERROR/3 (<string>, line 375); backlink

Unknown interpreted text role "ref".

System Message: ERROR/3 (<string>, line 375); backlink

Unknown interpreted text role "file".

I cannot find any objects

You can rebuild the search index (:ref:`search-engine`) and see if openPLM finds your parts.

System Message: ERROR/3 (<string>, line 386); backlink

Unknown interpreted text role "ref".

It is possible that celery can not update the search index. You can check celery's log (:file:`/var/log/celery/*.log`) and see if it contains lines like [.. INFO/MainProcess] Got task from broker: openPLM.plmapp.tasks.update_index[...]. It may be a permission problem and chown www-data:www-data -R /var/openPLM/xapian_index/ may fix it.

System Message: ERROR/3 (<string>, line 389); backlink

Unknown interpreted text role "file".

I try to connect to http://server/ but I always get an "It works" page

Maybe your apache installation is a little broken. Does http://server/home/ show a more acceptable result?

Note: See TracBrowser for help on using the repository browser.