How to install OpenERP 6.1 on Ubuntu 10.04 LTS

OpenERP LogoThe new release of OpenERP 6.1 heralds a great many incremental improvements in the product plus a complete re-write of the web interface; which is a massive improvement and much more an integral part of OpenERP than it’s predecessor.

UPDATE: By popular request here is a subsequent post describing how to set up a reverse proxy and ssl using nginx.

As my previous howto for 6.0 was a such roaring success I thought I’d better do something for the new 6.1 release too.

Before continuing, I should mention that you can simply download a “.deb” package of OpenERP 6.1 and install that on Ubuntu. But that doesn’t provide me with enough fine grained control over what and where things get installed and it restricts our flexibility to modify & customise hence I prefer to do it a slightly more manual way… (It should be said though, that this install process should only take about 10-15 minutes once the host machine has been built)

So without further ado here we go:

Step 1. Build your server

I install just the bare minimum from the install routine (you can install the openssh-server during the install procedure or install subsequently depending on your preference).

After the server has restarted for the first time I install the openssh-server package (so we can connect to it remotely) and denyhosts to add a degree of brute-force attack protection. There are other protection applications available: I’m not saying this one is the best, but it’s one that works and is easy to configure and manage. If you don’t already, it’s also worth looking at setting up key-based ssh access, rather than relying on passwords. This can also help to limit the potential of brute-force attacks. [NB: This isn’t a How To on securing your server…]

sudo apt-get install openssh-server denyhosts

Now make sure you are running all the latest patches by doing an update:

sudo apt-get update
sudo apt-get dist-upgrade

Although not always essential it’s probably a good idea to reboot your server now and make sure it all comes back up and you can login via ssh.

Now we’re ready to start the OpenERP install.

Step 2. Create the OpenERP user that will own and run the application

sudo adduser --system --home=/opt/openerp --group openerp

This is a “system” user. It is there to own and run the application, it isn’t supposed to be a person type user with a login etc. In Ubuntu, a system user gets a UID below 1000, has no shell (it’s actually /bin/false) and has logins disabled. Note that I’ve specified a “home” of /opt/openerp, this is where the OpenERP server code will reside and is created automatically by the command above. The location of the server code is your choice of course, but be aware that some of the instructions and configuration files below may need to be altered if you decide to install to a different location.

A question I was asked a few times in the previous how to for 6.0 was how to run the OpenERP server as the openerp system user from the command line if it has no shell. This can be done quite easily:

sudo su - openerp -s /bin/bash

This will su your current terminal login to the openerp user (the “-” between su and openerp is correct) and use the shell /bin/bash. When this command is run you will be in openerp’s home directory: /opt/openerp.

When you have done what you need you can leave the openerp user’s shell by typing exit.

Step 3. Install and configure the database server, PostgreSQL

sudo apt-get install postgresql

Then configure the OpenERP user on postgres:

First change to the postgres user so we have the necessary privileges to configure the database.

sudo su - postgres

Now create a new database user. This is so OpenERP has access rights to connect to PostgreSQL and to create and drop databases. Remember what your choice of password is here; you will need it later on:

createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt openerp
Enter password for new role: ********
Enter it again: ********

Finally exit from the postgres user account:

exit

Step 4. Install the necessary Python libraries for the server

Update 27/02/2012: Many thanks to Gavin for reporting. Have added python-simplejson to the package list.

sudo apt-get install python-dateutil python-feedparser python-gdata \
python-ldap python-libxslt1 python-lxml python-mako python-openid python-psycopg2 \
python-pybabel python-pychart python-pydot python-pyparsing python-reportlab \
python-simplejson python-tz python-vatnumber python-vobject python-webdav \
python-werkzeug python-xlwt python-yaml python-zsi

From what I can tell, on Ubuntu 10.04 the package python-werkzeug is too old and this will cause the server to not start properly. If you are trying this on a later version of Ubuntu then you might be OK, but just in-case you can also do the following.

I found it necessary to install a more recent version of Werkzeug using Python’s own package management library PIP. The python pip tool can be installed like this:

sudo apt-get install python-pip

Then remove Ubuntu’s packaged version of werkzeug:

sudo apt-get remove python-werkzeug

Then install the up-to-date version of werkzeug:

sudo pip install werkzeug

With that done, all the dependencies for installing OpenERP 6.1 are now satisfied, including for the new integral web interface.

Step 5. Install the OpenERP server

I tend to use wget for this sort of thing and I download the files to my home directory.

Make sure you get the latest version of the application. At the time of writing this it’s 6.1-1; I got the download links from their download page.

wget http://nightly.openerp.com/6.1/releases/openerp-6.1-1.tar.gz

Now install the code where we need it: cd to the /opt/openerp/ directory and extract the tarball there.

cd /opt/openerp
sudo tar xvf ~/openerp-6.1-1.tar.gz

Next we need to change the ownership of all the the files to the OpenERP user and group.

sudo chown -R openerp: *

And finally, the way I have done this is to copy the server directory to something with a simpler name so that the configuration files and boot scripts don’t need constant editing (I called it, rather unimaginatively, server). I started out using a symlink solution, but I found that when it comes to upgrading, it seems to make more sense to me to just keep a copy of the files in place and then overwrite them with the new code. This way you keep any custom or user-installed modules and reports etc. all in the right place.

sudo cp -a openerp-6.1-1 server

As an example, should OpenERP 6.1-2 come out soon, I can extract the tarballs into /opt/openerp/ as above. I can do any testing I need, then repeat the copy command so that the modified files will overwrite as needed and any custom modules, report templates and such will be retained. Once satisfied the upgrade is stable, the older 6.1-1 directories can be removed if wanted.

That’s the OpenERP server software installed. The last steps to a working system is to set up the configuration file and associated boot script so OpenERP starts and stops automatically when the server itself stops and starts.

Step 6. Configuring the OpenERP application

The default configuration file for the server (in /opt/openerp/server/install/) is actually very minimal and will, with only one small change work fine so we’ll simply copy that file to where we need it and change it’s ownership and permissions:

sudo cp /opt/openerp/server/install/openerp-server.conf /etc/
sudo chown openerp: /etc/openerp-server.conf
sudo chmod 640 /etc/openerp-server.conf

The above commands make the file owned and writeable only by the openerp user and group and only readable by openerp and root.

To allow the OpenERP server to run initially, you should only need to change one line in this file. Toward to the top of the file change the line db_password = False to the same password you used back in step 3. Use your favourite text editor here. I tend to use nano, e.g.

sudo nano /etc/openerp-server.conf

One other line we might as well add to the configuration file now, is to tell OpenERP where to write its log file. To complement my suggested location below add the following line to the openerp-server.conf file:

logfile = /var/log/openerp/openerp-server.log

Once the configuration file is edited and saved, you can start the server just to check if it actually runs.

sudo su - openerp -s /bin/bash
/opt/openerp/server/openerp-server

If you end up with a few lines eventually saying OpenERP is running and waiting for connections then you are all set. Just type CTL+C to stop the server then exit to leave the openerp user’s shell.

If there are errors, you’ll need to go back and check where the problem is.

Step 7. Installing the boot script

For the final step we need to install a script which will be used to start-up and shut down the server automatically and also run the application as the correct user. There is a script you can use in /opt/openerp/server/install/openerp-server.init but this will need a few small modifications to work with the system installed the way I have described above. Here’s a link to the one I’ve already modified for 6.1-1.

Similar to the configuration file, you need to either copy it or paste the contents of this script to a file in /etc/init.d/ and call it openerp-server. Once it is in the right place you will need to make it executable and owned by root:

sudo chmod 755 /etc/init.d/openerp-server
sudo chown root: /etc/init.d/openerp-server

In the configuration file there’s an entry for the server’s log file. We need to create that directory first so that the server has somewhere to log to and also we must make it writeable by the openerp user:

sudo mkdir /var/log/openerp
sudo chown openerp:root /var/log/openerp

Step 8. Testing the server

To start the OpenERP server type:

sudo /etc/init.d/openerp-server start

You should now be able to view the logfile and see that the server has started.

less /var/log/openerp/openerp-server.log

If there are any problems starting the server you need to go back and check. There’s really no point ploughing on if the server doesn’t start…

OpenERP 6.1 Home Screen

OpenERP 6.1 Home Screen


If the log file looks OK, now point your web browser at the domain or IP address of your OpenERP server (or localhost if you are on the same machine) and use port 8069. The url will look something like this:

http://IP_or_domain.com:8069

What you should see is a screen like this one:

What I do recommend you do at this point is to change the super admin password to something nice and strong (Click the “Manage Databases” link below the main Login box). By default this password is just “admin” and knowing that, a user can create, backup, restore and drop databases! This password is stored in plain text in the /etc/openerp-server.conf file; hence why we restricted access to just openerp and root. When you change and save the new password the /etc/openerp-server.conf file will be re-written and will have a lot more options in it.

Now it’s time to make sure the server stops properly too:

sudo /etc/init.d/openerp-server stop

Check the logfile again to make sure it has stopped and/or look at your server’s process list.

Step 9. Automating OpenERP startup and shutdown

If everything above seems to be working OK, the final step is make the script start and stop automatically with the Ubuntu Server. To do this type:

sudo update-rc.d openerp-server defaults

You can now try rebooting you server if you like. OpenERP should be running by the time you log back in.

If you type ps aux | grep openerp you should see a line similar to this:

openerp 1491 0.1 10.6 207132 53596 ? Sl 22:23 0:02 python /opt/openerp/server/openerp-server -c /etc/openerp-server.conf

Which shows that the server is running. And of course you can check the logfile or visit the server from your web browser too.

That’s it!

OpenERP 6.1 really is a major step up in terms of improvements from 6.0 and the new integrated web interface (with a Point of Sale and a Mobile interface built-in) are really very cool. Performance has improved considerably and the way the new web service interfaces to OpenERP is very different. So, if I get the time, the next instalment of these posts will go into a bit of detail about how this works and some alternative ways to provide more secure access, such as reverse proxy.

Tags: , ,

285 Comments

  • samuel says:

    good morning, I installed the following openerp this manual : http://misnotasdelinux.blogspot.com.es/2012/07/instalacion-completa-de-open-erp-61.html

    and at the end I get:
    2013-02-08 08:23:38,585 16538 INFO ? openerp: OpenERP version 6.1
    2013-02-08 08:23:38,585 16538 INFO ? openerp: addons paths: /var/www/openerp61/server/openerp61/addons,/var/www/openerp61/server/ /var/www/openerp61/web/addons
    2013-02-08 08:23:38,586 16538 INFO ? openerp: database hostname: localhost
    2013-02-08 08:23:38,586 16538 INFO ? openerp: database port: 5432
    2013-02-08 08:23:38,586 16538 INFO ? openerp: database user: openerp
    Traceback (most recent call last):
    File “openerp-server”, line 248, in
    openerp.service.start_services()
    File “/var/www/openerp61/server/openerp/service/__init__.py”, line 65, in start_services
    netrpc_server.init_servers()
    File “/var/www/openerp61/server/openerp/service/netrpc_server.py”, line 165, in init_servers
    int(tools.config.get(‘netrpc_port’, 8070)))
    File “/var/www/openerp61/server/openerp/service/netrpc_server.py”, line 110, in __init__
    self.socket.bind((self.__interface, self.__port))
    File “”, line 1, in bind
    socket.error: [Errno 98] La dirección ya se está usando

    anyone can help me, thank you very much

  • Juani says:

    Samuel, you have occupied the port.

    Use netstat -nlp and verify, then kill the process.

    Note: Por el tutorial que has seguido creo que hablas español, ese error muestra que el puerto se encuentra ocupado, tienes que liberarlo matando el proceso que lo ocupa.

    • Diego Hernández says:

      Hola Juani, tengo exactamente el mismo problema pero con openerp 7, para esta versión de openerp tendría que hacer lo mismo?? Te comento que ya lo tenía instalado(siguiendo el tutorial para la versión 7 de esta misma página) pero me empezó a mandar muchos errores, por lo que decidí desintalarlo e instalarlo nuevamente, pero me manda este error.

  • Fatih says:

    Congratulations for the excellent post. Worked at first!

  • Noe Rosales says:

    Hi, your install guide is great, I got my openERP working on the localhost:8069 just like yo said.
    Now I need to have access to my openERP from another PC on the WEB,. How do I go about it.
    Thanks in advance.

    • Alan Lord says:

      Hi Noe,

      Personally I would set up a reverse proxy so all connections via the Internet are encrypted using ssl. I wrote a guide for 6.1 using Nginx on this blog. That should get you started.

      Have fun!

  • john says:

    hi, I had setup openerp based on info. Today i stopped openerp-server, deleted the directory and pulled server, addons, web directory from bzr command.

    I performed,
    sudo su – openerp -s /bin/bash
    /opt/openerp/server/openerp-server –addons=./addons/,./web/addons -d -u all

    there were no errors.
    But when i launch openerp URL.. i get https://openerp.mydomain.com, openerp.mydomain.com/?db= . Any idea why i have repeated domain pops up in URL. if i deleted the first URL ,links works. There were no issue with Single DB. when i created multiple DB.. the url acts strange. Kindly let me know what you think might happen..

  • sumana says:

    Hi,I want to re-install OpenERP 6.1 that I set up following by this steps. I tried to remove all file and folder and set up again. Now, I cant connect to OpenERP by bootscripts but if i connect by
    sudo su – openerp -s /bin/bash
    /opt/openerp/server/openerp-server
    it’s ok

    What’s wrong ?
    Thank You so much

    • saurabh says:

      may be you have not set the file permissions correctly for the config file in both /etc and /etc/init.d for the openerp-server files

  • Henry says:

    First of all excuse me about my bad english.

    I only comment to tell you that you hace save my live with this tutorials. thanks, you are a genius!!

  • Sean Choi says:

    openerp@ubuntuopenerp-VirtualBox:~$ /opt/openerp/server/openerp-server
    Traceback (most recent call last):
    File “/opt/openerp/server/openerp-server”, line 2, in
    import openerp
    File “/opt/openerp/server/openerp/__init__.py”, line 42, in
    import http
    File “/opt/openerp/server/openerp/http.py”, line 8, in
    from . import service
    File “/opt/openerp/server/openerp/service/__init__.py”, line 36, in
    import openerp.netsvc
    File “/opt/openerp/server/openerp/netsvc.py”, line 33, in
    import psutil
    ImportError: No module named psutil

  • MURRIS J says:

    Hello,

    I hope this email is going to the correct person. If not… please accept my sincerest apology. The reason I’m emailing is because I noticed on your website that you have a page where you reference a POS(point of sale) system, and I wanted to ask you a question about the page. Please let me know if I’m speaking to the right person. I look forward to your reply. Thanks.

    Murris

  • Stefano says:

    Hi.
    Everything is fine except when I try to export anything to external file.
    In the log I find:

    2013-11-19 10:56:50,791 19781 ERROR ? openerp.addons.web.common.http.HttpRequest.dispatch: An error occurred while handling a json request
    Traceback (most recent call last):
    File “/opt/openerp/server/openerp/addons/web/common/http.py”, line 260, in dispatch
    r = method(controller, self, **self.params)
    File “/opt/openerp/server/openerp/addons/web/controllers/main.py”, line 1670, in index
    cookies={‘fileToken’: int(token)})
    File “/opt/openerp/server/openerp/addons/web/common/http.py”, line 307, in make_response
    response.set_cookie(k, v)
    File “/usr/local/lib/python2.7/dist-packages/werkzeug/wrappers.py”, line 992, in set_cookie
    self.charset))
    File “/usr/local/lib/python2.7/dist-packages/werkzeug/http.py”, line 905, in dump_cookie
    value = to_bytes(value, charset)
    File “/usr/local/lib/python2.7/dist-packages/werkzeug/_compat.py”, line 106, in to_bytes
    raise TypeError(‘Expected bytes’)
    TypeError: Expected bytes
    2013-11-19 10:56:50,795 19781 INFO ? werkzeug: 192.168.0.24 – – [19/Nov/2013 10:56:50] “POST /web/export/csv HTTP/1.1” 500 –

    But can’t understand why
    Yhanks

  • […] the tutorial on installing openerp v6.1 on ubuntu, I should be able to get the services started from […]

  • helronald says:

    Hello,when i tape sudo su – postgres ,it requires a password for openerp user.What is this password?because i didin’t set it.Thanks for ur help

  • Jan says:

    Thanks a lot! I installed openerp a few times with your tutorial and always with no problems.

  • paul says:

    i had this problem, please help!!
    i try to migrate the openerp v5 to v6 , and here with the openerp6 user with privilegies, i got this error
    and in the same server i had the v5, and works fine.

    File “/home/openerp6/6.0/bin/netsvc.py”, line 487
    self.log(‘params’, replace_request_password(params), depth=(None if logger.isEnabledFor(logging.DEBUG_RPC_ANSWER) else 1))

  • pertuk says:

    I’m using openerp 6.1 which I installed following this tutorial. Sometimes I run the server from command line when some module needs to be upgraded.

    After a while without any restart I’m getting an error at start which I cannot resolve.
    I’ve widely searched the net on it without success. There are some reports of similar errors, but none that can serve.

    Here’s the trace:

    $ python ./openerp-server -r openerp –addons-path=/opt/openerp/runver/addons,/opt/openerp/runver/web/addons/
    2015-05-05 15:43:45,200 30353 INFO ? openerp: OpenERP version 6.1
    2015-05-05 15:43:45,201 30353 INFO ? openerp: addons paths: /opt/openerp/runver/addons,/opt/openerp/runver/web/addons
    2015-05-05 15:43:45,201 30353 INFO ? openerp: database hostname: localhost
    2015-05-05 15:43:45,201 30353 INFO ? openerp: database port: 5432
    2015-05-05 15:43:45,201 30353 INFO ? openerp: database user: openerp
    2015-05-05 15:43:45,201 30353 INFO ? openerp.service.netrpc_server: starting NET-RPC service on 0.0.0.0:8070
    2015-05-05 15:43:45,201 30353 INFO ? openerp.netsvc: Starting 1 services
    2015-05-05 15:43:45,215 30353 INFO ? openerp.wsgi.core: HTTP service (werkzeug) running on 0.0.0.0:8069
    2015-05-05 15:43:45,241 30353 INFO ? openerp.addons.web: embedded mode
    2015-05-05 15:43:45,343 30353 CRITICAL ? openerp.modules.module: Couldn’t load module web
    2015-05-05 15:43:45,343 30353 CRITICAL ? openerp.modules.module: cannot import name model
    2015-05-05 15:43:45,343 30353 ERROR ? openerp: Failed to load server-wide module `web`.
    The `web` module is provided by the addons found in the `openerp-web` project.
    Maybe you forgot to add those addons in your addons_path configuration.
    Traceback (most recent call last):
    File “./openerp-server”, line 252, in
    openerp.modules.module.load_openerp_module(m)
    File “/opt/openerp/runver/server/openerp/modules/module.py”, line 419, in load_openerp_module
    getattr(sys.modules[‘openerp.addons.’ + module_name], info[‘post_load’])()
    File “/opt/openerp/runver/web/addons/web/__init__.py”, line 33, in wsgi_postload
    app = common.http.Root(o)
    File “/opt/openerp/runver/web/addons/web/common/http.py”, line 453, in __init__
    static_dirs = self._load_addons(openerp_addons_namespace)
    File “/opt/openerp/runver/web/addons/web/common/http.py”, line 523, in _load_addons
    m = __import__(‘openerp.addons.’ + module)
    File “/opt/openerp/runver/server/openerp/modules/module.py”, line 139, in load_module
    mod = imp.load_module(‘openerp.addons.’ + module_part, f, path, descr)
    File “/opt/openerp/runver/addons/hw_proxy/__init__.py”, line 22, in
    import controllers
    File “/opt/openerp/runver/addons/hw_proxy/controllers/__init__.py”, line 1, in
    import main
    File “/opt/openerp/runver/addons/hw_proxy/controllers/main.py”, line 19, in
    from openerp import http
    File “/opt/openerp/runver/server/openerp/http.py”, line 42, in
    from openerp.service import security, model as service_model
    ImportError: cannot import name model
    2015-05-05 15:43:45,344 30353 INFO ? openerp: OpenERP server is running, waiting for connections…

    python ./openerp-server -r openerp --addons-path=/opt/openerp/runver/addons,/opt/openerp/runver/web/addons/
    2015-05-05 15:43:45,200 30353 INFO ? openerp: OpenERP version 6.1
    2015-05-05 15:43:45,201 30353 INFO ? openerp: addons paths: /opt/openerp/runver/addons,/opt/openerp/runver/web/addons
    2015-05-05 15:43:45,201 30353 INFO ? openerp: database hostname: localhost
    2015-05-05 15:43:45,201 30353 INFO ? openerp: database port: 5432
    2015-05-05 15:43:45,201 30353 INFO ? openerp: database user: openerp
    2015-05-05 15:43:45,201 30353 INFO ? openerp.service.netrpc_server: starting NET-RPC service on 0.0.0.0:8070
    2015-05-05 15:43:45,201 30353 INFO ? openerp.netsvc: Starting 1 services
    2015-05-05 15:43:45,215 30353 INFO ? openerp.wsgi.core: HTTP service (werkzeug) running on 0.0.0.0:8069
    2015-05-05 15:43:45,241 30353 INFO ? openerp.addons.web: embedded mode
    2015-05-05 15:43:45,343 30353 CRITICAL ? openerp.modules.module: Couldn't load module web
    2015-05-05 15:43:45,343 30353 CRITICAL ? openerp.modules.module: cannot import name model
    2015-05-05 15:43:45,343 30353 ERROR ? openerp: Failed to load server-wide module `web`.
    The `web` module is provided by the addons found in the `openerp-web` project.
    Maybe you forgot to add those addons in your addons_path configuration.
    Traceback (most recent call last):
    File "./openerp-server", line 252, in
    openerp.modules.module.load_openerp_module(m)
    File "/opt/openerp/runver/server/openerp/modules/module.py", line 419, in load_openerp_module
    getattr(sys.modules['openerp.addons.' + module_name], info['post_load'])()
    File "/opt/openerp/runver/web/addons/web/__init__.py", line 33, in wsgi_postload
    app = common.http.Root(o)
    File "/opt/openerp/runver/web/addons/web/common/http.py", line 453, in __init__
    static_dirs = self._load_addons(openerp_addons_namespace)
    File "/opt/openerp/runver/web/addons/web/common/http.py", line 523, in _load_addons
    m = __import__('openerp.addons.' + module)
    File "/opt/openerp/runver/server/openerp/modules/module.py", line 139, in load_module
    mod = imp.load_module('openerp.addons.' + module_part, f, path, descr)
    File "/opt/openerp/runver/addons/hw_proxy/__init__.py", line 22, in
    import controllers
    File "/opt/openerp/runver/addons/hw_proxy/controllers/__init__.py", line 1, in
    import main
    File "/opt/openerp/runver/addons/hw_proxy/controllers/main.py", line 19, in
    from openerp import http
    File "/opt/openerp/runver/server/openerp/http.py", line 42, in
    from openerp.service import security, model as service_model
    ImportError: cannot import name model
    2015-05-05 15:43:45,344 30353 INFO ? openerp: OpenERP server is running, waiting for connections...

    I tried to import the module from python interpreter too and certainly it can’t find it.


    $ ipython
    Python 2.7.9 (default, Mar 1 2015, 12:57:24)
    Type "copyright", "credits" or "license" for more information.

    IPython 2.3.1 -- An enhanced Interactive Python.
    ? -> Introduction and overview of IPython's features.
    %quickref -> Quick reference.
    help -> Python's own help system.
    object? -> Details about 'object', use 'object??' for extra details.

    In [1]: from openerp.service import security

    In [2]: from openerp.service import module
    ---------------------------------------------------------------------------
    ImportError Traceback (most recent call last)
    in ()
    ----> 1 from openerp.service import module

    ImportError: cannot import name module

    Any help would be greatly appreciated.
    Thanks.

Leave a Reply

XHTML: You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>