Friday 2 December 2011

How to install and configure openerp on Ubuntu 10.10 setp by step


[How to] Installation OpenERP v6.x.x on Ubuntu server 10.10 MAVERAK
Manual installation of the openerp-server and the openerp-web server (OpenERP v6.x.x) on the same
servermachine, with a fresh installed Ubuntu 10.10 server (64 bit). Install only the openssh server,
make no server system updates after the server installation.
The result of this installation is an automatic boot-up of the OpenERP servers (application and webserver).
1:- The Ubuntu user must have root rights.
2:- Installation of dependencies and postgresql
     sudo addgroup openerp
     sudo adduser --ingroup openerp openerp
     # password = openerp@123

3:- sudo apt-get install postgresql (installs postgresql 8.4)
     sudo su - postgres
     createuser --createdb --no-createrole --pwprompt openerp
    #password openerp@123
    Shall the new role be a superuser? (y/n) y
    exit from postgresql command: \q

4:- Install dependencies for OpenErp Server
      sudo apt-get install python-psycopg2 python-reportlab python-imaging python-egenix-mxdatetime python-tz python-pychart python-pydot python-lxml python-vobject python-yaml python-profiler    python-setuptools
python-mako graphviz python-dev build-essential
sudo easy_install PyYaml

5:- Installation of Openerp-server
     cd /home/openerp
     sudo wget http://www.openerp.com/download/stable/source/openerp-server-6.0.1.tar.gz
     sudo tar zxvf openerp-server-6.0.1.tar.gz
     cd /home/openerp/openerp-server-6.0.1
     sudo python setup.py install
     su openerp
6:- cd /home/openerp/openerp-server-6.0.1
     openerp-server -s (This starts up the server and also creates a configuration file ".openerp_serverrc" in   the directory /home/openerp)
     You must see something like this:
     [2011-01-29 18:25:21,645][?] INFO:server:OpenERP version - 6.0.1
     [2011-01-29 18:25:21,646][?] INFO:server:addons_path - /usr/local/lib/python2.6/dist-packages/openerp-server/addons
    [2011-01-29 18:25:21,646][?] INFO:server:database hostname - localhost
    [2011-01-29 18:25:21,646][?] INFO:server:database port - 5432
    [2011-01-29 18:25:21,646][?] INFO:server:database user - openerp
    [2011-01-29 18:25:21,646][?] INFO:server:initialising distributed objects services
    [2011-01-29 18:25:21,829][?] INFO:web-services:starting HTTP service at 0.0.0.0 port 8069
    [2011-01-29 18:25:21,830][?] INFO:web-services:starting HTTPS service at 0.0.0.0 port 8071
    [2011-01-29 18:25:21,830][?] INFO:web-services:Registered XML-RPC over HTTP
    [2011-01-29 18:25:21,831][?] INFO:web-services:starting NET-RPC service at 0.0.0.0 port 8070
    [2011-01-29 18:25:21,831][?] INFO:server:Starting 3 services
    [2011-01-29 18:25:21,833][?] INFO:server:OpenERP server is running, waiting for connections...
7:- Control C (to shut down the openerp-server)
     exit
8:- Installation of the Openerp-server daemon
     sudo vi /etc/init.d/openerp-server (create a new file)
     #! /bin/sh
    ### BEGIN INIT INFO
    # Provides: openerp-server
    # Required-Start: $syslog
    # Required-Stop: $syslog
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: OpenERP Server - the server
    # Description: OpenERP is a complete ERP and CRM software
    ### END INIT INFO
   PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
   DESC=openerp-server
   NAME=openerp-server
   DAEMON=/usr/local/bin/openerp-server
   # Specify the user name (Default: openerp).
   USER="openerp"
  # Specifty an alternate config file (Default: ~/.openerp_serverrc)
  CONFIGFILE="/home/openerp/.openerp_serverrc"
  # pidfile
  PIDFILE=/var/run/$NAME.pid
  # Additional options that are passed to the Daemon
  DAEMON_OPTS="-c $CONFIGFILE"
  # Exit if the package is not installed
  [ -x "$DAEMON" ] || exit 0
  [ -f $CONFIGFILE ] || exit 0
  checkpid() {
  [ -f $PIDFILE ] || return 1
  pid=`cat $PIDFILE`
  [ -d /proc/$pid ] && return 0
  return 1
  }
  # function that starts the daemon/service
  #
  if [ -f /lib/lsb/init-functions ] || [ -f /etc/gentoo-release ] ; then
  do_start() {
  start-stop-daemon --start --quiet --pidfile $PIDFILE \
  --chuid $USER --background --make-pidfile \
  --exec $DAEMON -- $DAEMON_OPTS
  RETVAL=$?
  sleep 5 # wait for few seconds
  return $RETVAL
  }
  #
  # Function that stops the daemon/service
  do_stop() {
  start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo
  RETVAL=$?
  sleep 2 # wait for few seconds
  rm -f $PIDFILE # remove pidfile
  return $RETVAL
  }
  do_restart() {
  start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo
  sleep 2 # wait for few seconds
  rm -f $PIDFILE # remove pidfile
  start-stop-daemon --start --quiet --pidfile $PIDFILE \
  --chuid $USER --background --make-pidfile \
  --exec $DAEMON -- $DAEMON_OPTS
  RETVAL=$?
  sleep 5 # wait for few seconds
  return $RETVAL
  }
  else
  do_start() {
  $DAEMON $DAEMON_OPTS > /dev/null 2>&1 &
  RETVAL=$?
  sleep 5 # wait for few seconds
  echo $! > $PIDFILE # create pidfile
  return $RETVAL
  }
  do_stop() {
  pid=`cat $PIDFILE`
  kill -15 $pid
  RETVAL=$?
  sleep 2 # wait for few seconds
  rm -f $PIDFILE # remove pidfile
  return $RETVAL
  }
 do_restart() {
 if [ -f $PIDFILE ]; then
 do_stop
 fi
 do_start
 return $?
 }
 fi
 start_daemon() {
 if [ -f $PIDFILE ]; then
 echo "pidfile already exists: $PIDFILE"
 exit 1
 fi
 echo -n "Starting $DESC: "
 do_start
 checkpid
 if [ $? -eq 1 ]; then
 rm -f $PIDFILE
 echo "failed."
 exit 1
 fi
 echo "done."
 }
 stop_daemon() {
 checkpid
 if [ $? -eq 1 ]; then
 exit 0
 fi
 echo -n "Stopping $DESC: "
 do_stop
 if [ $? -eq 1 ]; then
 echo "failed."
 exit 1
 fi
 echo "done."
 }
 restart_daemon() {
 echo -n "Reloading $DESC: "
 do_restart
 checkpid
 if [ $? -eq 1 ]; then
 rm -f $PIDFILE
 echo "failed."
 exit 1
 fi
 echo "done."
 }
 status_daemon() {
 echo -n "Checking $DESC: "
 checkpid
 if [ $? -eq 1 ]; then
 echo "stopped."
 else
 echo "running."
 fi
 }
 case "$1" in
 start) start_daemon ;;
 stop) stop_daemon ;;
 restart|force-reload) restart_daemon ;;
 status) status_daemon ;;
 *)
 N=/etc/init.d/$NAME
 echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
 exit 1
 ;;
 esac
 exit 0 
 # vim: sts=4 st=4 et

9:   sudo chmod +x /etc/init.d/openerp-server
10: sudo mkdir /var/log/openerp
11: sudo touch /var/log/openerp/openerp-server.log
10: sudo chown -R openerp:openerp /var/log/openerp/
11: sudo update-rc.d openerp-server defaults
       su openerp
12: cd /home/openerp
       vim .openerp_serverrc
Change: do the following changes in this file # set the value according to your requirements

[options]
without_demo = False
smtp_port = 25
db_password = False  #openerp@123
xmlrpcs_interface =
syslog = False
logrotate = True
xmlrpcs_port = 8071
test_report_directory = False
list_db = True
xmlrpc_interface =
timezone = False
cache_timeout = 100000
smtp_password = False
secure_pkey_file = server.pkey
xmlrpc_port = 8069
log_level = info
test_disable = False
admin_passwd = admin
assert_exit_level = error
smtp_server = localhost
static_http_url_prefix = None
test_commit = False
xmlrpcs = True
demo = {}
login_message = False
import_partial =
pidfile = None
db_maxconn = 64
stop_after_init = False
test_file = False
reportgz = False
xmlrpc = True
netrpc_port = 8070
db_port = False            #5432
db_name = False
debug_mode = False
netrpc = True
secure_cert_file = server.cert
logfile = none               #/var/log/openerp/openerp-server.log
csv_internal_sep = ,
pg_path = None
static_http_enable = False
translate_modules = ['all']
smtp_ssl = False
root_path = /usr/local/lib/python2.6/dist-packages/openerp-server
netrpc_interface =
smtp_user = False
db_user = "openerp"
db_host = False            #localhost
email_from = False
addons_path = /usr/local/lib/python2.6/dist-packages/openerp-server/addons
static_http_document_root = None
exit

13: sudo chmod 777 /usr/local/lib/python2.6/dist-packages/openerp-server/addons
14: sudo /etc/init.d/openerp-server start
15: sudo /etc/init.d/openerp-server status (it must say: running)

16: Installing Openerp-web
      cd /home/openerp
17: sudo wget http://www.openerp.com/download/stable/source/openerp-web-6.0.1.tar.gz
18: sudo tar zxvf openerp-web-6.0.1.tar.gz
19: cd /home/openerp/openerp-web-6.0.1
20: sudo python setup.py install (this installation takes a while)
21: ./openerp-web.py (start server for testing)

You must see something like this:
[29/Jan/2011:19:37:37] ENGINE Bus STARTING
[29/Jan/2011:19:37:37] ENGINE Started monitor thread '_TimeoutMonitor'.
[29/Jan/2011:19:37:37] ENGINE Started monitor thread 'Autoreloader'.
[29/Jan/2011:19:37:37] ENGINE Serving on 0.0.0.0:8080
[29/Jan/2011:19:37:37] ENGINE Bus STARTED
Control C (to shut down the openerp-web server).

22: Installation of the Openerp-web daemon
       sudo mkdir /usr/local/bin/openerp
23: sudo vim /usr/local/bin/openerp/openerp-web
paste the two line shown below and save, exit.

#!/bin/sh

24: cd /home/openerp/openerp-web-6.0.1
      exec /usr/bin/python ./openerp-web.py $@
25: sudo chmod +x /usr/local/bin/openerp/openerp-web
26: sudo vim /etc/init.d/openerp-web (create a new file)
Paste the below scrip to the file

#!/bin/sh
### BEGIN INIT INFO
# Provides:
openerp-web
# Required-Start:
$syslog
# Required-Stop:
$syslog
# Should-Start:
$network
# Should-Stop:
$network
# Default-Start:
2345
# Default-Stop:
016
# Short-Description: OpenERP Web - the Web Client of the OpenERP
# Description:
OpenERP is a complete ERP and CRM software.
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin/openerp
DAEMON=/usr/local/bin/openerp/openerp-web
NAME=openerp-web
DESC=openerp-web
# Specify the user name (Default: openerp).
USER="openerp"
# Specify an alternate config file (Default: /etc/openerp-web.cfg).
CONFIGFILE="/etc/openerp-web.cfg"
# pidfile
PIDFILE=/var/run/$NAME.pid
# Additional options that are passed to the Daemon
DAEMON_OPTS="-c $CONFIGFILE"
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
[ -f $CONFIGFILE ] || exit 0
checkpid() {
[ -f $PIDFILE ] || return 1
pid=`cat $PIDFILE`
[ -d /proc/$pid ] && return 0
return 1
}
# function that starts the daemon/service
#
if [ -f /lib/lsb/init-functions ] || [ -f /etc/gentoo-release ] ; then
do_start() {
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--chuid $USER --background --make-pidfile \
--exec $DAEMON -- $DAEMON_OPTS
RETVAL=$?
sleep 5 # wait for few seconds
return $RETVAL
}
#
# Function that stops the daemon/service
do_stop() {
start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo
RETVAL=$?
sleep 2 # wait for few seconds
rm -f $PIDFILE # remove pidfile
return $RETVAL
}
do_restart() {
start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo
sleep 2 # wait for few seconds
rm -f $PIDFILE # remove pidfile
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--chuid $USER --background --make-pidfile \
--exec $DAEMON -- $DAEMON_OPTS
RETVAL=$?
sleep 5 # wait for few seconds
return $RETVAL
}
else
do_start() {
$DAEMON $DAEMON_OPTS > /dev/null 2>&1 &
RETVAL=$?
sleep 5 # wait for few seconds
echo $! > $PIDFILE # create pidfile
return $RETVAL
}
do_stop() {
pid=`cat $PIDFILE`
kill -15 $pid
RETVAL=$?
sleep 2 # wait for few seconds
rm -f $PIDFILE # remove pidfile
return $RETVAL
}
do_restart() {
if [ -f $PIDFILE ]; then
do_stop
fi
do_start
return $?
}
fi
start_daemon() {
if [ -f $PIDFILE ]; then
echo "pidfile already exists: $PIDFILE"
exit 1
fi
echo -n "Starting $DESC: "
do_start
checkpid
if [ $? -eq 1 ]; then
rm -f $PIDFILE
echo "failed."
exit 1
fi
echo "done."
}
stop_daemon() {
checkpid
if [ $? -eq 1 ]; then
exit 0
fi
echo -n "Stopping $DESC: "
do_stop
if [ $? -eq 1 ]; then
echo "failed."
exit 1
fi
echo "done."
}
restart_daemon() {
echo -n "Reloading $DESC: "
do_restart
checkpid
if [ $? -eq 1 ]; then
rm -f $PIDFILE
echo "failed."
exit 1
fi
echo "done."
}
status_daemon() {
echo -n "Checking $DESC: "
checkpid
if [ $? -eq 1 ]; then
echo "stopped."
else
echo "running."
fi
}
case "$1" in
start) start_daemon ;;
stop) stop_daemon ;;
restart|force-reload) restart_daemon ;;
status) status_daemon ;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0
# vim: sts=4 st=4 et

27: sudo chmod +x /etc/init.d/openerp-web
28: sudo chmod 777 /home/openerp/openerp-web-6.0.1/addons
29 :sudo cp /usr/local/lib/python2.6/dist-packages/openerp_web-6.0.1-py2.6.egg/doc/openerp-web.cfg /etc/
30: sudo vi /etc/openerp-web.cfg

Change:
log.access_file = "/var/log/openerp-web/access.log"
log.error_file = "/var/log/openerp-web/error.log"

save and exit

31: sudo mkdir -p /var/log/openerp-web
32: sudo touch /var/log/openerp-web/access.log
33: sudo touch /var/log/openerp-web/error.log
34: sudo chown -R openerp:openerp /var/log/openerp-web/
35: sudo update-rc.d openerp-web defaults
36: sudo /etc/init.d/openerp-web start

Browser interface
Type in your browser:
http://ipaddressserver:8080 or http://localhost:8080
You must see a login screen; create first a database.
if you find the error of does not connect to server or database can not be create, super admin bad password then go vim /etc/init.d/openerp-server and do the proper changes of your db_passwd: your postgresql openerp user password:
reboot you openerp server and openerp-web , refresh your browser this time you be happy to see you can add database.!!!!!
And EnJoY using the OpEnErP

*Hope This Help You And Save Your Time*

3 comments:

  1. where are you facing the issue, let me know so that i can help you to resolve the issue.

    ReplyDelete
  2. if your openerp-web is creating problem on starting of Error. import module dect:

    ./openerp-web.py Traceback (most recent call last):
    File "./openerp-web.py", line 11, in
    from openobject.commands import start, ConfigurationError
    File "/home/openerp/openerp-web-6.0.1/openobject/commands.py", line 8, in
    from cherrypy._cpconfig import as_dict
    ImportError: cannot import name as_dict


    then changed "CherryPy >= 3.1.2" to "CherryPy == 3.1.2" in setup.py in openerp-web-version and run the installation command again step 20 and mover on.

    good luck.

    ReplyDelete