Install Open ERP 7 on Ubuntu 12.04/12.10 and Fedora 18/19

openerp-7Open ERP is an awesome ERP solution available in Open source world. Recently they introduced the latest version 7.0. You can try the erp on openerp.comThe latest version comes with very nice interface and good functionality. The Opensourcer wrote a good post to how to install it on Ubuntu. Here is an extension how to install it on fedora also.

The new Open ERP 7 comes with numerous improvements like completely rewritten UI, Integration of social network capabilities, integration with Google Docs and LinkedIn, new Contract Management, new Event Management, new Point of Sale, new Address Book, new Fleet Management etc.. You can read the complete changes on  7.0 Release Notes extend to over 90 pages! .

There are rpms, debs and exes are available for Open ERP 7. The basic installation needs just download them and install them with necessary dependencies but it restricts our flexibility to modify & customize. To get more control over the server and client it is better to install it from the source available.

1. Setup the Server

The very first thing is to setup the server with ssh server and client. So we can connect to the server remotely. Just install the openssh-server package (so we can connect to it remotely) and denyhoststo add a degree of brute-force attack protection. There are other protection applications available.

Fedora 18: On fedora the sshd is installed by default. if not you can install with

yum install openssh openssh-server

Ubuntu 12.04 : just install the server with apt

sudo apt-get install openssh-server denyhosts

It is not necessary to reboot. But for safer side just reboot the server.

2. Create Open ERP User to run the Open ERP Server 

Creating user called openerp to run the server. This user is a system user.

Ubuntu 12.04:

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

Fedora 18: in fedora also the adduser command is the same just run it on root prompt.

su -c
groupadd openerp
adduser openerp --system --home-dir=/opt/openerp -g openerp

This is a “system” user. It is there to own and run openerp server, 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 the user created with 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.

[Note: If you want to run multiple versions of OpenERP on the same server, the way I do it is to create multiple users with the correct version number as part of the name, e.g. openerp70, openerp61 etc. If you also use this when creating the Postgres users too, you can have full separation of systems on the same server. I also use similarly named home directories, e.g. /opt/openerp70, /opt/openerp61 and config and start-up/shutdown files. You will also need to configure different ports for each instance or else only the first will start.]

A question I have been asked a few times is 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.

3. Install and configure the database server, PostgreSQL

The next step is to install and configure the database server. Openerp is using PostgreSQL as the database. So just install and configure postgresql database on you system.

In Fedora :

install postgresql server

su -
yum install postgresql postgresql-server postgresql-test

In Ubuntu:

sudo apt-get install postgresql

Then configure the OpenERP user on postgres:

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

In Fedora:

su -
su postgres

In Ubuntu:

sudo su - postgres

Now initialize the postgresql server database with initdb. Then only you can start the postgresql server successfully.

Fedora :

initdb

Ubuntu :

/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data

More Details about Postgresql starting in ubuntu

will give you the details

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

fixing permissions on existing directory /var/lib/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 24MB
creating configuration files ... ok
creating template1 database in /var/lib/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

Just start the postgresql server

postgres -D /var/lib/pgsql/data

OR

you can exit from postgres terminal and login to root terminal and start the postgresql server.

Fedora :

exit
su -
service postgresql start

Ubuntu :

sudo -s
/etc/init.d/postgresql-8.2 start

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:

su postgres

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

4. Install the necessary Python libraries for the server

Now install necessary python dependencies and libraries for running the Open ERP Server.

In Ubuntu install :

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

In Fedora Install:

su -

yum install python-dateutil python-docutils python-feedparser python-gdata \
python-jinja2 python-ldap libxslt-python python-lxml python-mako python-mock python-openid \
python-psycopg2 python-psutil python-babel pychart pydot python3-pyparsing \
python-reportlab python-simplejson python-dateutil python-unittest2 python-vatnumber python-vobject \
python-webdav-library python-werkzeug python-xlwt python-yaml python-ZSI

With that done, all the dependencies for installing OpenERP 7.0 are now satisfied (note that there are some new packages required since 6.1). It take some time to parse all the dependencies and installing all these packages.

5. Install the OpenERP server

Now just download the latest Open ERP Source Tarball from the official website. http://nightly.openerp.com/7.0/nightly/ providing all the files. May be this will change on future. On src just download the latest tar ball.

Here we are using a wget to download that tarball. You can point your browser and download the files.

Note: As an alternative method of getting the code onto your server, Jerome added a very useful comment showing how to get it straight from launchpad. Thanks!

Fedora :

su –

wget http://nightly.openerp.com/7.0/nightly/src/openerp-7.0-latest.tar.gz

Ubuntu

sudo wget http://nightly.openerp.com/7.0/nightly/src/openerp-7.0-latest.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-7.0-latest.tar.gz

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

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-7.0 server

As an example, should OpenERP 7.0.1 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 7.0 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.

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 linedb_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

OR

vi /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.

In Fedora everything working fine after the above step but on Ubuntu there may be a problem like below.

On my system I noticed the following warning:

2012-12-19 11:53:51,613 6586 WARNING ? openerp.addons.google_docs.google_docs: Please install latest gdata-python-client from http://code.google.com/p/gdata-python-client/downloads/list

The Ubuntu 12.04 packaged version of the python gdata client library is not quite recent enough, so to install a more up-to-date version I did the following (exit from the openerp user’s shell if you are still in it first):

sudo apt-get install python-pip
sudo pip install gdata --upgrade

Going back and repeating the commands to start the server resulted in no further warnings

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

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

Otherwise simply enter CTL+C to stop the server and then exit to leave the openerp user account and go back to your own shell.

If no errors point your browser to http://IP_ADDRESS:8069 will give you openerp databse setup and login screen.

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 7.0.

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

 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…

Open ERP Databse Management Screen
Open ERP Databse Management Screen

OpenERP 7 Database Management 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 (it is the Database Management Screen because you have no OpenERP databases yet):

What I do recommend you do at this point is to change the super admin password to something nice and strong (Click the “Password” menu). 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.

9. Automating OpenERP startup and shutdown

Open ERP Modules
Open ERP Modules

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.

OpenERP 70 Main Setup Screen

That’s it! Next I would suggest you create a new database filling in the fields as desired. Once the database is initialised, you will be directed straight to the new main configuration screen which gives you a fell for the new User Interface in OpenERP 7 and shows you how easy it is to set up a basic system.

 

My Logs

I tried these step on an Ubuntu and Fedora machines and working fine. Here are my bash logs for fedora

Open ERP 7 on Fedora 18 Bash prompt

Open ERP Setup Server, Databae on Fedora 18

Share your experience.

Enhanced by Zemanta

3 comments

  1. Everything works fine until you try to start the service with the script you have to download:

    [[email protected] init.d]# /etc/init.d/openerp-server start
    Starting openerp-server: /etc/init.d/openerp-server: line 46: start-stop-daemon: command not found
    openerp-server.

    It looks like the init script is not Fedora compatible as the start-stop-daemon is very Debian, not Fedora 🙁

Leave a Reply