Installation PostgreSQL 9 + OpenERP 6 server on Ubuntu 10.10
OpenERP vertsion 6 with PostgreSQL 9 installation guide for Ubuntu 10.10 desktop OS
1. PostgreSQL installation
The first step in getting OpenERP v.6 up and running is installation of PostgreSQL server. IN my case, I simply opened PostgreSQL in google search and selected the page for the postgresql downloads. You can easily choose the package which is suitable for your installation. There are 2 choices as follows:
- A debian package from Ubuntu repository for PostgreSQL 8.4 x64.
- A debian package from OpenSCG repository gives you PostgreSQL 9 x64.
In order to add value in my guide, I decided to use the PostgreSQL version 9
In such a case, you can find the debian package on the page of PostgreSQL downloads for Ubuntu and debian packages choice.
After you downloaded the package, double click on it started Ubuntu software center with the button Install for the package. Click install, and you get PostgreSQL installed.
To start PostgreSQL, you are to run the script from here:
sudo /etc/init.d/postgres-9.0-openscg start
The code not only starts the server but asks you several questions as follows:
- Specify PostgreSQL server port [5432]:
- specify superuser password [password]:
which is postgres by default - Do you want PostgreSQL server to be started on boot (y/n) [y]:
As soon as you are done with answers, it makes several configuration steps and runs the PostgreSQL 9 server.
PostgreSQL configuring
As soon as you started the PostgreSQL 9 server, you are to configure it to work with the OpenERP server. You might need to use the PostgreSQL administration application which is called pgAdmin III and you can install it from Ubuntu repository by using the Ubuntu Software Center.
Check Ubuntu account creation for PostgreSQL
The default superuser for PostgreSQL is called postgres. You may need to check existence of the login in "System->Administration->Users and Groups". If there is the user with postgres than the part of the initialization of the server went well.
Check the installation
First of all, you are to check the server is started. You might need to check running processes for the server in the Ubuntu system monitor.
Notes: To run the system monitor, you can simply add on a gnome panel the "system monitor" applet and the clicking on it runs the system monitor, but don't forget to select "show all processes" in "view" menu of the system monitor application.
Creation a database superuser for OpenERP tables
You need to login as postgres user first.
sudo su postgres
Now create PostgreSQL user openerpusr using the following command:
createuser openerpusr
Make this new user as superuser. Only after this you can create a database using OpenERP Client. In short, openerpusr is the new user created in PostgreSQL for OpenERP. This user is the owner of all the tables created by OpenERP Client.
Now check the list of tables created in PostgreSQL using following command:
psql -l
To select the table template1, run the following command:
psql template1
Specify that the user is superuser and specify the password by the following command:
alter role openerpusr with password 'your_password';
Notes: Don't forget the final char ;, and if everything is ok, the system responds as follows:
ALTER ROLE
Alternative method
In case you cannot find it you might need to create it manually by typing in the terminal the following command:createuser --createdb --username postgres --no-createrole --pwprompt openerpusr
where parameters explanations are as follows:
- createdb: the new user will be able to create new databases
- username postgres: createuser will use the postgres user (superuser)
- no-createrole: the new user will not be able to create new users
- pwprompt: createuser will ask you the new user’s password
- openerpusr: the new user’s name
Using pgAdmin
After the database superuser creation, you can configure pgAdmin III application. Simply start it from Ubuntu start menu "Application->Programming", click on the left top icon in the tool bar or select "File->Add Server" in the application menu. In appeared dialog box you are to specify the connection name, the server name (it is localhost if you use the pgAdmin on the server), the default port to connect to the server, the user name (as we just created openerpusr) and the database user_password, click "Ok" and if you specified all correct parameters you are connected with the server.
OpenERP installation
Starting from v.6, you can find a deb package on OpenERP downloads page for OpenERP server. Simply click on it, download, and run it. "Ubuntu Software Center" asks you for confirmation and install the OpenERP server then.
Configuring OpenERP Server to run as service (diamon)
You might need to configure your new OpenERP server installation. First of all, you need to run nautilus program in sudo mode by run it (to get "run program" click Alt+F2 and type here the following command:
gksu nautilus
Now you are to go to the following folder:
/etc/init.d
You are to find a file which is entitled as openerp-server, double click on it and startediting it in gedit. You are to change slightly the file as follows:
- Change the path for logs;
- Change the default user name from openerp to the one you use above as the database superuser;
- Change diamond file as follows: /etc/init.d/openerp-server
The server cannot be started as diamond out of the box as additional setting are required. Let's start with the daemon file /etc/init.d/openerp-server. You are to select the file in the nautilus window you opened as gksu on the previous step, double click allows opening the file on edit.
You need to add 3 strings in the parameters definition as follows:
- configuration file path and name,
- the log file path and name,
- and add the database superuser.
Simply replace the code in the original file as follows:
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/openerp-server
NAME=openerp-server
DESC=openerp-server
USER=openerp
by the following code:
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/openerp-server
NAME=openerp-server
DESC=openerp-server
CONFIGFILE=/etc/openerp-server.conf
LOGFILE=/var/log/openerp/openerp-server.log
USER=openerp
DBUSER=openerpusr
Now you are to change the code which starts the servers. IN order to get the server up and running, replace the original code as follows:
echo -n "Starting ${DESC}: "
start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \
--chuid ${USER} --background --make-pidfile \
--exec ${DAEMON} -- --config=/etc/openerp-server.conf \
--logfile=/var/log/openerp/openerp-server.log
by slightly changed, where we use the DBUSER, we change the log file path and specify explicitly the configuration file as follows:
echo -n "Starting ${DESC}: "
start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \
--chuid ${USER} --background --make-pidfile \
--exec ${DAEMON} -- --config=${CONFIGFILE} \
--db_user=${DBUSER} \
--logfile=${LOGFILE}
And finally, you are to change in the same way the code which is responsible for the daemon restart, where the original code as follows:
start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \
--chuid ${USER} --background --make-pidfile \
--exec ${DAEMON} -- --config=/etc/openerp-server.conf \
--logfile=/var/log/openerp/openerp-server.log
is replaced by the following code:
start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \
--chuid ${USER} --background --make-pidfile \
--exec ${DAEMON} -- ${DAEMON_OPT} \
--db_user=${DBUSER} \
--logfile=${LOGFILE}
Finally, create a folder openerp in /var/log/ and create the file by the following commands:
sudo mkdir /var/log/openerp
sudo touch /var/log/openerp/openerp-server.log
sudo chown -R openerp:openerp /var/log/openerp/
Changing server configuration file
Normally, only things you are to change in the configuration file are as follows:
- server,
- the database user,
- server port,
- and database password for the database superuser.
Make all required changes in the file which should be as it was specified in the daemon file here:
/etc/openerp-server.conf
Notes: in some cases, you might need to specify 127.0.0.1 instead of localhost due to problems with DNS name resolution.
Before you finish...
You are to check the status of your installation before you even try to start the service, in order to be sure everything is ok, start your server from the command line by specifying the following command in the Terminal:
/usr/bin/openerp-server --pidfile /var/run/openerp-server.pid openerp --config=/etc/openerp-server.conf --db_user=openerpusr --logfile=/var/log/openerp/openerp-server.log
If everything works fine, you can start your service as follows:
sudo /etc/init.d/openerp-server start

