Monday, June 27, 2011

Installing and using Openerp on Ubuntu

This post explains the Openerp  benefits & its detailed installation procedure.


Ever growing business  demands  ...
    • Aggressive Cost control initiatives
    • Need to analyze costs / revenues on a product or customer basis
    • Flexibility to respond to changing business requirements
    • More informed management decision making
    • Changes in ways of doing business


Enterprise Resource Planning software which will offer an integrated software solution to all the functions of an organisation.
 
Broadly, ERP covers following main areas.
    • Sales and Marketing
    • Calander Scheduling
    • Material Requirement Planning
    • Capacity Requirement Planning
    • Bill of Materials
    • Purchasing
    • Expense r control
    • Accounts Payable/Receivable
    • Logistics
    • Asset Management
    • Financial Accounting
 ERP Benefits

  • Gives Accounts Payable personnel increased control of invoicing and payment processing and thereby boosting their productivity and eliminating their reliance on computer personnel for these operations.
  • Reduce paper documents by providing on-line formats for quickly entering and retrieving information.
  • Improves timeliness of information by permitting, posting daily instead of monthly.
  • Greater accuracy of information with detailed content, better presentation, fully satisfactory for the Auditors.
  • Improved Cost Control
  • Faster response and follow up on customers
  • More efficient cash collection, say, material reduction in delay in payments by customers.
  • Better monitoring and quicker resolution of queries.
  • Enables quick response to change in business operations and market conditions.
  • Helps to achieve competitive advantage by improving its business process.
  • Improves supply-demand linkage with remote locations and branches in different countries.
  • Provides a unified customer database usable by all applications.
  • Improves International operations by supporting a variety of tax structures, invoicing schemes, multiple currencies, multiple period accounting and languages.
  • Improves information access and management throughout the enterprise.

 
ERP is a high end sophisticated software solution that reduces the pressure and work load of the Managers and provides accurate, timely information for taking appropriate business decisions. 

In fact Managers are expected to translate the business rules and requirements for Mapping them into ERP software. Managers as representatives of the Organisation have to coordinate with Vendors, Consultants, Auditors etc., for a proper implementation of ERP package.

Reasons for choosing Openerp as ERP Platform:

Official Features of Openerp  Click : http://doc.openerp.com/v6.0/features/index.html

Open ERP features.**

Open ERP is very complete and extremely modular, with more than 350 available modules. 

The development and community efforts are managed through module distribution system known as Launchpad using the repository system Bazaar, however the main modules are available for installation directly from Open ERP user interface.

Multilingual approach in every aspect – user interface and information itself - this allows people work simultaneously with the same installation and on the same information in their native language.
The main features include:
  • management accounting,
  • financial accounting, 
  • inventory management, 
  • sales and purchase management, 
  • automation of tasks, 
  • Human Resource Management, 
  • marketing campaigns, 
  • help desk,
  • IT Resource Management,
  • Transport fleet management,
  • Recurring Invoice automation
  • complete modularity,
  • multilingual user interfaces,
  • multilingual information oriented design from the very beginning, 
  • multiplatform server and clients (Linux, MS Windows, MAC),
  • multiple user interfaces (several application clients along with web interface),
  • adaptable to the enterprise,



 ** http://www.alistek.com/index.php?option=com_content&view=article&id=55&Itemid=88&lang=lv

How to Install Open ERP ( Latest on Ubuntu ) locally for your office.


Reasons for Choosing Ubuntu as Operating System :

1.    No Cost  -- absolutely free. ( For server or Desktop )
2.    No issues of Viruses, malwares.
3.    Excellent Performance, Great Speed.
4.    Easy configuration.
5.    Fully Secured.
6.    User Friendly Operating System.
7.    Very Easy Install Process.
8.    No Drivers required for regular Hardware.
9.    Office Suite,  Multimedia, Video,  Internet tools everything is available...
10.  Easy connectivity with other operting systems - windows (all version), mac etc.


Procedure : 

A.  Basic Requirement :

     1.  Any Desktop / Laptop / Server ( Dual core or above will be suitable )
          ( Memory : 1 GB or Above  / Hard Drive 40 GB or Above with Lan Card )

     2. Download and install Ubuntu 11.04  ( Download Link :  http://www.ubuntu.com/download/ubuntu/download).

     3.  Active Internet connection.

B.  How to Openerp on Ubuntu Linux

This document presumes that you have installed Ubuntu Linux Desktop version ( preferably 64 bit ).  Well if you are running the Windows 7 and if you do not have spare system,  you can very well install virtualbox ( Download page link :  https://www.virtualbox.org/wiki/Downloads ) & withing virtualbox you install Ubuntu Linux without disturbing your Windows installation.  

[  Stage 1 :  Install openerp Server on Ubuntu ]


Start Ubuntu.  Open command Window (  Accessories --> Terminal )

1.  Install Database Manager [ Open ERP Requires Postgres ] by giving following command.

sudo apt-get install postgresql 
( enter your ubuntu user name and password if asked,  This applies everywhere ) 



Once it is installed  enter another command.

sudo apt-get install postgresql-client  
 
 
2.  edit /etc/postgresql/8.4/main/postgresql.conf 
 
 with your favorite editor and add following  line at the end of the file.

 
listen_addresses = '*' 
 
& save the file.
 


3.  Give following command in your terminal window.
 
cp  /etc/postgresql/8.4/main/pg_hba.conf   /etc/postgresql/8.4/main/pg_hba.conf.mybackup

Now  edit  /etc/postgresql/8.4/main/pg_hba.conf  
and make necessary changes in highlighted lines.


# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD 
 
# "local" is for Unix domain socket connections only
# MODIFY THE EXISTING LINE TO LOOK LIKE THIS:
local   all         all                               trust
# IPv4 local connections:
# MODIFY THE EXISTING LINE TO LOOK LIKE THIS:
host    all         all         127.0.0.1/32          trust
# ADD THIS LINE TO ALLOW REMOTE ACCESS; use your own IP address range:
host    all         all         10.10.10.0/24        trust
# IPv6 local connections:  You have to disable the IPv6 connections
# host    all         all         ::1/128               ident


Save the file and reboot your system.  ( Now onwards postgresql will start automatically )


Add an openerp user under which the openerp server can be run:
sudo adduser openerp
 
 
Set up a postgres user:
su - postgres
createuser --createdb --no-createrole --pwprompt openerp
Enter password for new role: .....
Enter it again: .....
Shall the new role be a superuser? (y/n) y
 
quit
 
Install the Python dependencies needed by OpenERP:    ( One by One command only )


apt-get install python python-psycopg2 python-reportlab

apt-get install python-egenix-mxdatetime python-tz python-pychart
 
apt-get install python-pydot python-lxml python-vobject python-setuptools

 

 
apt-get install python-mako
 
apt-get install python-yaml

easy_install PyYaml

Now Download Openerp Server Package from the following link :
http://www.openerp.com/download/stable/source/openerp-server-6.0.2.tar.gz
and save it to any directory of your choice.
( You can also access  the latest verson  by visiting  http://www.openerp.com/download/stable/source)  Or even simpler    download link is  http://nightly.openerp.com/6.0/releases/openerp-server-6.0-latest.tar.gz )

From terminal window go to directory where you have downloaded the above package and extract this using
tar xvf openerp-server-6.0.2.tar.gz
 
Once again go to terminal window ( Ctr + Alt + t ) 
 
cd ~/Downloads/openerp-server-6.0.2 

 
and press enter
 
 

at the prompt enter this command and press enter
 
su python setup.py install
 


Now the Openerp server is ready.
 
It can nowonwards run as 

sudo -u openerp openerp-server

Just for checking whether everything is okay till this stage.
If everything is fine you will get several lines indicating openerp server is up and running.  If not,  recheck once again.


Now Press Ctrl + C  to disconnect from Openerp Server.



We  need to some more work.

Create a new file in /home/openerp  using your text editor   like nano or joe etc.


sudo nano  /home/openerp/.openerp_serverrc   --- >Press enter  and copy / pest following text.

[options]
debug_mode =  True
logfile =  /var/log/openerp-server.log
log_level =  debug_rpc_answer
#############################################
# Uncomment the options that you want to override:
# email_from = False
# xmlrpc_interface =  ''    # this will bind the server to all interfaces
# xmlrpc_port =  8069
# netrpc_interface =  ''
# netrpc_port =  8070
# xmlrpcs_interface =  ''    # this will bind the server to all interfaces
# xmlrpcs_port =  8071
# db_host =  False
# db_port =  False
# db_name =  False
# db_user =  False
# db_password =  False
# db_maxconn =  64
# reportgz =  False
# netrpc =  True
# xmlrpc =  True
# xmlrpcs =  True
# translate_in =  None
# translate_out =  None
# overwrite_existing_translations =  False
# load_language =  None
# language =  None
# pg_path =  None
# admin_passwd =  'admin'
# csv_internal_sep =  ','
# addons_path =  None
# root_path =  None
# debug_mode =  False
# import_partial =  ""
# pidfile =  None
# logfile =  None
# logrotate =  True
# smtp_server =  'localhost'
# smtp_user =  False
# smtp_port = 25
# smtp_ssl = False
# smtp_password =  False
# stop_after_init =  False   # this will stop the server after initialization
# syslog = False
# log_level =  INFO
# Options for log-level are: ['info', 'debug_rpc', 'warn', 'critical', 'error', 'debug', 'notset', 'debug_rpc', 'debug_rpc_answer']
# debug_rpc_answer seems to be the highest level.
# assert_exit_level =  ERROR # level above which a failed assert will be raised
# cache_timeout =  100000
# login_message =  False
# list_db = True
# timezone = False # to override the default TZ
# test_file = False
# test_report_directory = False
# test_disable = False
# test_commit = False
# static_http_enable =  False
# static_http_document_root =  None
# static_http_url_prefix =  None
# secure_cert_file =  'server.cert'
# secure_pkey_file =  'server.pkey'
# publisher_warranty_url =  'http://services.openerp.com/publisher-warranty/'
#############################################




Save the file.


Change owner of the file  
sudo chown openerp:openerp /home/openerp/.openerp_serverrc


Now again reboot the system.

[  Stage 2 :  Installing Openerp web services to access the server  thru Browser ]

Next stage is to install the client to access openerp server


The most preferred way  to access openerp is thru a browser.


To accomplish this task you require to install following component on the same system where you have installed openerp server.  Once it is thru,  you can access the openerp from anywhere from your network thru any standard browser like mozilla firefox , chrome, opera or internet explorer.


1.  Open the terminal  and type following command.


sudo apt-get install python-dev build-essential
 
2.  Download following file from  


http://www.openerp.com/download/stable/source/openerp-web-6.0.2.tar.gz


( for latest http://nightly.openerp.com/6.0/releases/openerp-web-6.0-latest.tar.gz )



Now from terminal window go directory where you have saved above file and give following command.


sudo tar xvf openerp-web-6.0.2.tar.gz
cd openerp-web-6.0.2
sudo python setup.py install



From your favorite text editor create a new file named openerp-web.cfg  and save this file in /etc/directory.  [ sudo nano openerp-web.cfg ]



This file should contain following text ( You can copy and paste )


[global]
server.environment = "development"

# Some server parameters that you may want to tweak
server.socket_host = "0.0.0.0"
# server.socket_host = "127.0.0.1"
server.socket_port = 8080

# Sets the number of threads the server uses
server.thread_pool = 10

tools.sessions.on = True

# Simple code profiling
server.profile_on = False
server.profile_dir = "profile"

# if this is part of a larger site, you can set the path
# to the TurboGears instance here
#server.webpath = ""

# Set to True if you are deploying your App behind a proxy
# e.g. Apache using mod_proxy
#tools.proxy.on = True

# If your proxy does not add the X-Forwarded-Host header, set
# the following to the *public* host url.
#tools.proxy.base = 'http://example.com'

# logging
log.access_file = "/var/log/openerp-web/access.log"
log.error_file = "/var/log/openerp-web/error.log"

# OpenERP tools
tools.nestedvars.on = True

# OpenERP Server
openerp.server.host = 'localhost'  // or static ip of your server system
openerp.server.port = '8070'
openerp.server.protocol = 'socket'
openerp.server.timeout = 450

# Web client settings
[openerp-web]
# filter dblists based on url pattern?
# NONE: No Filter
# EXACT: Exact Hostname
# UNDERSCORE: Hostname_
# BOTH: Exact Hostname or Hostname_

dblist.filter = 'NONE'

# whether to show Databases button on Login screen or not
dbbutton.visible = True
 
 
& save this file.
 
 
Now you will need to create log file by giving following commands in terminal window.
 
mkdir /var/log/openerp-web
chown openerp /var/log/openerp-web 
 
 

This completes the installation of web services required for openerp. 
 
 

[  Stage 3 :  Starting Openerp server and webservices ]

 We need to create two services  to start Openerp server when the system starts 
 
 
 
1.  Openerp Server 
 
Open your terminal window and give following command.  
sudo nano /etc/init.d/openerp-server 
copy paste following text in the file and save. 
 
#!/bin/sh

#
# OpenERP init script v0.1 for centos by Open-Future
# Bert Deferme - www.open-future.be - bert@open-future.be
#

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.

# chkconfig: 345 60 61
# description: starts the openerp-server service

NAME=openerp-server
USER=openerp

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
PIDDIR=/var/run/openerp
PIDFILE=$PIDDIR/$NAME.pid
DAEMON=/usr/local/bin/openerp-server
DAEMONOPTS="--pidfile=${PIDFILE}"

checkpid() {
  [ -f $PIDFILE ] || return 1
  pid=`cat $PIDFILE`
  [ -d /proc/$pid ] && return 0
  return 1
}

do_start() {

  if [ -f $PIDFILE ]; then
    echo "pidfile already exists: $PIDFILE"
    exit 1
  fi

  echo -n "Starting $NAME: "

  if [ ! -d $PIDDIR ]
  then
      mkdir $PIDDIR
      chown $USER $PIDDIR
  fi

  su - $USER -c "nohup $DAEMON $DAEMONOPTS >/dev/null 2>&1 &"

  sleep 3

  checkpid

  if [ $? -eq 1 ]; then
    rm -f $PIDFILE
    echo "failed."
    exit 1
  fi

  echo "done."
}

do_stop() {

  checkpid

  if [ $? -eq 1 ]; then
    echo -n "$NAME not running... (no pidfile found)"
    exit 0
  fi

  echo -n "Stopping $NAME: "

  pid=`cat $PIDFILE`
  kill -15 $pid

  sleep 2

  if [ $? -eq 1 ]; then
    echo "Failed. (pidfile found but process didn't exist)"
    exit 1
  fi

  echo "done."

}

do_status() {

  echo -n "Checking $NAME: "

  checkpid

  if [ $? -eq 1 ]; then
    echo "stopped."
  else
    echo "running."
  fi

}

do_restart() {

  do_stop

  if [ $? -eq 1 ]; then
    exit 1
  fi

  do_start

}

case "$1" in
    start) do_start ;;
    stop) do_stop ;;
    restart|force-reload) do_restart ;;
    status) do_status ;;
    *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|status}" >&2
        exit 1
        ;;
esac

exit 0 
 
 
You have to make this script executable by giving following command.
 
sudo chmod a+x /etc/init.d/openerp-server 
 
 
B.  Openerp web services. 

sudo nano /etc/init.d/openerp-web


and copy paste following text.
 
 
#!/bin/sh
#
# OpenERP init script v0.2 for Centos and Ubuntu by Open-Future
# Bert Deferme - www.open-future.be - bert@open-future.be
# Philip Uren - www.mbase.com.au - philu A-t ieee.org
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.
# chkconfig: 345 61 60
# description: runs the openerp-web service
###################################################################################

NAME=openerp-web
USER=openerp

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
DAEMON=/usr/local/bin/openerp-web
PIDDIR=/var/run/openerp
PIDFILE=$PIDDIR/$NAME.pid
DAEMONOPTS="-c /etc/openerp-web.cfg"

checkpid() {
  [ -s $PIDFILE ] || return 1
  pid=`cat $PIDFILE`
  [ -z "$pid" ] && return 1
  [ -d /proc/$pid ] && return 0
  return 1
}

do_start() {

  if [ -f $PIDFILE ]; then
    echo "pidfile already exists: $PIDFILE"
    exit 1
  fi

  echo -n "Starting $NAME: "

  if [ ! -d $PIDDIR ]
  then
      mkdir $PIDDIR
      chown $USER $PIDDIR
  fi

  su - $USER -c "nohup $DAEMON $DAEMONOPTS >/dev/null 2>&1 &"

  sleep 2

  # This next line, in particular the use of the cut command, doesn't work on Ubuntu 10.10
  # because it treats a single space as a delimiter, not a series of spaces.
  # pid=`ps -ef|grep openerp-web|grep -v grep|cut -d " " -f3`
  ps -ef | grep openerp-web | grep python | grep -v grep | awk '{print $2}' > $PIDFILE  

  checkpid
  if [ $? -eq 1 ]; then
    rm -f $PIDFILE
    echo "failed."
    exit 1
  fi

  echo "done."
}

do_stop() {

  checkpid
  if [ $? -eq 1 ]; then
    echo -n "$NAME not running... (no pidfile found)"
    exit 0
  fi

  echo -n "Stopping $NAME: "

  pid=`cat $PIDFILE`
  kill -15 $pid

  sleep 2

  if [ $? -eq 1 ]; then
    echo "Failed. (pidfile found but process didn't exist)"
    exit 1
  fi

  rm $PIDFILE

  echo "done."

}

do_status() {

  echo -n "Checking $NAME: "

  checkpid
  if [ $? -eq 1 ]; then
    echo "stopped."
  else
    echo "running."
  fi

}

do_restart() {

  do_stop

  if [ $? -eq 1 ]; then
    exit 1
  fi

  do_start

}

case "$1" in
    start) do_start ;;
    stop) do_stop ;;
    restart|force-reload) do_restart ;;
    status) do_status ;;
    *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|status}" >&2
        exit 1
        ;;
esac

exit 0 
 
 
 
Now save this file.
Make this file executable by giving following command.
sudo chmod a+x /etc/init.d/openerp-web


sudo /etc/init.d/openerp-server start ----------> Press Enter.
sudo /etc/init.d/openerp-web start  ----------> Press Enter.


Without closing the terminal window,  open firefox from main menu and enter following address http://localhost:8080  


If everything is okay, you should get Openerp screen on your browser.


 
Notes :   

 



Now again reboot the system.


Open terminal window and give following commands.


sudo /etc/init.d/openerp-server start ----------> Press Enter.
sudo /etc/init.d/openerp-web start  ----------> Press Enter.




Next time just point your browser to http://localhost:8080  

That's it.



Enjoy !!!.