Thursday, June 18, 2009

Wednesday, June 17, 2009

Installation of OpenERP Server 5.0, OpenERP GTK Client 5.0 and OpenERP Web Client 5.0.1 on Ubuntu Server 9.0.4

This article will show you how to set up openerp-server 5.0.0-3-1 + openerp-client 5.0.0-3-1 + openerp-web 5.0.1 for Ubuntu Server 9.0.4

Introduction

Open ERP (formerly named Tiny ERP) is the leader open-source ERP/CRM system written mostly in Python and initiated in Belgium. It offers a three-tier web architecture, ease of use and flexibility.

With more than 1000 downloads per day, Open ERP is the most admired and the world's fastest growing and used free open source management software solution in the world. Small and medium sized companies are now encouraged to use ERP.

Open ERP is very modular, each adoption produces new modules. So they can be installed optionally or not, depending on the need of each enterprise. More than 350 modules of different kinds are available: accounting, finance, stock management, manufacturing, services management, customer relations, sales, project management, document management, internal organization, human resources, direct marketing, e-commerce, point of sale, payroll,... And about 10-20 modules are produced monthly!

For Open Source software, experience has shown that there’s no need to train users for several months on the system, because they can just download it and use it directly. To make this process of learning fast and effective, Open ERP has taken several steps with its large partner network and community e.g. Forum and IRC which are platforms to discuss common topics among community and get help, Open ERP Planet is used to announce new developments in Open ERP, Launchpad is a unique collaboration and Bazaar code hosting platform for software projects. Other then these, detail Documentation is available which serve as a guide to understand and get started with Open ERP.

The latest version of OpenERP (5.0) was released in February 10th 2009. Canonical's Ubuntu 9.0.4 is the first Linux distribution that provides this release. We will probably have to wait a few months until other distributions (Fedora 12, OpenSuSE 11.3, CentOS, etc) ease the latest updates of OpenERP 5.x. Nevertheless, all these major distributions already offer tinyerp-server and client release 4.2.3 (without including openerp-web).

Major troubles during the setting up

The most complicated part is with openerp-web 5.0.1 because of its dependency on TurboGears 1.0.8 . TurboGears 1.0.8 is not supported with the default Ubuntu 9.04 python version (python2.6)

OpenERP Web client 5.0.2 is still under development. This release is being migrated to CherryPy3 dropping the TurboGears framework as a major step to make the Web Client much more faster and easier to deploy. This will greatly reduce the pain of getting started with and deploying of OpenERP Web client. The number of third party dependencies will be reduced to 3-4 pure Python libraries. The initial test results offer almost 3-5 time speed improvement.

The default openerp-server and openerp-web INIT scripts cannot launch their corresponding services as non-root without fixing some technical issues. I will detail what configuration files and scripts have to be modified to avoid this.

Technical procedure. Initial installation and configuration

Upgrade of Ubuntu packages and installation of openerp and pgadmin:

$ sudo apt-get update

$ sudo apt-get upgrade

$ sudo apt-get install openerp-server openerp-client pgadmin3

Postgres Database configuration:

$ sudo vim /etc/postgresql/8.3/main/pg_hba.conf

Replace the following line:

# "local" is for Unix domain socket connections only
local all all ident sameuser

with:

#"local" is for Unix domain socket connections only
local all all md5

Restart Postgres:

$ sudo /etc/init.d/postgresql-8.3 restart

* Restarting PostgreSQL 8.3 database server [ OK ]

Create a user account called openerp with password “openerp” and with privileges to create Postgres databases:

$ sudo su postgres

$ createuser openerp -P

Enter password for new role: (openerp)

Enter it again:

Shall the new role be a superuser? (y/n) n

Shall the new role be allowed to create databases? (y/n) y

Shall the new role be allowed to create more new roles? (y/n) n

Quit from user postgres

$ exit

exit

Edit OpenERP configuration file:

$ sudo vi /etc/openerp-server.conf

Replace the following two lines (we don't force to use a specific database and we add the required password to gain access to postgres):

db_name =

db_user = openerp

db_password = openerp

Troubles with Python releases: Python 2.6 is not yet supported by OpenERP 5.0, but it is the default Python release on Ubuntu 9.0.4. We need to launch OpenERP 5.0 with Python 2.5 or earlier. There's also a problem with python-xml package in Ubuntu so we will reinstall it.

Python 2.5 setting up:

$ sudo apt-get install python2.5 python2.5-dev

Reinstall python-xml:

$ wget http://freefr.dl.sourceforge.net/sourceforge/pyxml/PyXML-0.8.4.tar.gz

$ tar xvzf PyXML-0.8.4.tar.gz

$ cd PyXML-0.8.4/

$ sudo python2.5 setup.py install

Make the following symbolic link:

$ sudo ln -s /usr/lib/python2.6/dist-packages/oldxml/_xmlplus/utils/boolean.so /usr/lib/python2.5/site-packages/oldxml/_xmlplus/utils/

Force openerp-server to be launched with Python2.5:

$ cd /usr/bin/

$ sudo cp openerp-server openerp-server.ORIG

$ sudo vi openerp-server

Replace the following line:

exec /usr/bin/python ./openerp-server.py $@

with

exec /usr/bin/python2.5 ./openerp-server.py $@

We can now restart openerp-server:

$ sudo /etc/init.d/openerp-server restart

Restarting openerp-server: openerp-server.

Check out the logs:

$ sudo cat /var/log/openerp.log

[2009-06-14 21:06:39,314] INFO:server:version - 5.0.0

[2009-06-14 21:06:39,314] INFO:server:addons_path - /usr/lib/openerp-server/addons

[2009-06-14 21:06:39,314] INFO:server:database hostname - localhost

[2009-06-14 21:06:39,315] INFO:server:database port - 5432

[2009-06-14 21:06:39,315] INFO:server:database user - openerp

[2009-06-14 21:06:39,315] INFO:objects:initialising distributed objects services

[2009-06-14 21:06:39,502] INFO:web-services:starting XML-RPC services, port 8069

[2009-06-14 21:06:39,502] INFO:web-services:starting NET-RPC service, port 8070

[2009-06-14 21:06:39,502] INFO:web-services:the server is running, waiting for connections...

OpenERP is now up and running, connected to Postgres database on port 5432 and listening on ports 8069 and 8070

$ ps uaxww | grep -i openerp

root 10260 0.2 2.3 186952 23756 ? S

$ sudo lsof -i :8069

COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME

python2.5 2276 openerp 3u IPv4 6515 TCP localhost:8069 (LISTEN)

$ sudo lsof -i :8070

COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME

python2.5 2276 openerp 5u IPv4 6520 TCP *:8070 (LISTEN)

Creation of a new database for OpenERP Server with OpenERP GTK Client

Launch openerp-client and create a new database for openerp-server:

$ openerp-client

File/Archivo -> Databases/Bases de Datos -> New Database/Nueva Base de Datos






Super-administrator password: “admin”
New database name: "openerp"
Administrator password: “openerp”
Confirm password: "openerp"















If the previous window gets frozen, just kill it and restart openerp-client in case you want to connect to the already created openerp database.

Fixing OpenERP Server INIT script bug

$ sudo vi /etc/openerp-server.conf

Comment or remove the following line:

# The file where the server pid will be stored (default False).
#pidfile = /var/run/openerp.pid

Edit the init script:

$ sudo vi /etc/init.d/openerp-server

Add the following line to the beginning of the init script:

USER=openerp

Setting up OpenERP Web client

The most complicated part is with openerp-web because TurboGears 1.0.8 is not supported with the default Ubuntu 9.04 python version (python2.6). Basically we want to avoid the following error:

$ sudo easy_install -U openerp-web
Running openerp-web-5.0.1-0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-SJE_07/openerp-web-5.0.1-0/egg-dist-tmp-NFndZn
Error: python-xml >= 0.8.4 (PyXML, XML Tools for python) is required.
error: Setup script exited with 1

Then, to use easy_install for python2.5:

$ sudo apt-get install python2.5-setuptools

You must remove the default soft link to easy_install2.6

$ sudo rm /usr/bin/easy_install

Then create the new soft link to easy_install2.5:

$ sudo ln -s /usr/bin/easy_install-2.5 /usr/bin/easy_install

Install TurboGears 1.0.8

$ sudo easy_install TurboGears==1.0.8

Check whether TurboGears is properly installed or not...

$ tg-admin info

Make sure the following file does not exist:

$ sudo rm /usr/local/bin/easy_install

Install openerp-web:

$ sudo easy_install -U openerp-web

...

Adding openerp-web 5.0.1-0 to easy-install.pth file

Installing start-openerp-web script to /usr/bin

Installed /usr/lib/python2.5/site-packages/openerp_web-5.0.1_0-py2.5.egg

Processing dependencies for openerp-web

Finished processing dependencies for openerp-web

Locate the config/default.cfg in the installed EGG, and make appropriate changes, especially:

$ cd /usr/lib/python2.5/site-packages/openerp_web-5.0.1_0-py2.5.egg

$ sudo vi config/default.cfg

# OpenERP SERVER
[openerp]
host = 'localhost'
port = '8070'
protocol = 'socket'

Restart postgres and opener-server:

$ sudo /etc/init.d/postgresql-8.3 restart

* Restarting PostgreSQL 8.3 database server [ OK ]

$ sudo /etc/init.d/openerp-server restart

Restarting openerp-server: openerp-server.

Openerp-web run as service (non-root daemon)

$ sudo cp /usr/lib/python2.5/site-packages/openerp_web-5.0.1_0-py2.5.egg/scripts/openerp-web /etc/init.d/

$ sudo cp /usr/lib/python2.5/site-packages/openerp_web-5.0.1_0-py2.5.egg/config/default.cfg /etc/openerp-web.cfg

$ sudo chmod +x /etc/init.d/openerp-web

$ sudo vi /etc/init.d/openerp-web

# Specify the user name (Default: terp).
USER=openerp

$ sudo vi /etc/openerp-web.cfg

Replace:

[[[access_out]]]
# set the filename as the first argument below
args="('server.log',)"

With:

[[[access_out]]]
# set the filename as the first argument below
args="('/var/log/openerp-web.log',)"

Create /var/log/openerp-web.log with proper ownership

$ sudo touch /var/log/openerp-web.log

$ sudo chown openerp /var/log/openerp-web.log

Now run following command to start the OpenERP Web automatically on system startup (Debian/Ubuntu):

$ sudo update-rc.d openerp-web start 70 2 3 4 5 . stop 20 0 1 6 .

Now start the web server with start-openerp-web command:

$ start-openerp-web

If everything is fine, open your favourite web browser and type http://localhost:8080 (or http://your_ubuntuserver_ip_adress:8080), and you can see welcome page with login screen.

Please make sure cookies are enabled in your browser.

Fixing openerp-web init script bug

$ sudo mkdir /home/openerp

$ sudo chown openerp.nogroup /home/openerp

HTTPS with Apache

$ sudo apt-get install apache2

$ sudo a2enmod ssl

$ sudo a2ensite default-ssl

$ sudo /etc/init.d/apache2 restart

Forcing Apache to redirect HTTP traffic to HTTPS

Choose a ServerName/URL for your OpenERP Web service, like openerpweb.com:

$ sudo vi /etc/apache2/sites-available/default

<VirtualHost *:80>
ServerName openerpweb.com
Redirect / https://openerpweb.com/
....
....
</VirtualHost>

$ sudo a2enmod proxy

$ sudo a2enmod proxy_http

$ sudo a2enmod proxy_connect

$ sudo a2enmod proxy_ftp

Add your server's IP address and URL in /etc/hosts:

$ sudo vi /etc/hosts
Replace
127.0.0.1 localhost
127.0.0.1 yourhostname
With

127.0.0.1 localhost
192.168.x.x openerpweb.com yourhostname


$ sudo vi /etc/apache2/sites-available/default-ssl

<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName openerpweb.com
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
....
</VirtualHost>

Restart Apache:

$ sudo /etc/init.d/apache2 restart

Check out your URL with a browser : http://openerpweb.com

Block OpenERP Web server port 8080 with a firewall

Do it locally as the first command will close all the existing ssh connections:

$ sudo ufw enable

$ sudo ufw allow ssh

$ sudo ufw allow http

$ sudo ufw allow https

Add the following lines:

$ sudo vi /etc/openerp-web.cfg

base_url_filter.on = True
base_url_filter.use_x_forwarded_host = False
base_url_filter.base_url = "https://openerpweb.com"

Restart openerp-web:

$ sudo /etc/init.d/openerp-web restart

Check out again your server's URL http://openerpweb.com

Administrator: admin / openerp

Demo user: demo / demo

Restart the server with “sudo init 6” and make sure that all the openerp processes are started automatically as non-root

References & Demo Server

OpenERP Video guides can be found at http://www.openerp.tv

A demo server can be found at https://openerp.zikzakmedia.com , with the following users and passwords:

demobase/demobase
demoventas/demoventas
democompras/democompras
democonta/democonta


Sunday, June 7, 2009

How cell phones will replace learning

I've just finished reading an interesting article on the ComputerWold.com Magazine. I strongly recommend its reading, as it deals with the subject of the coming Web 3.0 linked to the future of the services offered by the cell phones. This reading is a must!

Friday, June 5, 2009

OpenSolaris 2009.06

Even though I am a big fan of Linux based Enterprise Solutions, I'm also keen on all the different flavours of Unix. I would like to pay special attention to the latest OpenSolaris update that includes major improvements alligned with the keys that made Linux successful along with Intel enterprise-class servers.

I've tested it out on a virtual machine and I have to admit that its brandnew installation process is quite similar to the easiest deployment of Linux: a LiveCD with OpenSolaris 20009.06 allows you to give it a try without the need of carrying out the setting up.

Both networking and performance have been improved by including Project Crossbow, which is Sun's network architecture for virtualisation. Crossbow's goal is to ease administration of complex deployments.

The OpenSolaris Packaging System can be easily administered by a GUI in a similar way to most popular Linux distributions.

OpenSolaris 2009.06 also includes a new version of Sun's ZFS file system, which now supports flash storage devices. Flash-based storage can be used to accelerate read and write access to build high-performance storage systems and simplify its administration with ZFS.

Further information can be found here

Thursday, June 4, 2009

Intel buys Wind River to push Linux

Intel Corp.'s acquisition of Wind River on Thursday is a strong push by the chip maker to extend Linux support across devices that use its processors, analysts said.
Intel agreed to buy Wind River for $884 million. The acquisition should help both Intel's prominence in the Linux space and its efforts to push the OS in smartphones and mobile Internet devices, analysts said. Wind River offers embedded Linux operating systems and is a leader in software design tools for devices such as smartphones.

Wednesday, May 20, 2009

Wednesday, April 22, 2009

Open Source Activity Map

Red Hat announces the release of the "Open Source Index," A study to compare and contrast open source activity across 75 countries:

http://www.redhat.com/about/where-is-open-source/activity/