Installing OpenERP 7.0 on Fedora 20

      2 Comments on Installing OpenERP 7.0 on Fedora 20

OpenERP is a free an open-source enterprise resource planning (ERP) software. It’s written in Python and makes heavy use of JavaScript and XML and runs completely in that runs in your browser.

0. Installation prerequisites

OpenERP needs a PostgreSQL database backend and a load of python modules. So here’s a handy one-liner to install (hopefully) all required packages at once:

# 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 python3-pytz pytz tar wget

1. Create an OpenERP user

Running a service as root is usually a bad idea. So we create an OpenERP user and group solely for the purpose of running the openerp service:

# groupadd openerp
# adduser openerp --system --home-dir=/opt/openerp -m -g openerp

2. Set up the PostgreSQL database

OpenERP uses a PostgreSQL database backend so the next step is to install and configure the PostgreSQL server.

# yum install postgresql-server

We now need to initialize the cluster with the initdb command

# su - postgres
-bash-4.2$ initdb
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

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

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
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
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    postgres -D /var/lib/pgsql/data
    pg_ctl -D /var/lib/pgsql/data -l logfile start

While we are already logged in as the postgres-user we can also add a database dedicated to OpenERP and a corresponding database user that has access rights to PostgreSQL and can create and drop databases. Eventually you can exit from the postgres user account.

-bash-4.2$ createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt openerp
Enter password for new role: 
Enter it again: 
-bash-4.2$ exit

Finally, enable and start the postgresql service:

# systemctl enable postgresql.service 
ln -s '/usr/lib/systemd/system/postgresql.service' '/etc/systemd/system/'
# systemctl start postgresql.service

3. Install the OpenERP server

Get the nightly tarball

Since OpenERP 7.0 is not officially released yet, there’s no source tarball and we have to take potluck with the nightly source tarball:

# wget
# tar xvfz openerp-7.0-latest.tar.gz -C /opt/openerp/
# chown -R openerp:openerp /opt/openerp

Configure OpenERP

There is a sample configuration file in /opt/openerp/openerp-7.0-*/install/ called openerp-server.conf which is rather minimalistic but will work just fine with one minor adjustment.

First, we make a copy and change the file ownership and permission:

# cp /opt/openerp/openerp-7.0-*/install/openerp-server.conf /etc/
# chown openerp:openerp /etc/openerp-server.conf 
# chmod 640 /etc/openerp-server.conf

And then open the file with an editor to change the db_password

; This is the password that allows database operations:
; admin_passwd = admin
db_host = False
db_port = False
db_user = openerp
db_password = openerp

Add a systemd unit file

To start OpenERP automatically when the host is booted, we add a systemd unit file with the following content. Note that you have to specify the full path to your OpenERP installation in the ExecStart variable

Description=Advanced OpenSource ERP and CRM server
ExecStartPre=/usr/bin/install -d -m755 -o openerp -g openerp /run/openerp
ExecStart=/<path-to-openerp>/openerp-server -c /etc/openerp-server.conf --pid=/run/openerp/ --syslog $OPENERP_ARGS
ExecStop=/bin/kill $MAINPID

The last thing, left to do is enabling and starting up the service:

# systemctl enable openerp.service 
ln -s '/usr/lib/systemd/system/openerp.service' '/etc/systemd/system/openerp.service'
ln -s '/usr/lib/systemd/system/openerp.service' '/etc/systemd/system/'
# systemctl start openerp.service

OpenERP should now be reachable at http://localhost:8069.

2 thoughts on “Installing OpenERP 7.0 on Fedora 20

  1. avatarChris Klinger

    One of the most well thought-out tuts I’ve seen. Nothing forotten, nothing assumed… Great job!
    Thank you!

  2. avatarysagon

    It is working fine, thanks.

    At the step where you create a pg user, you need to have first pg server started.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.