Sunday, 5 October 2014

Installing OpenERP 7 on UBUNTU

Installing OpenERP 7 on UBUNTU

The purpose of this step by step guide and video is to help someone with moderate IT skills and ability to follow directions install a working version of OpenERP 7 on an Ubuntu server. This is a basic setup that would be useful for development and testing purposes. Below is the basic steps that are used in this video presentation to setup OpenERP 7.0.

BASIC STEPS FOR OPENERP 7 INSTALLATION ON UBUNTU

  • Download & Install Oracle Virtual Box
  • Download & Install Umbutu (This walkthrough uses Ubuntu 12.10)
  • Configure OpenERP system account on the server
  • Install PostGRES SQL and configure permissions
  • Download latest trunk version (This example uses )
  • Configure OpenERP settings
  • Test OpenERP Installation

INSTALLING ORACLE VM VIRTUAL BOX

<p”>This setup is for people with some technical expertise who want to setup OpenERP for development, testing, or perhaps trying the system out for some potential uses in their business. Oracle’s VM Virtual Box is perfect for this sort of installation as you can quickly get up and running on your existing hardware. All the steps are essentially the same as installing Ubuntu on dedicated hardware. This method allows you to get up and going very fast.Step 1: Download VM Virtual Box - http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html
Step 2: Install VM Virtual box
Step 3: Create a new server in VM Virtual Box

INSTALLING UBUNTU

Step 1: Download Ubuntu - http://www.ubuntu.com/download/desktop
For this guide we downloaded version 12.10. Any recent version of Ubuntu should work as well although you may run into issues if you use a version before 10.05. Remember where you save the ISO.
Step 2: Mount the ISO in Virtual Box
In the VM manager go to settings and choose storage. There you will see your virtual CD. Click the small icon on the right to select your downloaded Ubuntu ISO and mount it.
Step 3: Start the Ubuntu server and install the OS
The process is very straight forward. Just  follow the prompts. Make sure you choose ‘install’ instead of the option to simply ‘try’ Ubuntu. NOTE: DO NOT MAKE YOUR USER ‘openerp’. We will be using that user login to run the openerp server. If you use openerp as the primary login for the server you may have trouble completing the rest of the steps in this guide.
Step 4: Reboot the server

CONFIGURE THE OPENERP USER AND INSTALL POSTGRES

Step 1: Type ctrl-alt-T to bring up the command window
The graphical interface is little or no use in installing OpenERP.
Step 2: Configure the openerp user
sudo adduser –system –home=/opt/openerp –group  openerp
This command creates a user named ‘openerp’ configured as a system user. There is no login or password for this user.
Step 3: Install Postgre
sudo apt-get install postgresql
This command will install all the necessary libraries for postgres.
sudo su – postgres
This command logs you in as the postgres user so that you can configure the database
createuser –createdb –username postgres –no-createrole –no-superuser –pwprompt openerp
This command will create the user and prompt you to enter a password. Make sure you don’t forget the password.
exit
This command will log you out of the postgres account.

INSTALL THE PYTHON DEPENDENCIES

This step is easy but a bit tedious. OpenERP does not automatically install all the python libraries it needs to run. You need to install them manually.
TIP: Use the up arrow on your keyboard to bring up the previous command. Then just change the end extension. I do this to keep from having to type python over and over again
Here is the complete list. If you happen to skip one you will see an error during installation that will identify to you which dependency you are missing.
sudo apt-get install python-docutils
sudo apt-get install python-gdata
sudo apt-get install python-mako
sudo apt-get install python-dateutil
sudo apt-get install python-feedparser
sudo apt-get install python-lxml
sudo apt-get install python-libxslt1
sudo apt-get install python-ldap
sudo apt-get install python-reportlab
sudo apt-get install python-pybabel
sudo apt-get install python-pychart
sudo apt-get install python-openid
sudo apt-get install python-simplejson
sudo apt-get install python-psycopg2
sudo apt-get install python-vobject
sudo apt-get install python-tz
sudo apt-get install python-vatnumber
sudo apt-get install python-webdav
sudo apt-get install python-xlwt
sudo apt-get install python-werkzeug
sudo apt-get install python-yaml
sudo apt-get install python-zsi
You really don’t have to worry about typing a line more than once. It will just re-install it. Depending on the exact build you use it is possible one or more dependencies may be left out of this list. Typically the server will tell you if it is missing one and you can just install the missing dependency using the same syntax.

DOWNLOAD AND INSTALL THE OPENERP SOFTWARE

Step 1: Download the appropriate build of OpenERP 7
The version in this example is the latest available as of Dec 19, 2012. There will be a final release in the next few days and you will likely want to use that build instead. Just change out the link.
wget http://nightly.openerp.com/trunk/nightly/src/openerp-7.0alpha-latest.tar.gz
You will get a little character progress bar that will show the package downloading.

Step 2: Unpack the TAR file
cd /opt/openerp
sudo tar xvf ~/openerp-7.0alpha-latest.tar.gz
Naturally you will want to replace the actual name above with the build you have decided to download.

Step 3: Set the permissions on the files
sudo chown -R openerp: *
This command sets the permissions on the file for the openerp user

Step 4: Copy the files over to a directory named Server
Because build names change a lot and can be very cryptic it makes sense to copy the files into a directory that is more friendly.
IMPORTANT: You will likely want to do a ‘dir’ to get the actual directory name that was created from the extracted files. While the wrapper file in this instance was openerp-7.0alpha-latest.tar.gz, the directory created was openerp-7.0alpha-20121206-000102. Therefore this is the name we must use when we copy over the files.
sudo cp -a openerp-7.0alpha-20121206-000102 server
Once again  you will want to replace the above command with the name of the build you actually downloaded.

CONFIGURE THE OPENERP 7 SERVER CONFIG FILE

Step 1: Copy the configuration file
There in a config file in the install directory that we can copy into the /etc directory to get the server up and running.
sudo cp /opt/openerp/server/install/openerp-server.conf /etc/
sudo chown openerp: /etc/openerp-server.conf
sudo chmod 640 /etc/openerp-server.conf

Step 2: Open the OpenERP configuration file
sudo nano /etc/openerp-server.conf

Step 3: Change the password in the config file
Find the entry db_password=false. Change the entry from “False” to the password you used in the PostGres installation

START THE SERVER AND TEST THE INSTALLATION

Step 1: login to the openerp account
sudo su – openerp -s /bin/bash

Step 2: Run the command to start the server
/opt/openerp/server/openerp-server

Step 3: Test the Installation in the browser
Fire up the Firefox browser and navigate to http://0.0.0.0:8069
If the installation has gone successfully then you should see the OpenERP prompting you to create your first database!


OpenERP V7.0 installation on ubuntu 12.04 x64 Server


After installation of Ubuntu 12.04 x64 Server LTS
Commands are complete so you can copy paste these commands below to and complete the process as a newbie.
Installation from launchpad makes update and patching easier. If you just want to try openERP I recommend you to install with a .deb package. Installation with .deb package just takes 1-2 minutes.

Update apt source list
    sudo apt-get update

Download and install updates
sudo apt-get upgrade

install required packages for openerp
sudo apt-get install graphviz ghostscript postgresql-client \
python-dateutil python-feedparser python-matplotlib \
python-ldap python-libxslt1 python-lxml python-mako \
python-openid python-psycopg2 python-pybabel python-pychart \
python-pydot python-pyparsing python-reportlab python-simplejson \
python-tz python-vatnumber python-vobject python-webdav \
python-werkzeug python-xlwt python-yaml python-imaging

install some other packages that we will probably need in future
sudo apt-get install gcc python-dev mc bzr python-setuptools python-babel \
python-feedparser python-reportlab-accel python-zsi python-openssl \
python-egenix-mxdatetime python-jinja2 python-unittest2 python-mock \
python-docutils lptools make python-psutil python-paramiko poppler-utils \
python-pdftools antiword postgresql

install gdata client (since ubuntu package is old we download and install from source)
wget http://gdata-python-client.googlecode.com/files/gdata-2.0.17.tar.gz 
tar zxvf gdata-2.0.17.tar.gz 
cd gdata-2.0.17/
sudo python setup.py install

create a new openerp system user for openerp and other related processes
sudo adduser openerp --home /opt/openerp

Create database user for openerp
cd ..
sudo -u postgres createuser -s openerp

move to the install directory
sudo su openerp
mkdir /opt/openerp/v7
cd /opt/openerp/v7
run the bazaar to download the latest revision from launchpad
(this will take long if an error occurs just rerun command)
bzr branch lp:openerp-web/7.0 web
(this will take longer if an error occurs just rerun command)
bzr branch lp:openobject-server/7.0 server
(this will take much more longer if an error occurs just rerun last command)
bzr branch lp:openobject-addons/7.0 addons
It would be nice if you check if the downloaded revision no pass the tests from http://runbot.openerp.com
Exit from openerp user shell
exit
Copy OpenERP configuration file to /etc
sudo cp /opt/openerp/v7/server/install/openerp-server.conf /etc/openerp-server.conf
Edit the configuration file
sudo nano /etc/openerp-server.conf
Write your database operation password and remove the semicolon of that line. Also add the addons_path to the end of file, my file looks like below.
[options]
; This is the password that allows database operations:
admin_passwd = PASSWORD
db_host = False
db_port = False
db_user = openerp
db_password = False
addons_path = /opt/openerp/v7/addons,/opt/openerp/v7/web/addons
;Log settings
logfile = /var/log/openerp/openerp-server.log
log_level = error
Change the file permissions and file ownership to the openerp user.
sudo chown openerp: /etc/openerp-server.conf
sudo chmod 640 /etc/openerp-server.conf

Create log directory for openerp
sudo mkdir /var/log/openerp
sudo chown openerp:root /var/log/openerp

Copy Logrotate file from source to /etc/logrotate.d folder
sudo cp /opt/openerp/v7/server/install/openerp-server.logrotate /etc/logrotate.d
/openerp-server
sudo chmod 755 /etc/logrotate.d/openerp-server

Run the server

sudo su openerp
cd /opt/openerp/v7/server/
./openerp-server -c /etc/openerp-server.conf &
test your installation from http://yourserverIP:8069 you should see screen below.
image description

Starting Server Up Automatically

After playing with init script in source I decided to use Open Sourcerer's init script since it is clean and nice. You can download the original from: http://www.theopensourcerer.com/wp-content/uploads/2012/12/openerp-server
We just need to change the location of the daemon. below is the init script you can copy paste this to the file.
#!/bin/sh

### BEGIN INIT INFO
# Provides:             openerp-server
# Required-Start:       $remote_fs $syslog
# Required-Stop:        $remote_fs $syslog
# Should-Start:         $network
# Should-Stop:          $network
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description:    Enterprise Resource Management software
# Description:          Open ERP is a complete ERP and CRM software.
### END INIT INFO

PATH=/bin:/sbin:/usr/bin
DAEMON=/opt/openerp/v7/server/openerp-server
NAME=openerp-server
DESC=openerp-server

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

# Specify an alternate config file (Default: /etc/openerp-server.conf).
CONFIGFILE="/etc/openerp-server.conf"

# pidfile
PIDFILE=/var/run/$NAME.pid

# Additional options that are passed to the Daemon.
DAEMON_OPTS="-c $CONFIGFILE"

[ -x $DAEMON ] || exit 0
[ -f $CONFIGFILE ] || exit 0

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

case "${1}" in
        start)
                echo -n "Starting ${DESC}: "

                start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
                        --chuid ${USER} --background --make-pidfile \
                        --exec ${DAEMON} -- ${DAEMON_OPTS}

                echo "${NAME}."
                ;;

        stop)
                echo -n "Stopping ${DESC}: "

                start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
                        --oknodo

                echo "${NAME}."
                ;;

        restart|force-reload)
                echo -n "Restarting ${DESC}: "

                start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
                        --oknodo

                sleep 1

                start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
                        --chuid ${USER} --background --make-pidfile \
                        --exec ${DAEMON} -- ${DAEMON_OPTS}

                echo "${NAME}."
                ;;

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

exit 0
You can download this edited copy with the following command First Exit from openerp users shell
exit
sudo nano  /etc/init.d/openerp-server
Make the init script executable.
sudo chmod +x /etc/init.d/openerp-server
Add openerp-server to system startup
sudo update-rc.d openerp-server defaults
Restart the server to check if init script works
sudo shutdown -r now
After restart you should be able to connect to the server via http://yourip:8069
Notes:
  1. Used some parts from this nice tutorial: http://www.theopensourcerer.com/2012/12/how-to-install-openerp-7-0-on-ubuntu-12-04-lts/
  2. I tested above commands with a clean ubuntu 12.04 install and OpenERP works as expected.

To update this installation to the latest revision

sudo /etc/init.d/openerp-server stop
sudo su openerp
cd /opt/openerp/v7/addons/
bzr pull
cd /opt/openerp/v7/web/
bzr pull
cd /opt/openerp/v7/server/
bzr pull
It would be nice if you check if the downloaded revision no pass the tests of http://runbot.openerp.com You should run the server with your database name and update your database with the following command.
./openerp-server -c /etc/openerp-server.conf -u all -d YOURDATABASENAME

To Apply a Patch

To apply a patch you should have a patch file or URL of the patch file.
Cd to the project folder (addons,web,server etc). apply patch with bzr command bzr patch.
to apply a patch to the addons branch:
cd /opt/openerp/v7/addons/
bzr patch PATCH_FILE_NAME_OR_URL

To install an additional independent V7 test server on the same OS

On production you would need to test some code changes or patches or some new modules. To be able to test without risking your production server a test server is a good idea. Best option is to have a virtual machine with openerp installed. However if you like to have an seperate openerp setup.
coming...

Notes:

Why 64 bit not 32

I am using an x64 version of ubuntu because my server has more than 4GB of RAM. And 64 is bigger than 32 :) "Unless you have specific reasons to choose 32-bit, we recommend 64-bit to utilise the full capacity of your hardware." https://help.ubuntu.com/community/32bit_and_64bit you can read related article.

openerp user

My openerp user is just a normal user (not a system user) who can login to the system. I choose to have it this way since I login as openerp user and do required tasks with this uid. You should select a secure password. Some Linux experts thinks this is not secure enough, keep in mind.

Postgresql openerp role

openerp postgresql role is superuser in my installation, it is not required to but it is easier for me. Some Linux experts thinks this is not secure enough, keep in mind.

init.d script for autostart

I just found out that there is also a suitable init.d script for debian already "hidden" :) in the source of OpenERP server in the file /opt/openerp/v7/server/debian/openerp.init you can change the pathnames and use this file also.

Monday, 22 September 2014

OpenERP Architecture

OpenERP is a multitenant, three-tier architecture. The application tier itself is written as a core, multiple additional modules can be installed to create a particular configuration of OpenERP.
  
Client-Server Architecture:
        Open ERP has isolate client server components.The server runs 

separately from the client.It handles the business logic and communi-
cates with the database application.The client presents information to 
users and allow them to inter-operate with the server.Multiple client 
application is available.


Server and Modules:
        Server part is written in Python progrmming language.The client communicates with server using XML-RPC interface.Business functionality is organized into modules.A module is a folder with a pre-defined structure containing Python code and XML files.A module defines data  structure, forms, reports, menus, procedure,workflows,etc...Modules are defined using a client-independent syntax.So,adding new objects,such as menus or forms,makes it available to any client.


Client Applications:
   There are two client application are:      
       A web Application:               
           which is deployed as an HTTP Server to allow users to connect using web browser.
       Desktop Application:          

           Written in Python which uses GTK tool kit(Graphics tool Kit)

DataBase:
    OpenERP uses PostgreSQL as database management system.Postgres is an object-relational database management system(ORDBMS)

Reporting:
         OpenERP also provides a reporting system with OpenOffice.org integration allowing customization of reports.
          OpenOffice.org whose main components are word processing, spreadsheets,presentation,graphics,and database.

Sunday, 21 September 2014

Release history

  Old version
  Older version, still supported
  Latest version
  Future version
Program name Version Launch date Significant changes
Tiny ERP 1.0         2005 First GPL release
2.0

3.0

4.0         2007
OpenERP 4.2         September 2008
5.0         April 2009
6.0         January 2011 First AGPL release
6.1         February 2012
7.0         December 22, 2012
Odoo 8.0         September 18, 2014
9.0         July, 2015

About OpenERP

Odoo(OpenERP) is a suite of open-source business apps written in Python and released under the AGPL license. It is used by 2 million users worldwide to manage companies of all different sizes. The main Odoo components are the server, 260 core modules (also called official modules) and around 4000 community modules.


Odoo was formely known as OpenERP until May 2014. It was rebranded because version 8 of the software included apps including website builder, e-commerce, point of sale and business intelligence. The software conforms to standard expectations of ERP systems, while providing additional modules beyond the coverage of traditional ERP systems.
The official Odoo apps are organized in 6 groups:
  • Front-end apps: website builder, blog, e-commerce
  • Sales management apps: CRM, point of sales, quotation builder
  • Business operations apps: project management, inventory, manufacturing, accounting and purchase
  • Marketing apps: mass mailing, lead automation, events, survey, forum, live chat
  • Human Resources apps: employee directory, enterprise social network, leaves management, timesheet, fleet management
  • Productivity apps: business intelligence, instant messaging, notes
The software is actively programmed, supported, and organized by OpenERP s.a.. Odoo is similar to many open source projects where customized programming, support, and other services are also provided by an active global community and a network of 500 official partners.



Original author(s) Fabien Pinckaers
Developer(s) OpenERP S.A.
Stable release 8.0 / September 18, 2014; 3 days ago
Preview release current master version / daily
Written in Python, JavaScript, XML
Operating system Linux, Windows, Unix, Mac OS X
Type ERP, CRM, Accounting, CMS
License AGPL
Website www.odoo.com